From d47dae9723d1354c7eb6cef1df1a0a640c8960ee Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 29 Nov 2022 12:33:59 -0500 Subject: [PATCH] v2.0.0: added handling for duelist abilities missing (e.g. vs monks) --- .../items/quest/Pickaxe.java | 9 ++++---- .../items/weapon/melee/Rapier.java | 5 +++-- .../items/weapon/melee/RunicBlade.java | 5 +++-- .../items/weapon/melee/Spear.java | 22 ++++++++++--------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java index 72190f6b7..bddc420ad 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java @@ -204,12 +204,13 @@ public class Pickaxe extends MeleeWeapon { || enemy instanceof Scorpio) { damageMulti = 2f; } - hero.attack(enemy, damageMulti, 0, Char.INFINITE_ACCURACY); - if (enemy.isAlive()){ - Buff.affect(enemy, Vulnerable.class, 3f); + if (hero.attack(enemy, damageMulti, 0, Char.INFINITE_ACCURACY)) { + if (enemy.isAlive()) { + Buff.affect(enemy, Vulnerable.class, 3f); + } + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } onAbilityUsed(hero); - Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java index 5433b0075..9b3e09ef4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java @@ -109,9 +109,10 @@ public class Rapier extends MeleeWeapon { @Override public void call() { //+3+lvl damage, equivalent to +67% damage, but more consistent - hero.attack(enemy, 1f, 3 + level(), Char.INFINITE_ACCURACY); + if (hero.attack(enemy, 1f, 3 + level(), Char.INFINITE_ACCURACY)){ + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + } onAbilityUsed(hero); - Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java index 3707d8d19..6aab6d03e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java @@ -81,10 +81,11 @@ public class RunicBlade extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { - hero.attack(enemy, 1f, 0, Char.INFINITE_ACCURACY); + if (hero.attack(enemy, 1f, 0, Char.INFINITE_ACCURACY)){ + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + } tracker.detach(); onAbilityUsed(hero); - Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java index 317521fc4..b8f967d91 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave; @@ -84,18 +85,19 @@ public class Spear extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { - hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY); - wep.onAbilityUsed(hero); - Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); - if (enemy.isAlive()){ - //trace a ballistica to our target (which will also extend past them - Ballistica trajectory = new Ballistica(hero.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 - WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero.getClass()); + if (hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY)) { + if (enemy.isAlive()){ + //trace a ballistica to our target (which will also extend past them + Ballistica trajectory = new Ballistica(hero.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 + WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero.getClass()); + } + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } + wep.onAbilityUsed(hero); hero.spendAndNext(hero.attackDelay()); } });