forked from MagicBane/Server
immunitiy check compiled to single location
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user