Browse Source

blocked power type structuring

postwipe-hostile
FatBoy-DOTC 5 months ago
parent
commit
6c622c377f
  1. 10
      src/engine/mbEnums.java
  2. 4
      src/engine/objects/Resists.java
  3. 34
      src/engine/powers/ActionsBase.java

10
src/engine/mbEnums.java

@ -831,16 +831,22 @@ public class mbEnums {
SPIRES, SPIRES,
SNARE, SNARE,
STUN, STUN,
BLIND, BLINDNESS,
ROOT, ROOT,
FEAR, FEAR,
CHARM, CHARM,
POWERBLOCK, POWERINHIBITOR,
DEBUFF, DEBUFF,
STEAL, STEAL,
DRAIN; DRAIN;
public static DamageType getDamageType(String modName) { public static DamageType getDamageType(String modName) {
if(modName.toLowerCase().equals("blind"))
modName = "BLINDNESS";
if(modName.toLowerCase().equals("powerblock"))
modName = "POWERINHIBITOR";
DamageType damageType; DamageType damageType;
if (modName.isEmpty()) if (modName.isEmpty())
return DamageType.NONE; return DamageType.NONE;

4
src/engine/objects/Resists.java

@ -349,13 +349,13 @@ public class Resists {
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun)) if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
this.immuneTo.put(mbEnums.DamageType.STUN, true); this.immuneTo.put(mbEnums.DamageType.STUN, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind)) if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
this.immuneTo.put(mbEnums.DamageType.BLIND, true); this.immuneTo.put(mbEnums.DamageType.BLINDNESS, true);
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None)) if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
this.immuneTo.put(mbEnums.DamageType.ATTACK, true); this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None)) if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
this.immuneTo.put(mbEnums.DamageType.POWERS, true); this.immuneTo.put(mbEnums.DamageType.POWERS, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock)) if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
this.immuneTo.put(mbEnums.DamageType.POWERBLOCK, true); this.immuneTo.put(mbEnums.DamageType.POWERINHIBITOR, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff)) if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true); this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear)) if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))

34
src/engine/powers/ActionsBase.java

@ -242,32 +242,22 @@ public class ActionsBase {
} }
//Add blocked types here //Add blocked types here
public boolean blocked(AbstractWorldObject awo, Boolean vampDrain) { public boolean blocked(AbstractWorldObject awo, boolean vampDrain) {
//Check for immunities
if (AbstractWorldObject.IsAbstractCharacter(awo)) { if (AbstractCharacter.IsAbstractCharacter(awo)){
AbstractCharacter ac = (AbstractCharacter) awo; AbstractCharacter pcTarget = (AbstractCharacter) awo;
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = pcTarget.getBonuses();
if (bonus == null)
return false;
if(vampDrain) if(vampDrain)
return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN); return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
switch (this.stackType) { if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly)) {
case "Stun": return true;
return bonus.getBool(ModType.ImmuneTo, SourceType.Stun); }else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None)) {
case "Snare": return true;
return bonus.getBool(ModType.ImmuneTo, SourceType.Snare); }else {
case "Blindness": mbEnums.DamageType damageType = mbEnums.DamageType.getDamageType(this.stackType.toUpperCase());
return bonus.getBool(ModType.ImmuneTo, SourceType.Blind); return pcTarget.getResists().immuneTo(damageType);
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