v0.8.1: fixed stone not clamping negative accuracy or evasion

This commit is contained in:
Evan Debenham 2020-06-03 15:42:54 -04:00
parent 82dbe0f7bc
commit a06edcca4d

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.GameMath;
public class Stone extends Armor.Glyph { public class Stone extends Armor.Glyph {
@ -45,7 +46,8 @@ public class Stone extends Armor.Glyph {
} }
//75% of dodge chance is applied as damage reduction //75% of dodge chance is applied as damage reduction
hitChance = (1f + 3f*hitChance)/4f; // we clamp in case accuracy or evasion were negative
hitChance = GameMath.gate(0.25f, (1f + 3f*hitChance)/4f, 1f);
damage = (int)Math.ceil(damage * hitChance); damage = (int)Math.ceil(damage * hitChance);