From 96255d465034a36520daddb2de61732d6a2edfdc Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:31:18 -0800 Subject: [PATCH] Add back bullet absorption --- src/progressed/content/bullets/PMBullets.java | 24 +---------------- .../bullet/energy/BlackHoleBulletType.java | 27 +++++++------------ 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/progressed/content/bullets/PMBullets.java b/src/progressed/content/bullets/PMBullets.java index f6a4e8c4..970c46f4 100644 --- a/src/progressed/content/bullets/PMBullets.java +++ b/src/progressed/content/bullets/PMBullets.java @@ -25,7 +25,7 @@ public class PMBullets{ pillarField, - blackHole, absorbed, + blackHole, excaliburLaser, sentinelLaser, @@ -113,28 +113,6 @@ public static void load(){ chargeEffect = EnergyFx.kugelblitzGrow; }}; - absorbed = new BulletType(0f, 0f){ - @Override - public void despawned(Bullet b){ - //Do nothing - } - - @Override - public void hit(Bullet b, float x, float y){ - //Do nothing - } - - @Override - public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){ - //do nothing - } - - @Override - public void update(Bullet b){ - //Do nothing - } - }; - excaliburLaser = new CrossLaserBulletType(1500f){{ length = 800f; width = 26f; diff --git a/src/progressed/entities/bullet/energy/BlackHoleBulletType.java b/src/progressed/entities/bullet/energy/BlackHoleBulletType.java index 8de01f0f..84e13b3c 100644 --- a/src/progressed/entities/bullet/energy/BlackHoleBulletType.java +++ b/src/progressed/entities/bullet/energy/BlackHoleBulletType.java @@ -10,12 +10,10 @@ import mindustry.entities.bullet.*; import mindustry.gen.*; import mindustry.graphics.*; -import progressed.content.bullets.*; import progressed.content.effects.*; import progressed.entities.*; import progressed.entities.bullet.pseudo3d.*; import progressed.graphics.renders.*; -import progressed.graphics.trails.*; public class BlackHoleBulletType extends BulletType{ static Seq> immuneTypes = Seq.with( @@ -32,6 +30,7 @@ public class BlackHoleBulletType extends BulletType{ public Effect absorbEffect = EnergyFx.blackHoleAbsorb, swirlEffect = EnergyFx.blackHoleSwirl; public float suctionRadius = 160f, size = 6f, lensEdge = -1f, damageRadius = 17f; public float force = 10f, scaledForce = 800f, bulletForce = 0.1f, bulletScaledForce = 1f; + public float bulletDamage = 10f; public float swirlInterval = 3f; public int swirlEffects = 4; public boolean repel; @@ -85,9 +84,14 @@ public void update(Bullet b){ other.move(impulse.x, impulse.y); } - /*if(Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){ - absorbBullet(other); - }*/ + if(other.type.hittable && Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){ + float realDamage = bulletDamage * damageMultiplier(b); + if(other.damage > realDamage){ + other.damage(other.damage - realDamage); + }else{ + other.remove(); + } + } } }); } @@ -137,19 +141,6 @@ public void despawned(Bullet b){ } } - public void absorbBullet(Bullet bullet){ - if(absorbEffect != Fx.none) absorbEffect.at(bullet.x, bullet.y); - if(bullet.type.trailLength > 0 && bullet.trail != null && bullet.trail.size() > 0){ - if(bullet.trail instanceof PMTrail t){ - TrailFadeFx.PMTrailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, t.copyPM()); - }else{ - Fx.trailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, bullet.trail.copy()); - } - } - bullet.type = PMBullets.absorbed; - bullet.absorb(); - } - public static boolean checkType(BulletType type){ //Returns true for bullets immune to suction. return immuneTypes.contains(c -> c.isAssignableFrom(type.getClass())); }