From 17e5a1b97785c51444e120d25d9d1ca01d3e0437 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 1 Mar 2023 14:19:25 -0500 Subject: [PATCH] v2.0.0: fixed images benefiting from more acc/eva boosts than intended --- .../actors/mobs/npcs/MirrorImage.java | 13 +++++++++++-- .../actors/mobs/npcs/PrismaticImage.java | 13 ++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java index fa5fd04c7..b14ff7ee7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java @@ -33,6 +33,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite; @@ -113,16 +115,23 @@ public class MirrorImage extends NPC { @Override public int attackSkill( Char target ) { - return hero.attackSkill(target); + //same base attack skill as hero, benefits from accuracy ring and weapon + int attackSkill = 9 + hero.lvl; + attackSkill *= RingOfAccuracy.accuracyMultiplier(hero); + if (hero.belongings.attackingWeapon() != null){ + attackSkill *= hero.belongings.attackingWeapon().accuracyFactor(this, target); + } + return attackSkill; } @Override public int defenseSkill(Char enemy) { if (hero != null) { int baseEvasion = 4 + hero.lvl; - int heroEvasion = hero.defenseSkill(enemy); + int heroEvasion = (int)((4 + hero.lvl) * RingOfEvasion.evasionMultiplier( hero )); //if the hero has more/less evasion, 50% of it is applied + //includes ring of evasion boost return super.defenseSkill(enemy) * (baseEvasion + heroEvasion) / 2; } else { return 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java index 016c98a84..122ad332b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java @@ -37,6 +37,8 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.PrismaticSprite; @@ -155,7 +157,8 @@ public class PrismaticImage extends NPC { @Override public int attackSkill( Char target ) { if (hero != null) { - return hero.attackSkill(target); + //same base attack skill as hero, benefits from accuracy ring + return (int)((9 + hero.lvl) * RingOfAccuracy.accuracyMultiplier(hero)); } else { return 0; } @@ -165,9 +168,13 @@ public class PrismaticImage extends NPC { public int defenseSkill(Char enemy) { if (hero != null) { int baseEvasion = 4 + hero.lvl; - int heroEvasion = hero.defenseSkill(enemy); - + int heroEvasion = (int)((4 + hero.lvl) * RingOfEvasion.evasionMultiplier( hero )); + if (hero.belongings.armor() != null){ + heroEvasion = (int)hero.belongings.armor().evasionFactor(this, heroEvasion); + } + //if the hero has more/less evasion, 50% of it is applied + //includes ring of evasion and armor boosts return super.defenseSkill(enemy) * (baseEvasion + heroEvasion) / 2; } else { return 0;