From 9a52b494677a67654cf06b4267bfc47c537b8a97 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 28 Apr 2021 20:01:18 -0400 Subject: [PATCH] v0.9.3: standardized knockback effects to always work on dead chars --- .../actors/buffs/Combo.java | 30 +++++++++---------- .../items/wands/WandOfBlastWave.java | 4 ++- .../levels/features/Chasm.java | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index d4f9eb4a3..3a7920252 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -331,24 +331,22 @@ public class Combo extends Buff implements ActionIndicator.Action { switch (moveBeingUsed) { case CLOBBER: hit( enemy ); - if (enemy.isAlive()) { - //trace a ballistica to our target (which will also extend past them - Ballistica trajectory = new Ballistica(target.pos, enemy.pos, Ballistica.STOP_TARGET); - //trim it to just be the part that goes past them - trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE); - //knock them back along that ballistica, ensuring they don't fall into a pit - int dist = 2; - if (count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1){ - dist ++; - Buff.prolong(enemy, Vertigo.class, 3); - } else if (!enemy.flying) { - while (dist > trajectory.dist || - (dist > 0 && Dungeon.level.pit[trajectory.path.get(dist)])) { - dist--; - } + //trace a ballistica to our target (which will also extend past them + Ballistica trajectory = new Ballistica(target.pos, enemy.pos, Ballistica.STOP_TARGET); + //trim it to just be the part that goes past them + trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE); + //knock them back along that ballistica, ensuring they don't fall into a pit + int dist = 2; + if (enemy.isAlive() && count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1){ + dist ++; + Buff.prolong(enemy, Vertigo.class, 3); + } else if (!enemy.flying) { + while (dist > trajectory.dist || + (dist > 0 && Dungeon.level.pit[trajectory.path.get(dist)])) { + dist--; } - WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false); } + WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false); break; case PARRY: hit( enemy ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 10d2c5187..5fa9bc02e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -88,7 +88,9 @@ public class WandOfBlastWave extends DamageWand { Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT); int strength = 1 + Math.round(buffedLvl() / 2f); throwChar(ch, trajectory, strength, false); - } else if (ch == Dungeon.hero){ + } + + if (ch == Dungeon.hero){ Dungeon.fail( getClass() ); GLog.n( Messages.get( this, "ondeath") ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index 5cfc01d95..bf077d132 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -134,7 +134,7 @@ public class Chasm implements Hero.Doom { public static void mobFall( Mob mob ) { if (mob.isAlive()) mob.die( Chasm.class ); - ((MobSprite)mob.sprite).fall(); + if (mob.sprite != null) ((MobSprite)mob.sprite).fall(); } public static class Falling extends Buff {