- Added the option "RemoveAllAbilities" to continuous static abilities which will remove triggers and activated abilities (keywords and static abilities coming soon).

- Fixed Pithing Needle affecting mana abilities.
This commit is contained in:
Sloth
2011-09-09 16:18:25 +00:00
parent 1c16386490
commit b4c734b49d
5 changed files with 39 additions and 4 deletions

View File

@@ -139,6 +139,14 @@ public class StaticEffects {
} }
} }
//remove abilities
if (params.containsKey("RemoveAllAbilities")) {
SpellAbility[] spellAbility = affectedCard.getSpellAbility();
for (SpellAbility s : spellAbility) {
s.setTemporarilySuppressed(false);
}
}
//remove Types //remove Types
if (params.containsKey("AddType") || params.containsKey("RemoveType")) { if (params.containsKey("AddType") || params.containsKey("RemoveType")) {
affectedCard.removeChangedCardTypes(se.getTimestamp()); affectedCard.removeChangedCardTypes(se.getTimestamp());

View File

@@ -46,9 +46,13 @@ abstract public class Ability_Activated extends SpellAbility implements java.io.
if (AllZone.getStack().isSplitSecondOnStack()) return false; if (AllZone.getStack().isSplitSecondOnStack()) return false;
final Card c = getSourceCard(); final Card c = getSourceCard();
if (c.isFaceDown() && isIntrinsic()) // Intrinsic abilities can't be activated by face down cards if (c.isFaceDown() && isIntrinsic()) { // Intrinsic abilities can't be activated by face down cards
return false; return false;
if (c.hasKeyword("CARDNAME's activated abilities can't be activated.")) return false; }
if (c.hasKeyword("CARDNAME's activated abilities can't be activated.") || isSuppressed()) {
return false;
}
CardList pithing = AllZoneUtil.getPlayerCardsInPlay(AllZone.getHumanPlayer()); CardList pithing = AllZoneUtil.getPlayerCardsInPlay(AllZone.getHumanPlayer());
pithing.addAll(AllZoneUtil.getPlayerCardsInPlay(AllZone.getComputerPlayer())); pithing.addAll(AllZoneUtil.getPlayerCardsInPlay(AllZone.getComputerPlayer()));
@@ -59,7 +63,7 @@ abstract public class Ability_Activated extends SpellAbility implements java.io.
} }
}); });
if (pithing.size() != 0) return false; if (pithing.size() != 0 && !(this instanceof Ability_Mana)) return false;
if (!(getRestrictions().canPlay(c, this))) if (!(getRestrictions().canPlay(c, this)))
return false; return false;

View File

@@ -48,6 +48,7 @@ public abstract class SpellAbility {
private boolean trigger = false; private boolean trigger = false;
private int sourceTrigger = -1; private int sourceTrigger = -1;
private boolean mandatory = false; private boolean mandatory = false;
private boolean temporarilySuppressed = false;
private boolean tapAbility; private boolean tapAbility;
private boolean untapAbility; private boolean untapAbility;
@@ -865,6 +866,11 @@ public abstract class SpellAbility {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
if(isSuppressed()) {
return "";
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
SpellAbility node = this; SpellAbility node = this;
@@ -1216,4 +1222,12 @@ public abstract class SpellAbility {
return false; return false;
} }
public void setTemporarilySuppressed(boolean supp) {
temporarilySuppressed = supp;
}
public boolean isSuppressed() {
return (temporarilySuppressed);
}
} }

View File

@@ -82,7 +82,8 @@ public class StaticAbility {
return 5; return 5;
if(mapParams.containsKey("AddKeyword") || mapParams.containsKey("AddAbility") if(mapParams.containsKey("AddKeyword") || mapParams.containsKey("AddAbility")
|| mapParams.containsKey("AddTrigger") || mapParams.containsKey("RemoveTriggers")) || mapParams.containsKey("AddTrigger") || mapParams.containsKey("RemoveTriggers")
|| mapParams.containsKey("RemoveAllAbilities"))
return 6; return 6;
if(mapParams.containsKey("CharacteristicDefining")) if(mapParams.containsKey("CharacteristicDefining"))

View File

@@ -249,6 +249,14 @@ public class StaticAbility_Continuous {
trigger.setTemporarilySuppressed(true); trigger.setTemporarilySuppressed(true);
} }
} }
// remove activated abilities
if (params.containsKey("RemoveAllAbilities")) {
ArrayList<SpellAbility> abilities = affectedCard.getSpellAbilities();
for (SpellAbility ab : abilities) {
ab.setTemporarilySuppressed(true);
}
}
//affectedCard.updateObservers(); //affectedCard.updateObservers();
} }
} }