From 45c8063dec9344b2ca4ce26e653dc7b163797948 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 8 Dec 2022 12:51:45 -0500 Subject: [PATCH] v2.0.0: fixed several missing bits in flail ability --- .../assets/messages/items/items.properties | 2 ++ .../items/weapon/melee/Flail.java | 31 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index eb490f19c..3658ae9d7 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1514,6 +1514,8 @@ items.weapon.melee.flail.ability_name=spin items.weapon.melee.flail.spin_warn=You can't spin the flail any more. items.weapon.melee.flail.ability_desc=The Duelist can _spin_ a flail to build up power for a short time. Each turn the flail is spun it will deal +20% damage, to a max of 3 times. At 3 spins the flail is also guaranteed to hit. Starting to spin the flail costs 2 charges. items.weapon.melee.flail.desc=A spiked ball attached to a handle by a length of chain. Very unwieldy, but devastating if it lands a solid hit. +items.weapon.melee.flail$spinabilitytracker.name=spinning +items.weapon.melee.flail$spinabilitytracker.desc=The Duelist is spinning her flail, building damage for her next attack with it. Each spin takes one turn but increases damage by 20%%. At 60%% bonus damage, the flail is also guaranteed to hit.\n\nCurrent bonus damage: %1$d%%.\nTurns remaining: %2$s. items.weapon.melee.gauntlet.name=stone gauntlet items.weapon.melee.gauntlet.stats_desc=This is a very fast weapon. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java index 315289538..b72b42903 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java @@ -53,26 +53,30 @@ public class Flail extends MeleeWeapon { lvl*Math.round(1.6f*(tier+1)); //+8 per level, up from +5 } + private static float spinBonus = 1f; + @Override public int damageRoll(Char owner) { - int dmg = super.damageRoll(owner); - - SpinAbilityTracker spin = owner.buff(SpinAbilityTracker.class); - if (spin != null){ - dmg = Math.round(dmg * (1f + 0.2f*spin.spins)); - if (spin.spins == 3) Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); - spin.detach(); - } - + int dmg = Math.round(super.damageRoll(owner) * spinBonus); + if (spinBonus == 1.6f) Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + spinBonus = 1f; return dmg; } @Override public float accuracyFactor(Char owner, Char target) { SpinAbilityTracker spin = owner.buff(SpinAbilityTracker.class); - if (spin != null && spin.spins >= 3f) { - return Float.POSITIVE_INFINITY; + if (spin != null) { + //we detach and calculate bonus here in case the attack misses + spin.detach(); + spinBonus = 1f + 0.2f*spin.spins; + if (spinBonus == 1.6f){ + return Float.POSITIVE_INFINITY; + } else { + return super.accuracyFactor(owner, target); + } } else { + spinBonus = 1f; return super.accuracyFactor(owner, target); } } @@ -137,6 +141,11 @@ public class Flail extends MeleeWeapon { return Math.max(0, (3 - visualcooldown()) / 3); } + @Override + public String desc() { + return Messages.get(this, "desc", 20*spins, dispTurns()); + } + public static String SPINS = "spins"; @Override