From 047c9884a29d4d658a9b2292e965fa38ccfc7eb4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 12 May 2025 14:45:05 -0400 Subject: [PATCH] v3.1.0: fixed glyph of stone not accounting for various buffs/debuffs --- .../items/armor/glyphs/Stone.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java index 053019cc1..58c9a3e00 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java @@ -21,8 +21,17 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Daze; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.FerretTuft; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.watabou.utils.GameMath; @@ -34,10 +43,43 @@ public class Stone extends Armor.Glyph { public int proc(Armor armor, Char attacker, Char defender, int damage) { testing = true; - float evasion = defender.defenseSkill(attacker); float accuracy = attacker.attackSkill(defender); + float evasion = defender.defenseSkill(attacker); testing = false; + //FIXME this is duplicated here because these apply in hit(), not in attack/defenseskill + // the true solution is probably to refactor accuracy/evasion code a little bit + if (attacker.buff(Bless.class) != null) accuracy *= 1.25f; + if (attacker.buff( Hex.class) != null) accuracy *= 0.8f; + if (attacker.buff( Daze.class) != null) accuracy *= 0.5f; + for (ChampionEnemy buff : attacker.buffs(ChampionEnemy.class)){ + accuracy *= buff.evasionAndAccuracyFactor(); + } + accuracy *= AscensionChallenge.statModifier(attacker); + if (Dungeon.hero.heroClass != HeroClass.CLERIC + && Dungeon.hero.hasTalent(Talent.BLESS) + && attacker.alignment == Char.Alignment.ALLY){ + // + 3%/5% + accuracy *= 1.01f + 0.02f*Dungeon.hero.pointsInTalent(Talent.BLESS); + } + + if (defender.buff(Bless.class) != null) evasion *= 1.25f; + if (defender.buff( Hex.class) != null) evasion *= 0.8f; + if (defender.buff( Daze.class) != null) evasion *= 0.5f; + for (ChampionEnemy buff : defender.buffs(ChampionEnemy.class)){ + evasion *= buff.evasionAndAccuracyFactor(); + } + evasion *= AscensionChallenge.statModifier(defender); + if (Dungeon.hero.heroClass != HeroClass.CLERIC + && Dungeon.hero.hasTalent(Talent.BLESS) + && defender.alignment == Char.Alignment.ALLY){ + // + 3%/5% + evasion *= 1.01f + 0.02f*Dungeon.hero.pointsInTalent(Talent.BLESS); + } + evasion *= FerretTuft.evasionMultiplier(); + + // end of copy-pasta + evasion *= genericProcChanceMultiplier(defender); float hitChance;