diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 71335dc9..e34e86ac 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -946,7 +946,7 @@ public enum PowersManager { continue; // If something blocks the action, then stop - if (ab.blocked(target)) { + if (ab.blocked(target,pb.vampDrain)) { PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb); continue; } @@ -1121,7 +1121,7 @@ public enum PowersManager { continue; // If something blocks the action, then stop - if (ab.blocked(target)) + if (ab.blocked(target,pb.vampDrain)) continue; // TODO handle overwrite stack order here String stackType = ab.getStackType(); @@ -1435,7 +1435,7 @@ public enum PowersManager { if (trains < ab.getMinTrains() || trains > ab.getMaxTrains()) continue; // If something blocks the action, then stop - if (ab.blocked(target)) + if (ab.blocked(target,pb.vampDrain)) // sendPowerMsg(pc, 5, msg); continue; // TODO handle overwrite stack order here diff --git a/src/engine/powers/ActionsBase.java b/src/engine/powers/ActionsBase.java index 2a1c2c3f..44680b44 100644 --- a/src/engine/powers/ActionsBase.java +++ b/src/engine/powers/ActionsBase.java @@ -242,19 +242,32 @@ public class ActionsBase { } //Add blocked types here - public boolean blocked(AbstractWorldObject awo) { - //Check for immunities - if (AbstractCharacter.IsAbstractCharacter(awo)){ - AbstractCharacter pcTarget = (AbstractCharacter) awo; - PlayerBonuses tarBonus = pcTarget.getBonuses(); - SourceType source = SourceType.GetSourceType(this.stackType); - boolean immune = tarBonus.getBool(ModType.ImmuneTo, source); - if(!immune){ - mbEnums.DamageType damageType = mbEnums.DamageType.getDamageType(this.stackType); - immune = pcTarget.getResists().immuneTo(damageType); - } - if(immune){ - return true; + public boolean blocked(AbstractWorldObject awo, Boolean vampDrain) { + + if (AbstractWorldObject.IsAbstractCharacter(awo)) { + AbstractCharacter ac = (AbstractCharacter) awo; + PlayerBonuses bonus = ac.getBonuses(); + if (bonus == null) + return false; + + if(vampDrain) + return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN); + + switch (this.stackType) { + case "Stun": + return bonus.getBool(ModType.ImmuneTo, SourceType.Stun); + case "Snare": + return bonus.getBool(ModType.ImmuneTo, SourceType.Snare); + case "Blindness": + return bonus.getBool(ModType.ImmuneTo, SourceType.Blind); + case "PowerInhibitor": + return bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock); + case "Root": + return bonus.getBool(ModType.ImmuneTo, SourceType.Root); + case "Flight": + return bonus.getBool(ModType.NoMod, SourceType.Fly); + case "Track": + return bonus.getBool(ModType.CannotTrack, SourceType.None); } } return false;