From c49d4218106405f570d359fe67b1384e00bdcd37 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 27 Jul 2019 14:58:19 -0400 Subject: [PATCH] v0.7.4a: fixed prismatic images not working with brimstone and antimagic --- .../actors/mobs/npcs/PrismaticImage.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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 a83866e9a..080e8bea7 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 @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas; @@ -34,6 +35,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; 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.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.PrismaticSprite; @@ -182,6 +185,18 @@ public class PrismaticImage extends NPC { } } + @Override + public void damage(int dmg, Object src) { + + //TODO improve this when I have proper damage source logic + if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this) + && AntiMagic.RESISTS.contains(src.getClass())){ + dmg -= AntiMagic.drRoll(hero.belongings.armor.level()); + } + + super.damage(dmg, src); + } + @Override public float speed() { if (hero.belongings.armor != null){ @@ -212,6 +227,17 @@ public class PrismaticImage extends NPC { return s; } + @Override + public boolean isImmune(Class effect) { + if (effect == Burning.class + && hero != null + && hero.belongings.armor != null + && hero.belongings.armor.hasGlyph(Brimstone.class, this)){ + return true; + } + return super.isImmune(effect); + } + { immunities.add( ToxicGas.class ); immunities.add( CorrosiveGas.class );