From 4243fbde8d449ca1bb6dd1afd6541597c3d170f7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 27 Feb 2023 16:53:33 -0500 Subject: [PATCH] v2.0.0: implemented the dragon kick ability --- .../assets/messages/actors/actors.properties | 2 +- .../actors/buffs/MonkEnergy.java | 60 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 27adb60a7..9067cf347 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -283,7 +283,7 @@ actors.buffs.monkenergy$monkability$dash.name=dash actors.buffs.monkenergy$monkability$dash.prompt=Choose a Location actors.buffs.monkenergy$monkability$dash.desc=An instant dash up to 3 tiles away. This ability can go over hazards, but not through enemies or walls. actors.buffs.monkenergy$monkability$dragonkick.name=dragon kick -actors.buffs.monkenergy$monkability$dragonkick.desc=A devastating kick that deals %1$d-%2$d damage and ignores armor. The kick also knocks the target away and paralyzes them for 5 turns. +actors.buffs.monkenergy$monkability$dragonkick.desc=A devastating kick that deals %1$d-%2$d damage and ignores armor. The kick knocks the target away and paralyzes them for each tile they travel. actors.buffs.monkenergy$monkability$meditate.name=meditate actors.buffs.monkenergy$monkability$meditate.desc=The Monk focuses energy into her body for 5 turns. This clears most negative effects and grants her 10 turns of wand and artifact recharging. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java index 239ca2779..ade9ab683 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RipperDemon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogDzewa; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door; @@ -262,8 +263,8 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action { public void call() { hero.attack(enemy, 1, 0, Char.INFINITE_ACCURACY); Invisibility.dispel(); + hero.next(); tracker.detach(); - Buff.affect(hero, MonkEnergy.class).abilityUsed(Flurry.this); if (hero.buff(JustHitTracker.class) != null) { hero.buff(JustHitTracker.class).detach(); @@ -272,6 +273,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action { }); } else { Invisibility.dispel(); + hero.next(); tracker.detach(); Buff.affect(hero, MonkEnergy.class).abilityUsed(Flurry.this); if (hero.buff(JustHitTracker.class) != null) { @@ -396,9 +398,63 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action { return 3; } + @Override + public String desc() { + //3x hero unarmed damage + return Messages.get(this, "desc", 3, 3*(Dungeon.hero.STR()-8)); + } + + @Override + public String targetingPrompt() { + return Messages.get(MeleeWeapon.class, "prompt"); + } + @Override public void doAbility(Hero hero, Integer target) { - //TODO + if (target == null || target == -1){ + return; + } + + Char enemy = Actor.findChar(target); + if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]) { + GLog.w(Messages.get(MeleeWeapon.class, "ability_no_target")); + return; + } + + UnarmedAbilityTracker tracker = Buff.affect(hero, UnarmedAbilityTracker.class); + if (!hero.canAttack(enemy)){ + GLog.w(Messages.get(MeleeWeapon.class, "ability_bad_position")); + tracker.detach(); + return; + } + + hero.sprite.attack(enemy.pos, new Callback() { + @Override + public void call() { + AttackIndicator.target(enemy); + if (hero.attack(enemy, 4f, 0, Char.INFINITE_ACCURACY)){ + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + } + + if (enemy.isAlive()){ + int oldPos = enemy.pos; + //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, 6, true, false, hero.getClass()); + + if (trajectory.dist > 0) { + Buff.affect(enemy, Paralysis.class, Math.min( 6, trajectory.dist)); + } + } + Invisibility.dispel(); + hero.spendAndNext(hero.attackDelay()); + tracker.detach(); + Buff.affect(hero, MonkEnergy.class).abilityUsed(DragonKick.this); + } + }); } }