v3.1.0: fixed glyph of stone not accounting for various buffs/debuffs

This commit is contained in:
Evan Debenham
2025-05-12 14:45:05 -04:00
parent ebee0a6014
commit 047c9884a2

View File

@@ -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;