v3.2.2: fixed stone glyph occasionally resulting in dodges

This commit is contained in:
Evan Debenham
2025-08-25 11:36:39 -04:00
parent 31ddefce35
commit df56fa1a25
2 changed files with 12 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
@@ -591,6 +592,11 @@ public class Hero extends Char {
if (belongings.armor() != null) { if (belongings.armor() != null) {
evasion = belongings.armor().evasionFactor(this, evasion); evasion = belongings.armor().evasionFactor(this, evasion);
//stone specifically overrides to 0 always, guaranteed hit
if (belongings.armor().hasGlyph(Stone.class, this) && !Stone.testingEvasion()){
return 0;
}
} }
return Math.max(1, Math.round(evasion)); return Math.max(1, Math.round(evasion));

View File

@@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.PrismaticImage; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.PrismaticImage;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stone;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion;
@@ -343,6 +344,11 @@ public class FloatingText extends RenderedTextBlock {
if (defender instanceof ArmoredStatue) arm = ((ArmoredStatue)defender).armor(); if (defender instanceof ArmoredStatue) arm = ((ArmoredStatue)defender).armor();
if (defender instanceof DriedRose.GhostHero) arm = ((DriedRose.GhostHero)defender).armor(); if (defender instanceof DriedRose.GhostHero) arm = ((DriedRose.GhostHero)defender).armor();
//one last check
if (defRoll == 0 && arm != null && arm.hasGlyph(Stone.class, defender)){
return HIT_ARM;
}
//accuracy boosts (always > 1) //accuracy boosts (always > 1)
if (wep != null && wep.accuracyFactor(attacker, defender) > 1){ if (wep != null && wep.accuracyFactor(attacker, defender) > 1){
hitReasons.put( HIT_WEP, wep.accuracyFactor(attacker, defender)); hitReasons.put( HIT_WEP, wep.accuracyFactor(attacker, defender));