blocked power type structuring

This commit is contained in:
2024-06-27 19:54:29 -05:00
parent 70cb469190
commit 8943121336
2 changed files with 29 additions and 16 deletions
+26 -13
View File
@@ -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;