v2.0.0: added handling for duelist abilities missing (e.g. vs monks)

This commit is contained in:
Evan Debenham
2022-11-29 12:33:59 -05:00
parent edbe5bace3
commit d47dae9723
4 changed files with 23 additions and 18 deletions

View File

@@ -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());
}
});

View File

@@ -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());
}
});

View File

@@ -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());
}
});

View File

@@ -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());
}
});