v0.7.4a: fixed prismatic images not working with brimstone and antimagic

This commit is contained in:
Evan Debenham 2019-07-27 14:58:19 -04:00
parent 4ec872971f
commit c49d421810

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas; 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.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; 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.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.PrismaticSprite; 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 @Override
public float speed() { public float speed() {
if (hero.belongings.armor != null){ if (hero.belongings.armor != null){
@ -212,6 +227,17 @@ public class PrismaticImage extends NPC {
return s; 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( ToxicGas.class );
immunities.add( CorrosiveGas.class ); immunities.add( CorrosiveGas.class );