From d167ce29f1b709292fd118a96a9ea6e417c5eb5b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 25 Aug 2024 11:38:18 -0400 Subject: [PATCH] v2.5.0: adjusted melee acc talents to work with unarmed melee attacks --- .../assets/messages/actors/actors.properties | 4 +- .../actors/hero/Hero.java | 38 ++++++++++++++++++ .../items/weapon/melee/MeleeWeapon.java | 40 ------------------- 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 8875640ba..4d456793b 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -904,7 +904,7 @@ actors.hero.talent.focused_meal.title=focused meal actors.hero.talent.focused_meal.desc=_+1:_ Eating food takes the Duelist 1 turn and grants her _0.67 charges_ on her weapons.\n\n_+2:_ Eating food takes the Duelist 1 turn and grants her _1 charge_ on her weapons. actors.hero.talent.focused_meal.meta_desc=_If this talent is gained by a different hero_ it will instead grant bonus damage to their next hit equal to their level/3 at +1, or level/2 at +2. actors.hero.talent.liquid_agility.title=liquid agility -actors.hero.talent.liquid_agility.desc=_+1:_ When drinking or throwing a potion, brew, or elixir, the Duelist has _3x evasion_, and has _3x accuracy_ on her next melee weapon attack within 5 turns.\n\n_+2:_ When drinking or throwing a potion, brew, or elixir, the Duelist has _infinite evasion_, and has _infinite accuracy_ on her next melee weapon attack within 5 turns.\n\nThis bonus lasts for one additional turn and attack when using potions of strength, experience, or alchemy items that must be crafted using those potions.\n\nFor alchemy items with higher output quantities (e.g. aqua brew), this talent has a chance to trigger based on how many of that item is produced. +actors.hero.talent.liquid_agility.desc=_+1:_ When drinking or throwing a potion, brew, or elixir, the Duelist has _3x evasion_, and has _3x accuracy_ on her next melee attack within 5 turns.\n\n_+2:_ When drinking or throwing a potion, brew, or elixir, the Duelist has _infinite evasion_, and has _infinite accuracy_ on her next melee attack within 5 turns.\n\nThis bonus lasts for one additional turn and attack when using potions of strength, experience, or alchemy items that must be crafted using those potions.\n\nFor alchemy items with higher output quantities (e.g. aqua brew), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.weapon_recharging.title=weapon recharging actors.hero.talent.weapon_recharging.desc=_+1:_ The Duelist gains one weapon charge every _15 turns_ when under the effect of wand or artifact recharging buffs.\n\n_+2:_ The Duelist gains one weapon charge every _10 turns_ when under the effect of wand or artifact recharging buffs. actors.hero.talent.weapon_recharging.meta_desc=_If this talent is gained by a different hero_ it will instead cause them to deal +5% melee damage while recharging at +1, or +7.5% melee damage while recharging at +2. @@ -916,7 +916,7 @@ actors.hero.talent.swift_equip.desc=_+1:_ The Duelist can switch her equipped we actors.hero.talent.precise_assault.title=precise assault actors.hero.talent.precise_assault.desc=_+1:_ When the Duelist uses a weapon ability, she gains _2x accuracy_ on her next melee attack within 5 turns.\n\n_+2:_ When the Duelist uses a weapon ability, she gains _5x accuracy_ on her next melee attack within 5 turns.\n\n_+3:_ When the Duelist uses a weapon ability, she gains _infinite accuracy_ on her next melee attack within 5 turns. -actors.hero.talent.precise_assault.meta_desc=_If this talent is gained by a different hero_ it will instead increase overall accuracy by 10% at +1, 20% at +2, or 30% at +3. +actors.hero.talent.precise_assault.meta_desc=_If this talent is gained by a different hero_ it will instead increase melee accuracy by 10% at +1, 20% at +2, or 30% at +3. actors.hero.talent.deadly_followup.title=deadly followup actors.hero.talent.deadly_followup.desc=_+1:_ When the Duelist hits an enemy with a thrown weapon, she will deal _10% more melee damage_ to them for 5 turns.\n\n_+2:_ When the Duelist hits an enemy with a thrown weapon, she will deal _20% more melee damage_ to them for 5 turns.\n\n_+3:_ When the Duelist hits an enemy with a thrown weapon, she will deal _30% more melee damage_ to them for 5 turns. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index a1ae6e04f..ccef70b69 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -129,6 +129,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Quarterstaff; @@ -481,6 +482,43 @@ public class Hero extends Char { } else { accuracy *= 1.5f; } + //precise assault and liquid agility + } else { + if ((hasTalent(Talent.PRECISE_ASSAULT) || hasTalent(Talent.LIQUID_AGILITY)) + //does not trigger on ability attacks + && belongings.abilityWeapon != wep && buff(MonkEnergy.MonkAbility.UnarmedAbilityTracker.class) == null){ + + //non-duelist benefit for precise assault, can stack with liquid agility + if (heroClass != HeroClass.DUELIST) { + //persistent +10%/20%/30% ACC for other heroes + accuracy *= 1f + 0.1f * pointsInTalent(Talent.PRECISE_ASSAULT); + } + + if (wep instanceof Flail && buff(Flail.SpinAbilityTracker.class) != null){ + //do nothing, this is not a regular attack so don't consume talent fx + } else if (wep instanceof Crossbow && buff(Crossbow.ChargedShot.class) != null){ + //do nothing, this is not a regular attack so don't consume talent fx + } else if (buff(Talent.PreciseAssaultTracker.class) != null) { + // 2x/5x/inf. ACC for duelist if she just used a weapon ability + switch (pointsInTalent(Talent.PRECISE_ASSAULT)){ + default: case 1: + accuracy *= 2; break; + case 2: + accuracy *= 5; break; + case 3: + accuracy *= Float.POSITIVE_INFINITY; break; + } + buff(Talent.PreciseAssaultTracker.class).detach(); + } else if (buff(Talent.LiquidAgilACCTracker.class) != null){ + // 3x/inf. ACC, depending on talent level + accuracy *= pointsInTalent(Talent.LIQUID_AGILITY) == 2 ? Float.POSITIVE_INFINITY : 3f; + Talent.LiquidAgilACCTracker buff = buff(Talent.LiquidAgilACCTracker.class); + buff.uses--; + if (buff.uses <= 0) { + buff.detach(); + } + } + } } if (buff(Scimitar.SwordDance.class) != null){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 948526ee8..9fcdd15bd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -288,46 +288,6 @@ public class MeleeWeapon extends Weapon { return super.buffedLvl(); } - @Override - public float accuracyFactor(Char owner, Char target) { - float ACC = super.accuracyFactor(owner, target); - - if (owner instanceof Hero - && (((Hero) owner).hasTalent(Talent.PRECISE_ASSAULT) || ((Hero) owner).hasTalent(Talent.LIQUID_AGILITY)) - //does not trigger on ability attacks - && ((Hero) owner).belongings.abilityWeapon != this) { - if (((Hero) owner).heroClass != HeroClass.DUELIST) { - //persistent +10%/20%/30% ACC for other heroes - ACC *= 1f + 0.1f * ((Hero) owner).pointsInTalent(Talent.PRECISE_ASSAULT); - } else if (this instanceof Flail && owner.buff(Flail.SpinAbilityTracker.class) != null){ - //do nothing, this is not a regular attack so don't consume talent fx - } else if (this instanceof Crossbow && owner.buff(Crossbow.ChargedShot.class) != null){ - //do nothing, this is not a regular attack so don't consume talent fx - } else if (owner.buff(Talent.PreciseAssaultTracker.class) != null) { - // 2x/5x/inf. ACC for duelist if she just used a weapon ability - switch (((Hero) owner).pointsInTalent(Talent.PRECISE_ASSAULT)){ - default: case 1: - ACC *= 2; break; - case 2: - ACC *= 5; break; - case 3: - ACC *= Float.POSITIVE_INFINITY; break; - } - owner.buff(Talent.PreciseAssaultTracker.class).detach(); - } else if (owner.buff(Talent.LiquidAgilACCTracker.class) != null){ - //3x/inf. ACC, depending on talent level - ACC *= ((Hero) owner).pointsInTalent(Talent.LIQUID_AGILITY) == 2 ? Float.POSITIVE_INFINITY : 3f; - Talent.LiquidAgilACCTracker buff = owner.buff(Talent.LiquidAgilACCTracker.class); - buff.uses--; - if (buff.uses <= 0) { - buff.detach(); - } - } - } - - return ACC; - } - @Override public int damageRoll(Char owner) { int damage = augment.damageFactor(super.damageRoll( owner ));