diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java index e37179a16..23b6bfcb5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java @@ -21,9 +21,15 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import java.util.HashSet; + public class Buff extends Actor { public Char target; + + public static HashSet> resistances = new HashSet>(); + + public static HashSet> immunities = new HashSet>(); public boolean attachTo( Char target ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java index 64115bf67..d20c8aa11 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/EarthImbue.java @@ -26,10 +26,9 @@ public class EarthImbue extends FlavourBuff { return "Imbued with Earth"; } - public static final HashSet> IMMUNITIES = new HashSet>(); static { - IMMUNITIES.add( Paralysis.class ); - IMMUNITIES.add( Roots.class ); - IMMUNITIES.add( Slow.class ); + immunities.add( Paralysis.class ); + immunities.add( Roots.class ); + immunities.add( Slow.class ); } } \ No newline at end of file diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java index e698c74eb..e11fa0292 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FireImbue.java @@ -42,8 +42,7 @@ public class FireImbue extends Buff { return "Imbued with Fire"; } - public static final HashSet> IMMUNITIES = new HashSet>(); static { - IMMUNITIES.add( Burning.class ); + immunities.add( Burning.class ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java index 108157d03..eecb0bef2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java @@ -38,12 +38,11 @@ public class GasesImmunity extends FlavourBuff { public String toString() { return "Immune to gases"; } - - public static final HashSet> IMMUNITIES = new HashSet>(); + static { - IMMUNITIES.add( ParalyticGas.class ); - IMMUNITIES.add( ToxicGas.class ); - IMMUNITIES.add( ConfusionGas.class ); - IMMUNITIES.add( StenchGas.class ); + immunities.add( ParalyticGas.class ); + immunities.add( ToxicGas.class ); + immunities.add( ConfusionGas.class ); + immunities.add( StenchGas.class ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java index 461183ef1..69c642dcf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ToxicImbue.java @@ -32,9 +32,8 @@ public class ToxicImbue extends Buff { return "Imbued with Toxicity"; } - public static final HashSet> IMMUNITIES = new HashSet>(); static { - IMMUNITIES.add( ToxicGas.class ); - IMMUNITIES.add( Poison.class ); + immunities.add( ToxicGas.class ); + immunities.add( Poison.class ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index a3b05c5a0..239d2bd1c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -48,7 +48,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Fury; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; @@ -82,7 +81,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMappi import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -1437,8 +1435,12 @@ public class Hero extends Char { @Override public HashSet> immunities() { - GasesImmunity buff = buff( GasesImmunity.class ); - return buff == null ? super.immunities() : GasesImmunity.IMMUNITIES; + HashSet> immunities = new HashSet>(); + for (Buff buff : buffs()){ + for (Class immunity : buff.immunities) + immunities.add(immunity); + } + return immunities; } public static interface Doom {