Browse Source

blocked power type structuring

postwipe-hostile
FatBoy-DOTC 5 months ago
parent
commit
8943121336
  1. 6
      src/engine/gameManager/PowersManager.java
  2. 39
      src/engine/powers/ActionsBase.java

6
src/engine/gameManager/PowersManager.java

@ -946,7 +946,7 @@ public enum PowersManager {
continue; continue;
// If something blocks the action, then stop // If something blocks the action, then stop
if (ab.blocked(target)) { if (ab.blocked(target,pb.vampDrain)) {
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb); PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
continue; continue;
} }
@ -1121,7 +1121,7 @@ public enum PowersManager {
continue; continue;
// If something blocks the action, then stop // If something blocks the action, then stop
if (ab.blocked(target)) if (ab.blocked(target,pb.vampDrain))
continue; continue;
// TODO handle overwrite stack order here // TODO handle overwrite stack order here
String stackType = ab.getStackType(); String stackType = ab.getStackType();
@ -1435,7 +1435,7 @@ public enum PowersManager {
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains()) if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
continue; continue;
// If something blocks the action, then stop // If something blocks the action, then stop
if (ab.blocked(target)) if (ab.blocked(target,pb.vampDrain))
// sendPowerMsg(pc, 5, msg); // sendPowerMsg(pc, 5, msg);
continue; continue;
// TODO handle overwrite stack order here // TODO handle overwrite stack order here

39
src/engine/powers/ActionsBase.java

@ -242,19 +242,32 @@ public class ActionsBase {
} }
//Add blocked types here //Add blocked types here
public boolean blocked(AbstractWorldObject awo) { public boolean blocked(AbstractWorldObject awo, Boolean vampDrain) {
//Check for immunities
if (AbstractCharacter.IsAbstractCharacter(awo)){ if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter pcTarget = (AbstractCharacter) awo; AbstractCharacter ac = (AbstractCharacter) awo;
PlayerBonuses tarBonus = pcTarget.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
SourceType source = SourceType.GetSourceType(this.stackType); if (bonus == null)
boolean immune = tarBonus.getBool(ModType.ImmuneTo, source); return false;
if(!immune){
mbEnums.DamageType damageType = mbEnums.DamageType.getDamageType(this.stackType); if(vampDrain)
immune = pcTarget.getResists().immuneTo(damageType); return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
}
if(immune){ switch (this.stackType) {
return true; 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; return false;

Loading…
Cancel
Save