immunitiy check compiled to single location

This commit is contained in:
2024-06-26 20:37:28 -05:00
parent 2a3ae6eaec
commit a42f307a70
2 changed files with 18 additions and 48 deletions
+3 -19
View File
@@ -946,27 +946,11 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains)) {
if (ab.blocked(target)) {
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
continue;
}
//Check for immunities
if (target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target;
PlayerBonuses tarBonus = pcTarget.getBonuses();
SourceType source = SourceType.GetSourceType(ab.stackType);
boolean immune = tarBonus.getBool(ModType.ImmuneTo, source);
if(!immune){
DamageType damageType = DamageType.getDamageType(ab.stackType);
immune = pcTarget.getResists().immuneTo(damageType);
}
if(immune){
continue;
}
}
// TODO handle overwrite stack order here
String stackType = ab.getStackType();
stackType = (stackType.equals("IgnoreStack")) ? Integer.toString(ab.getUUID()) : stackType;
@@ -1137,7 +1121,7 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains))
if (ab.blocked(target))
continue;
// TODO handle overwrite stack order here
String stackType = ab.getStackType();
@@ -1451,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, pb, trains))
if (ab.blocked(target))
// sendPowerMsg(pc, 5, msg);
continue;
// TODO handle overwrite stack order here