mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Large Commit: Passing in SpellAbilities into isValid/hasProperty to fix Harness the Storm not being possible otherwise.
Fixes a bunch of javadoc errors
This commit is contained in:
@@ -132,7 +132,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
|
||||
public static boolean matchesValid(final Object o, final String[] valids, final Card srcCard) {
|
||||
if (o instanceof GameEntity) {
|
||||
final GameEntity c = (GameEntity) o;
|
||||
return c.isValid(valids, srcCard.getController(), srcCard);
|
||||
return c.isValid(valids, srcCard.getController(), srcCard, null);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -240,7 +240,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
|
||||
}
|
||||
}
|
||||
|
||||
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard());
|
||||
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard(), null);
|
||||
|
||||
int right = 1;
|
||||
final String rightString = presentCompare.substring(2);
|
||||
@@ -281,7 +281,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView {
|
||||
}
|
||||
}
|
||||
|
||||
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard());
|
||||
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard(), null);
|
||||
|
||||
int right = 1;
|
||||
final String rightString = presentCompare.substring(2);
|
||||
|
||||
@@ -19,11 +19,12 @@ public abstract class GameObject {
|
||||
* the source controller
|
||||
* @param source
|
||||
* the source
|
||||
* @param spellAbility
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid(final String[] restrictions, final Player sourceController, final Card source) {
|
||||
public boolean isValid(final String[] restrictions, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
for (final String restriction : restrictions) {
|
||||
if (this.isValid(restriction, sourceController, source)) {
|
||||
if (this.isValid(restriction, sourceController, source, spellAbility)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -39,9 +40,10 @@ public abstract class GameObject {
|
||||
* the source controller
|
||||
* @param source
|
||||
* the source
|
||||
* @param spellAbility
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid(final String restriction, final Player sourceController, final Card source) {
|
||||
public boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,9 +56,10 @@ public abstract class GameObject {
|
||||
* the source controller
|
||||
* @param source
|
||||
* the source
|
||||
* @param spellAbility
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -274,17 +274,17 @@ public class AbilityUtils {
|
||||
}
|
||||
else if (defined.startsWith("Valid ")) {
|
||||
String validDefined = defined.substring("Valid ".length());
|
||||
list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), validDefined.split(","), hostCard.getController(), hostCard);
|
||||
list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), validDefined.split(","), hostCard.getController(), hostCard, sa);
|
||||
}
|
||||
else if (defined.startsWith("ValidAll ")) {
|
||||
String validDefined = defined.substring("ValidAll ".length());
|
||||
list = CardLists.getValidCards(game.getCardsInGame(), validDefined.split(","), hostCard.getController(), hostCard);
|
||||
list = CardLists.getValidCards(game.getCardsInGame(), validDefined.split(","), hostCard.getController(), hostCard, sa);
|
||||
}
|
||||
else if (defined.startsWith("Valid")) {
|
||||
String[] s = defined.split(" ");
|
||||
String zone = s[0].substring("Valid".length());
|
||||
String validDefined = s[1];
|
||||
list = CardLists.getValidCards(game.getCardsIn(ZoneType.smartValueOf(zone)), validDefined.split(","), hostCard.getController(), hostCard);
|
||||
list = CardLists.getValidCards(game.getCardsIn(ZoneType.smartValueOf(zone)), validDefined.split(","), hostCard.getController(), hostCard, sa);
|
||||
}
|
||||
else {
|
||||
return cards;
|
||||
@@ -432,7 +432,7 @@ public class AbilityUtils {
|
||||
else if (hType.startsWith("Property") && ability instanceof SpellAbility) {
|
||||
String defined = hType.split("Property")[1];
|
||||
for (Player p : game.getPlayersInTurnOrder()) {
|
||||
if (p.hasProperty(defined, ((SpellAbility)ability).getActivatingPlayer(), ability.getHostCard())) {
|
||||
if (p.hasProperty(defined, ((SpellAbility)ability).getActivatingPlayer(), ability.getHostCard(), (SpellAbility)ability)) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
@@ -785,7 +785,7 @@ public class AbilityUtils {
|
||||
String var = sa.getParam("AbilityCount");
|
||||
valid = valid.replace(var, Integer.toString(calculateAmount(source, var, sa)));
|
||||
}
|
||||
return CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), source);
|
||||
return CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), source, sa);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1106,7 +1106,7 @@ public class AbilityUtils {
|
||||
}
|
||||
else {
|
||||
for (Player p : game.getPlayersInTurnOrder()) {
|
||||
if (p.isValid(defined, sa.getActivatingPlayer(), sa.getHostCard())) {
|
||||
if (p.isValid(defined, sa.getActivatingPlayer(), sa.getHostCard(), null)) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
|
||||
}
|
||||
|
||||
list = CardLists.getValidCards(list, valid.split(","), host.getController(), host);
|
||||
list = CardLists.getValidCards(list, valid.split(","), host.getController(), host, sa);
|
||||
|
||||
for (final Card c : list) {
|
||||
doAnimate(c, sa, power, toughness, types, removeTypes, finalDesc,
|
||||
|
||||
@@ -84,8 +84,6 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
* the card
|
||||
* @param o
|
||||
* the o
|
||||
* @param af
|
||||
* the af
|
||||
*/
|
||||
public static void handleAttachment(final Card card, final Object o, final SpellAbility sa) {
|
||||
|
||||
@@ -126,8 +124,6 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
* the card
|
||||
* @param tgt
|
||||
* the tgt
|
||||
* @param gainControl
|
||||
* the gain control
|
||||
*/
|
||||
public static void handleAura(final Card card, final GameEntity tgt) {
|
||||
if (card.isEnchanting()) {
|
||||
@@ -196,7 +192,7 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
final FCollection<Player> players = new FCollection<Player>();
|
||||
|
||||
for (Player player : game.getPlayers()) {
|
||||
if (player.isValid(tgt.getValidTgts(), aura.getActivatingPlayer(), source)) {
|
||||
if (player.isValid(tgt.getValidTgts(), aura.getActivatingPlayer(), source, null)) {
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
@@ -208,7 +204,7 @@ public class AttachEffect extends SpellAbilityEffect {
|
||||
}
|
||||
else {
|
||||
CardCollectionView list = game.getCardsIn(tgt.getZone());
|
||||
list = CardLists.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source);
|
||||
list = CardLists.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source, aura);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,10 +112,10 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
if (null != newTarget) {
|
||||
if (sa.hasParam("TargetRestriction")) {
|
||||
if (newTarget.getFirstTargetedCard() != null && newTarget.getFirstTargetedCard().
|
||||
isValid(sa.getParam("TargetRestriction").split(","), activator, sa.getHostCard())) {
|
||||
isValid(sa.getParam("TargetRestriction").split(","), activator, sa.getHostCard(), sa)) {
|
||||
changingTgtSI.updateTarget(newTarget);
|
||||
} else if (newTarget.getFirstTargetedPlayer() != null && newTarget.getFirstTargetedPlayer().
|
||||
isValid(sa.getParam("TargetRestriction").split(","), activator, sa.getHostCard())) {
|
||||
isValid(sa.getParam("TargetRestriction").split(","), activator, sa.getHostCard(), sa)) {
|
||||
changingTgtSI.updateTarget(newTarget);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
|
||||
final PaperCard cp = Aggregates.random(copysource);
|
||||
Card possibleCard = Card.fromPaperCard(cp, sa.getActivatingPlayer()); // Need to temporarily set the Owner so the Game is set
|
||||
|
||||
if (possibleCard.isValid(valid, hostCard.getController(), hostCard)) {
|
||||
if (possibleCard.isValid(valid, hostCard.getController(), hostCard, sa)) {
|
||||
choice.add(possibleCard);
|
||||
copysource.remove(cp);
|
||||
ncopied -= 1;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
if (sa.hasParam("AllValid")) {
|
||||
if (!spell.getHostCard().isValid(sa.getParam("AllValid"), sa.getActivatingPlayer(), sa.getHostCard())) {
|
||||
if (!spell.getHostCard().isValid(sa.getParam("AllValid"), sa.getActivatingPlayer(), sa.getHostCard(), sa)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
if (sa.hasParam("AllValid")) {
|
||||
if (!spell.getHostCard().isValid(sa.getParam("AllValid"), sa.getActivatingPlayer(), sa.getHostCard())) {
|
||||
if (!spell.getHostCard().isValid(sa.getParam("AllValid"), sa.getActivatingPlayer(), sa.getHostCard(), sa)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,6 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
* @param si
|
||||
* a {@link forge.game.spellability.SpellAbilityStackInstance}
|
||||
* object.
|
||||
* @param sa
|
||||
*/
|
||||
private static void removeFromStack(final SpellAbility tgtSA,
|
||||
final SpellAbility srcSA, final SpellAbilityStackInstance si) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DamagePreventAllEffect extends SpellAbilityEffect {
|
||||
|
||||
if (!players.equals("")) {
|
||||
for (final Player p : game.getPlayers()) {
|
||||
if (p.isValid(players, source.getController(), source)) {
|
||||
if (p.isValid(players, source.getController(), source, sa)) {
|
||||
p.addPreventNextDamage(numDam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +182,9 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
if (changeValid.contains("ChosenType")) {
|
||||
changeValid = changeValid.replace("ChosenType", host.getChosenType());
|
||||
}
|
||||
valid = CardLists.getValidCards(top, changeValid.split(","), host.getController(), host);
|
||||
valid = CardLists.getValidCards(top, changeValid.split(","), host.getController(), host, sa);
|
||||
if (!andOrValid.equals("")) {
|
||||
andOrCards = CardLists.getValidCards(top, andOrValid.split(","), host.getController(), host);
|
||||
andOrCards = CardLists.getValidCards(top, andOrValid.split(","), host.getController(), host, sa);
|
||||
andOrCards.removeAll((Collection<?>)valid);
|
||||
valid.addAll(andOrCards);
|
||||
}
|
||||
@@ -275,10 +275,10 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
valid.remove(chosen);
|
||||
if (!andOrValid.equals("")) {
|
||||
andOrCards.remove(chosen);
|
||||
if (!chosen.isValid(andOrValid.split(","), host.getController(), host)) {
|
||||
if (!chosen.isValid(andOrValid.split(","), host.getController(), host, sa)) {
|
||||
valid = new CardCollection(andOrCards);
|
||||
}
|
||||
else if (!chosen.isValid(changeValid.split(","), host.getController(), host)) {
|
||||
else if (!chosen.isValid(changeValid.split(","), host.getController(), host, sa)) {
|
||||
valid.removeAll((Collection<?>)andOrCards);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
|
||||
for (int i = 0; i < maxToDig; i++) {
|
||||
final Card c = library.get(i);
|
||||
revealed.add(c);
|
||||
if (c.isValid(type, sa.getActivatingPlayer(), host)) {
|
||||
if (c.isValid(type, sa.getActivatingPlayer(), host, sa)) {
|
||||
found.add(c);
|
||||
if (remember) {
|
||||
host.addRemembered(c);
|
||||
|
||||
@@ -210,7 +210,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
valid = valid.replace("X", Integer.toString(AbilityUtils.calculateAmount(source, "X", sa)));
|
||||
}
|
||||
|
||||
List<Card> dPChHand = CardLists.getValidCards(dPHand, valid.split(","), source.getController(), source);
|
||||
List<Card> dPChHand = CardLists.getValidCards(dPHand, valid.split(","), source.getController(), source, sa);
|
||||
dPChHand = CardLists.filter(dPChHand, Presets.NON_TOKEN);
|
||||
// Reveal cards that will be discarded?
|
||||
for (final Card c : dPChHand) {
|
||||
@@ -230,7 +230,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
}
|
||||
final String valid = sa.hasParam("DiscardValid") ? sa.getParam("DiscardValid") : "Card";
|
||||
String[] dValid = valid.split(",");
|
||||
CardCollection validCards = CardLists.getValidCards(dPHand, dValid, source.getController(), source);
|
||||
CardCollection validCards = CardLists.getValidCards(dPHand, dValid, source.getController(), source, sa);
|
||||
|
||||
Player chooser = p;
|
||||
if (mode.equals("RevealYouChoose")) {
|
||||
@@ -267,6 +267,5 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
source.addRemembered(c);
|
||||
}
|
||||
}
|
||||
|
||||
} // discardResolve()
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
// Need to temporarily set the Owner so the Game is set
|
||||
possibleCard.setOwner(sa.getActivatingPlayer());
|
||||
|
||||
if (possibleCard.isValid(valid, source.getController(), source)) {
|
||||
if (possibleCard.isValid(valid, source.getController(), source, sa)) {
|
||||
choice.add(possibleCard);
|
||||
copysource.remove(cp);
|
||||
ncopied -= 1;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RegenerateAllEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
|
||||
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard, sa);
|
||||
|
||||
for (final Card c : list) {
|
||||
final GameCommand untilEOT = new GameCommand() {
|
||||
|
||||
@@ -59,10 +59,8 @@ public class RepeatEffect extends SpellAbilityEffect {
|
||||
* <p>
|
||||
* checkRepeatConditions.
|
||||
* </p>
|
||||
*
|
||||
* @param AF
|
||||
* a {@link forge.game.ability.AbilityFactory} object.
|
||||
* @param SA
|
||||
*
|
||||
* @param sa
|
||||
* a {@link forge.game.spellability.SpellAbility} object.
|
||||
*/
|
||||
private static boolean checkRepeatConditions(final SpellAbility sa) {
|
||||
@@ -85,7 +83,7 @@ public class RepeatEffect extends SpellAbilityEffect {
|
||||
else {
|
||||
list = game.getCardsIn(ZoneType.Battlefield);
|
||||
}
|
||||
list = CardLists.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getHostCard());
|
||||
list = CardLists.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
|
||||
int right;
|
||||
final String rightString = repeatCompare.substring(2);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RestartGameEffect extends SpellAbilityEffect {
|
||||
List<Card> filteredCards = null;
|
||||
if (leaveZone != null) {
|
||||
filteredCards = CardLists.filter(p.getCardsIn(leaveZone),
|
||||
CardPredicates.restriction(leaveRestriction.split(","), p, sa.getHostCard()));
|
||||
CardPredicates.restriction(leaveRestriction.split(","), p, sa.getHostCard(), null));
|
||||
newLibrary.addAll(filteredCards);
|
||||
}
|
||||
playerLibraries.put(p, newLibrary);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class UnattachAllEffect extends SpellAbilityEffect {
|
||||
|
||||
String valid = sa.getParam("UnattachValid");
|
||||
CardCollectionView unattachList = game.getCardsIn(ZoneType.Battlefield);
|
||||
unattachList = CardLists.getValidCards(unattachList, valid.split(","), source.getController(), source);
|
||||
unattachList = CardLists.getValidCards(unattachList, valid.split(","), source.getController(), source, sa);
|
||||
for (final Card c : unattachList) {
|
||||
handleUnattachment((GameEntity) o, c);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UntapAllEffect extends SpellAbilityEffect {
|
||||
}
|
||||
list = list2;
|
||||
}
|
||||
list = CardLists.getValidCards(list, valid.split(","), card.getController(), card);
|
||||
list = CardLists.getValidCards(list, valid.split(","), card.getController(), card, sa);
|
||||
|
||||
boolean remember = sa.hasParam("RememberUntapped");
|
||||
for (Card c : list) {
|
||||
|
||||
@@ -2328,7 +2328,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String parse = getKeywords().get(keywordPosition);
|
||||
final String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (c.isValid(restrictions, getController(), this)) {
|
||||
if (c.isValid(restrictions, getController(), this, null)) {
|
||||
getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, "Trying to equip " + c.getName() + " but it can't be equipped.");
|
||||
return;
|
||||
}
|
||||
@@ -3570,7 +3570,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
// Takes one argument like Permanent.Blue+withFlying
|
||||
@Override
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source) {
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
if (isImmutable() && !source.isRemembered(this)) { // special case exclusion
|
||||
return false;
|
||||
}
|
||||
@@ -3599,7 +3599,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String excR = incR[1];
|
||||
final String[] exRs = excR.split("\\+"); // Exclusive Restrictions are ...
|
||||
for (String exR : exRs) {
|
||||
if (!hasProperty(exR, sourceController, source)) {
|
||||
if (!hasProperty(exR, sourceController, source, spellAbility)) {
|
||||
return testFailed;
|
||||
}
|
||||
}
|
||||
@@ -3609,7 +3609,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
// Takes arguments like Blue or withFlying
|
||||
@Override
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
final Game game = getGame();
|
||||
final Combat combat = game.getCombat();
|
||||
final Card lki = getGame().getChangeZoneLKIInfo(this);
|
||||
@@ -3850,12 +3850,12 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
} else if (property.startsWith("OwnedBy")) {
|
||||
final String valid = property.substring(8);
|
||||
if (!getOwner().isValid(valid, sourceController, source)) {
|
||||
if (!getOwner().isValid(valid, sourceController, source, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("ControlledBy")) {
|
||||
final String valid = property.substring(13);
|
||||
if (!controller.isValid(valid, sourceController, source)) {
|
||||
if (!controller.isValid(valid, sourceController, source, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("OwnerDoesntControl")) {
|
||||
@@ -3918,9 +3918,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ((enchanting == null || !enchanting.isValid(restriction, sourceController, source))
|
||||
&& (equipping == null || !equipping.isValid(restriction, sourceController, source))
|
||||
&& (fortifying == null || !fortifying.isValid(restriction, sourceController, source))) {
|
||||
if ((enchanting == null || !enchanting.isValid(restriction, sourceController, source, spellAbility))
|
||||
&& (equipping == null || !equipping.isValid(restriction, sourceController, source, spellAbility))
|
||||
&& (fortifying == null || !fortifying.isValid(restriction, sourceController, source, spellAbility))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3967,7 +3967,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
break;
|
||||
default: // EnchantedBy Aura.Other
|
||||
for (final Card aura : getEnchantedBy(false)) {
|
||||
if (aura.isValid(restriction, sourceController, source)) {
|
||||
if (aura.isValid(restriction, sourceController, source, spellAbility)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4227,7 +4227,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
break;
|
||||
default:
|
||||
for (final Card card : sourceController.getCardsIn(ZoneType.Battlefield)) {
|
||||
if (card.isValid(restriction, sourceController, source) && sharesColorWith(card)) {
|
||||
if (card.isValid(restriction, sourceController, source, spellAbility) && sharesColorWith(card)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4254,7 +4254,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else {
|
||||
final String restriction = property.split("notSharesColorWith ")[1];
|
||||
for (final Card card : sourceController.getCardsIn(ZoneType.Battlefield)) {
|
||||
if (card.isValid(restriction, sourceController, source) && sharesColorWith(card)) {
|
||||
if (card.isValid(restriction, sourceController, source, spellAbility) && sharesColorWith(card)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4315,7 +4315,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
default:
|
||||
boolean shares = false;
|
||||
for (final Card card : sourceController.getCardsIn(ZoneType.Battlefield)) {
|
||||
if (card.isValid(restriction, sourceController, source) && sharesCreatureTypeWith(card)) {
|
||||
if (card.isValid(restriction, sourceController, source, spellAbility) && sharesCreatureTypeWith(card)) {
|
||||
shares = true;
|
||||
}
|
||||
}
|
||||
@@ -4449,6 +4449,16 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (restriction.equals("TriggeredCard")) {
|
||||
if (spellAbility == null) {
|
||||
System.out.println("Looking at TriggeredCard but no SA?");
|
||||
} else {
|
||||
Card triggeredCard = ((Card)spellAbility.getTriggeringObject("Card"));
|
||||
if (triggeredCard != null && getName().equals(triggeredCard.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("doesNotShareNameWith")) {
|
||||
@@ -4546,7 +4556,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
Player p = null;
|
||||
if (res.length > 1) {
|
||||
for (Player pl : game.getPlayers()) {
|
||||
if (pl.isValid(res[1], sourceController, source)) {
|
||||
if (pl.isValid(res[1], sourceController, source, spellAbility)) {
|
||||
p = pl;
|
||||
break;
|
||||
}
|
||||
@@ -5558,11 +5568,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
continue;
|
||||
}
|
||||
if (params.containsKey("ValidSource")
|
||||
&& !source.isValid(params.get("ValidSource"), ca.getController(), ca)) {
|
||||
&& !source.isValid(params.get("ValidSource"), ca.getController(), ca, null)) {
|
||||
continue;
|
||||
}
|
||||
if (params.containsKey("ValidTarget")
|
||||
&& !isValid(params.get("ValidTarget"), ca.getController(), ca)) {
|
||||
&& !isValid(params.get("ValidTarget"), ca.getController(), ca, null)) {
|
||||
continue;
|
||||
}
|
||||
if (params.containsKey("IsCombat")) {
|
||||
@@ -5641,7 +5651,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (kw.startsWith("PreventAllDamageBy")) {
|
||||
String valid = getKeywords().get(getKeywordPosition("PreventAllDamageBy"));
|
||||
valid = valid.split(" ", 2)[1];
|
||||
if (source.isValid(valid, getController(), this)) {
|
||||
if (source.isValid(valid, getController(), this, null)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -6156,8 +6166,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String characteristic = kws[1];
|
||||
final String[] characteristics = characteristic.split(",");
|
||||
final String exception = kws.length > 3 ? kws[3] : null; // check "This effect cannot remove sth"
|
||||
if (source.isValid(characteristics, getController(), this)
|
||||
&& (!checkSBA || exception == null || !source.isValid(exception, getController(), this))) {
|
||||
if (source.isValid(characteristics, getController(), this, null)
|
||||
&& (!checkSBA || exception == null || !source.isValid(exception, getController(), this, null))) {
|
||||
return true;
|
||||
}
|
||||
} else if (kw.equals("Protection from colored spells")) {
|
||||
@@ -6300,7 +6310,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String parse = source.getKeywords().get(keywordPosition);
|
||||
final String[] k = parse.split(":");
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (isValid(restrictions, source.getController(), source)) {
|
||||
if (isValid(restrictions, source.getController(), source, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -6326,7 +6336,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|| (hasKeyword("CARDNAME can't be enchanted in the future.") && !isEnchantedBy(aura))
|
||||
|| (hasKeyword("CARDNAME can't be enchanted.") && !aura.getName().equals("Anti-Magic Aura")
|
||||
&& !(aura.getName().equals("Consecrate Land") && aura.isInZone(ZoneType.Battlefield)))
|
||||
|| ((tgt != null) && !isValid(tgt.getValidTgts(), aura.getController(), aura)));
|
||||
|| ((tgt != null) && !isValid(tgt.getValidTgts(), aura.getController(), aura, sa)));
|
||||
}
|
||||
|
||||
public final boolean canBeEquippedBy(final Card equip) {
|
||||
@@ -6335,13 +6345,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String parse = equip.getKeywords().get(keywordPosition);
|
||||
final String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (isValid(restrictions, equip.getController(), equip)) {
|
||||
if (isValid(restrictions, equip.getController(), equip, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !(hasProtectionFrom(equip)
|
||||
|| hasKeyword("CARDNAME can't be equipped.")
|
||||
|| !isValid("Creature", equip.getController(), equip));
|
||||
|| !isValid("Creature", equip.getController(), equip, null));
|
||||
}
|
||||
|
||||
public FCollectionView<ReplacementEffect> getReplacementEffects() {
|
||||
|
||||
@@ -524,7 +524,7 @@ public class CardFactoryUtil {
|
||||
// Reconfirm the Validity of a TgtValid, or if the Creature is still
|
||||
// a Creature
|
||||
if (tgt.doesTarget()
|
||||
&& !target.isValid(tgt.getValidTgts(), ability.getActivatingPlayer(), ability.getHostCard())) {
|
||||
&& !target.isValid(tgt.getValidTgts(), ability.getActivatingPlayer(), ability.getHostCard(), ability)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ public class CardFactoryUtil {
|
||||
int totPlayer = 0;
|
||||
String property = sq[0].substring(11);
|
||||
for (Player p : players) {
|
||||
if (p.hasProperty(property, source.getController(), source)) {
|
||||
if (p.hasProperty(property, source.getController(), source, null)) {
|
||||
totPlayer++;
|
||||
}
|
||||
}
|
||||
@@ -765,7 +765,7 @@ public class CardFactoryUtil {
|
||||
final List<ZoneType> vZone = ZoneType.listValueOf(lparts[0].split("Valid")[1]);
|
||||
String restrictions = l[0].replace(lparts[0] + " ", "");
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardCollection cards = CardLists.getValidCards(game.getCardsIn(vZone), rest, player, source);
|
||||
CardCollection cards = CardLists.getValidCards(game.getCardsIn(vZone), rest, player, source, null);
|
||||
return doXMath(cards.size(), m, source);
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ public class CardFactoryUtil {
|
||||
if (l[0].startsWith("Valid ")) {
|
||||
final String restrictions = l[0].substring(6);
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardCollection cardsonbattlefield = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), rest, player, source);
|
||||
CardCollection cardsonbattlefield = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), rest, player, source, null);
|
||||
return doXMath(cardsonbattlefield.size(), m, source);
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ public class CardFactoryUtil {
|
||||
? game.getCardsIn(ZoneType.listValueOf(lparts[0].substring(5)))
|
||||
: game.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
CardCollection cards = CardLists.getValidCards(cardsInZones, rest, cc, c);
|
||||
CardCollection cards = CardLists.getValidCards(cardsInZones, rest, cc, c, null);
|
||||
return doXMath(cards.size(), m, c);
|
||||
}
|
||||
|
||||
@@ -951,7 +951,7 @@ public class CardFactoryUtil {
|
||||
if (l[0].startsWith("GreatestPower_")) {
|
||||
final String restriction = l[0].substring(14);
|
||||
final String[] rest = restriction.split(",");
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c);
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c, null);
|
||||
int highest = 0;
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetPower() > highest) {
|
||||
@@ -964,7 +964,7 @@ public class CardFactoryUtil {
|
||||
if (l[0].startsWith("GreatestToughness_")) {
|
||||
final String restriction = l[0].substring(18);
|
||||
final String[] rest = restriction.split(",");
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c);
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c, null);
|
||||
int highest = 0;
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetToughness() > highest) {
|
||||
@@ -977,7 +977,7 @@ public class CardFactoryUtil {
|
||||
if (l[0].startsWith("HighestCMC_")) {
|
||||
final String restriction = l[0].substring(11);
|
||||
final String[] rest = restriction.split(",");
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsInGame(), rest, cc, c);
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsInGame(), rest, cc, c, null);
|
||||
int highest = 0;
|
||||
for (final Card crd : list) {
|
||||
if (crd.isSplitCard()) {
|
||||
@@ -1001,7 +1001,7 @@ public class CardFactoryUtil {
|
||||
final List<String> crdname = new ArrayList<String>();
|
||||
final String restriction = l[0].substring(19);
|
||||
final String[] rest = restriction.split(",");
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsInGame(), rest, cc, c);
|
||||
CardCollection list = CardLists.getValidCards(cc.getGame().getCardsInGame(), rest, cc, c, null);
|
||||
for (final Card card : list) {
|
||||
if (!crdname.contains(card.getName())) {
|
||||
crdname.add(card.getName());
|
||||
@@ -1030,7 +1030,7 @@ public class CardFactoryUtil {
|
||||
final CounterType counterType = CounterType.valueOf(components[1]);
|
||||
String restrictions = components[2];
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardCollection candidates = CardLists.getValidCards(game.getCardsInGame(), rest, cc, c);
|
||||
CardCollection candidates = CardLists.getValidCards(game.getCardsInGame(), rest, cc, c, null);
|
||||
|
||||
int added = 0;
|
||||
for (final Card counterSource : candidates) {
|
||||
@@ -1318,7 +1318,7 @@ public class CardFactoryUtil {
|
||||
|
||||
if (sq[0].startsWith("Devoured")) {
|
||||
final String validDevoured = l[0].split(" ")[1];
|
||||
CardCollection cl = CardLists.getValidCards(c.getDevoured(), validDevoured.split(","), cc, c);
|
||||
CardCollection cl = CardLists.getValidCards(c.getDevoured(), validDevoured.split(","), cc, c, null);
|
||||
return doXMath(cl.size(), m, c);
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ public class CardFactoryUtil {
|
||||
if (sq[0].contains("SumPower")) {
|
||||
final String[] restrictions = l[0].split("_");
|
||||
final String[] rest = restrictions[1].split(",");
|
||||
CardCollection filteredCards = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c);
|
||||
CardCollection filteredCards = CardLists.getValidCards(cc.getGame().getCardsIn(ZoneType.Battlefield), rest, cc, c, null);
|
||||
return doXMath(Aggregates.sum(filteredCards, CardPredicates.Accessors.fnGetNetPower), m, c);
|
||||
}
|
||||
// Count$CardManaCost
|
||||
@@ -1359,7 +1359,7 @@ public class CardFactoryUtil {
|
||||
final String[] restrictions = l[0].split("_");
|
||||
final String[] rest = restrictions[1].split(",");
|
||||
CardCollectionView cardsonbattlefield = game.getCardsIn(ZoneType.Battlefield);
|
||||
CardCollection filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cc, c);
|
||||
CardCollection filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cc, c, null);
|
||||
return Aggregates.sum(filteredCards, CardPredicates.Accessors.fnGetCmc);
|
||||
}
|
||||
|
||||
@@ -1391,7 +1391,7 @@ public class CardFactoryUtil {
|
||||
final CounterType cType = CounterType.getType(restrictions[1]);
|
||||
final String[] validFilter = restrictions[2].split(",");
|
||||
CardCollectionView validCards = game.getCardsIn(ZoneType.Battlefield);
|
||||
validCards = CardLists.getValidCards(validCards, validFilter, cc, c);
|
||||
validCards = CardLists.getValidCards(validCards, validFilter, cc, c, null);
|
||||
int cCount = 0;
|
||||
for (final Card card : validCards) {
|
||||
cCount += card.getCounters(cType);
|
||||
@@ -2018,7 +2018,7 @@ public class CardFactoryUtil {
|
||||
final List<String> protectionkw = new ArrayList<String>();
|
||||
final List<String> allkw = new ArrayList<String>();
|
||||
|
||||
cardlist = CardLists.getValidCards(cardlist, restrictions, p, host);
|
||||
cardlist = CardLists.getValidCards(cardlist, restrictions, p, host, null);
|
||||
for (Card c : cardlist) {
|
||||
for (String k : c.getKeywords()) {
|
||||
if (k.endsWith("walk")) {
|
||||
|
||||
@@ -44,12 +44,10 @@ public class CardLists {
|
||||
* <p>
|
||||
* filterToughness.
|
||||
* </p>
|
||||
*
|
||||
* @param in
|
||||
* a {@link forge.CardList} object.
|
||||
*
|
||||
* @param atLeastToughness
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
* @return a CardCollection
|
||||
*/
|
||||
public static CardCollection filterToughness(final Iterable<Card> in, final int atLeastToughness) {
|
||||
return CardLists.filter(in, new Predicate<Card>() {
|
||||
@@ -103,7 +101,6 @@ public class CardLists {
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByCmcDesc(final List<Card> list) {
|
||||
Collections.sort(list, CmcComparatorInv);
|
||||
@@ -115,7 +112,6 @@ public class CardLists {
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByToughnessAsc(final List<Card> list) {
|
||||
Collections.sort(list, ToughnessComparator);
|
||||
@@ -127,7 +123,6 @@ public class CardLists {
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByPowerAsc(final List<Card> list) {
|
||||
Collections.sort(list, PowerComparator);
|
||||
@@ -140,7 +135,6 @@ public class CardLists {
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByPowerDesc(final List<Card> list) {
|
||||
Collections.sort(list, Collections.reverseOrder(PowerComparator));
|
||||
@@ -187,28 +181,28 @@ public class CardLists {
|
||||
return CardLists.filter(cardList, CardPredicates.isControlledByAnyOf(player));
|
||||
}
|
||||
|
||||
public static CardCollection getValidCards(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source) {
|
||||
return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source));
|
||||
public static CardCollection getValidCards(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source, SpellAbility spellAbility) {
|
||||
return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source, spellAbility));
|
||||
}
|
||||
|
||||
public static List<Card> getValidCardsAsList(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source) {
|
||||
return CardLists.filterAsList(cardList, CardPredicates.restriction(restrictions, sourceController, source));
|
||||
return CardLists.filterAsList(cardList, CardPredicates.restriction(restrictions, sourceController, source, null));
|
||||
}
|
||||
|
||||
public static int getValidCardCount(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source) {
|
||||
return CardLists.count(cardList, CardPredicates.restriction(restrictions, sourceController, source));
|
||||
return CardLists.count(cardList, CardPredicates.restriction(restrictions, sourceController, source, null));
|
||||
}
|
||||
|
||||
public static CardCollection getValidCards(Iterable<Card> cardList, String restriction, Player sourceController, Card source) {
|
||||
return CardLists.filter(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source));
|
||||
return CardLists.filter(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source, null));
|
||||
}
|
||||
|
||||
public static List<Card> getValidCardsAsList(Iterable<Card> cardList, String restriction, Player sourceController, Card source) {
|
||||
return CardLists.filterAsList(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source));
|
||||
return CardLists.filterAsList(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source, null));
|
||||
}
|
||||
|
||||
public static int getValidCardCount(Iterable<Card> cardList, String restriction, Player sourceController, Card source) {
|
||||
return CardLists.count(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source));
|
||||
return CardLists.count(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source, null));
|
||||
}
|
||||
|
||||
public static CardCollection getTargetableCards(Iterable<Card> cardList, SpellAbility source) {
|
||||
|
||||
@@ -144,11 +144,11 @@ public final class CardPredicates {
|
||||
};
|
||||
}
|
||||
|
||||
public static final Predicate<Card> restriction(final String[] restrictions, final Player sourceController, final Card source) {
|
||||
public static final Predicate<Card> restriction(final String[] restrictions, final Player sourceController, final Card source, final SpellAbility spellAbility) {
|
||||
return new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c != null) && c.isValid(restrictions, sourceController, source);
|
||||
return (c != null) && c.isValid(restrictions, sourceController, source, spellAbility);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -151,7 +151,6 @@ public final class CardUtil {
|
||||
* @param from zone coming from
|
||||
* @param valid a isValid expression
|
||||
* @param src a Card object
|
||||
* @param checkLatestState a boolean, true if the latest state of the card as it left the original zone needs to be checked
|
||||
* @return a CardCollection that matches the given criteria
|
||||
*/
|
||||
public static CardCollection getThisTurnEntered(final ZoneType to, final ZoneType from, final String valid, final Card src) {
|
||||
@@ -190,7 +189,6 @@ public final class CardUtil {
|
||||
* @param from zone coming from
|
||||
* @param valid a isValid expression
|
||||
* @param src a Card object
|
||||
* @param checkLatestState a boolean, true if the latest state of the card as it left the original zone needs to be checked
|
||||
* @return a CardCollection that matches the given criteria
|
||||
*/
|
||||
public static CardCollection getLastTurnEntered(final ZoneType to, final ZoneType from, final String valid, final Card src) {
|
||||
@@ -307,7 +305,7 @@ public final class CardUtil {
|
||||
continue;
|
||||
|
||||
for(final Card c : game.getColoredCardsInPlay(MagicColor.toLongString(color))) {
|
||||
if (!res.contains(c) && c.isValid(valid, source.getController(), source) && !c.equals(origin)) {
|
||||
if (!res.contains(c) && c.isValid(valid, source.getController(), source, null) && !c.equals(origin)) {
|
||||
res.add(c);
|
||||
}
|
||||
}
|
||||
@@ -479,7 +477,7 @@ public final class CardUtil {
|
||||
final List<ZoneType> zone = tgt.getZone();
|
||||
|
||||
final boolean canTgtStack = zone.contains(ZoneType.Stack);
|
||||
List<Card> validCards = CardLists.getValidCards(game.getCardsIn(zone), tgt.getValidTgts(), ability.getActivatingPlayer(), ability.getHostCard());
|
||||
List<Card> validCards = CardLists.getValidCards(game.getCardsIn(zone), tgt.getValidTgts(), ability.getActivatingPlayer(), ability.getHostCard(), ability);
|
||||
List<Card> choices = CardLists.getTargetableCards(validCards, ability);
|
||||
if (canTgtStack) {
|
||||
// Since getTargetableCards doesn't have additional checks if one of the Zones is stack
|
||||
|
||||
@@ -157,7 +157,6 @@ public class CombatUtil {
|
||||
* </p>
|
||||
* <p>
|
||||
* This method doesn't check effects related to other creatures attacking
|
||||
* (but see {@link CombatUtil}.{@link #canAttack(Card, GameEntity, Combat)}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that a creature affected by any attacking restrictions may never be
|
||||
@@ -234,8 +233,6 @@ public class CombatUtil {
|
||||
*
|
||||
* @param attacker
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @param bLast
|
||||
* a boolean.
|
||||
*/
|
||||
public static boolean checkPropagandaEffects(final Game game, final Card attacker, final Combat combat) {
|
||||
final Cost attackCost = getAttackCost(game, attacker, combat.getDefenderByAttacker(attacker));
|
||||
@@ -342,7 +339,6 @@ public class CombatUtil {
|
||||
* @param combat
|
||||
* a {@link Combat}.
|
||||
* @return a {@link Map}.
|
||||
* @see #getRequirementsPerDefender(Card, FCollectionView, Combat, int)
|
||||
*/
|
||||
public static AttackConstraints getAllRequirements(final Combat combat) {
|
||||
return new AttackConstraints(combat);
|
||||
@@ -577,7 +573,7 @@ public class CombatUtil {
|
||||
final String valid = StringUtils.join(walkTypes, ",");
|
||||
final CardCollectionView defendingLands = defendingPlayer.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : defendingLands) {
|
||||
if (c.isValid(valid.split(","), defendingPlayer, attacker)) {
|
||||
if (c.isValid(valid.split(","), defendingPlayer, attacker, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -946,7 +942,7 @@ public class CombatUtil {
|
||||
final String parse = attacker.getKeywords().get(keywordPosition).toString();
|
||||
final String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (blocker.isValid(restrictions, attacker.getController(), attacker)) {
|
||||
if (blocker.isValid(restrictions, attacker.getController(), attacker, null)) {
|
||||
//Dragon Hunter check
|
||||
if (!k[1].contains("withoutReach") || !attacker.getType().hasCreatureType("Dragon")
|
||||
|| !blocker.hasKeyword("CARDNAME can block Dragons as though it had reach.")) {
|
||||
@@ -967,7 +963,7 @@ public class CombatUtil {
|
||||
final String[] parse0 = parse.split(":");
|
||||
final String[] k = parse0[0].split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (attacker.isValid(restrictions, blocker.getController(), blocker)) {
|
||||
if (attacker.isValid(restrictions, blocker.getController(), blocker, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
}
|
||||
if (!type.equals("Random") && !type.contains("X")) {
|
||||
// Knollspine Invocation fails to activate without the above conditional
|
||||
handList = CardLists.getValidCards(handList, type.split(";"), activator, source);
|
||||
handList = CardLists.getValidCards(handList, type.split(";"), activator, source, ability);
|
||||
}
|
||||
if (sameName) {
|
||||
for (Card c : handList) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CostDraw extends CostPart {
|
||||
List<Player> res = new ArrayList<Player>();
|
||||
String type = this.getType();
|
||||
for (Player p : payer.getGame().getPlayers()) {
|
||||
if (p.isValid(type, payer, source) && p.canDraw()) {
|
||||
if (p.isValid(type, payer, source, null) && p.canDraw()) {
|
||||
res.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class CostExile extends CostPartWithList {
|
||||
return list.contains(source);
|
||||
}
|
||||
|
||||
list = CardLists.getValidCards(list, type.split(";"), activator, source);
|
||||
list = CardLists.getValidCards(list, type.split(";"), activator, source, ability);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
if ((amount != null) && (list.size() < amount)) {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class CostExileFromStack extends CostPart {
|
||||
|
||||
CardCollectionView list = activator.getCardsIn(ZoneType.Stack);
|
||||
|
||||
list = CardLists.getValidCards(list, type.split(";"), activator, source);
|
||||
list = CardLists.getValidCards(list, type.split(";"), activator, source, ability);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
if ((amount != null) && (list.size() < amount)) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CostExiledMoveToGrave extends CostPartWithList {
|
||||
|
||||
CardCollectionView typeList = activator.getGame().getCardsIn(ZoneType.Exile);
|
||||
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source, ability);
|
||||
return typeList.size() >= i;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CostGainControl extends CostPartWithList {
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
final Card source = ability.getHostCard();
|
||||
CardCollectionView typeList = activator.getGame().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
|
||||
|
||||
Integer amount = this.convertAmount();
|
||||
if (amount == null) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CostGainLife extends CostPart {
|
||||
List<Player> res = new ArrayList<Player>();
|
||||
for(Player p : payer.getGame().getPlayers())
|
||||
{
|
||||
if(p.isValid(getType(), payer, source))
|
||||
if(p.isValid(getType(), payer, source, null))
|
||||
res.add(p);
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -128,7 +128,7 @@ public class CostPutCardToLib extends CostPartWithList {
|
||||
typeList = activator.getCardsIn(getFrom());
|
||||
}
|
||||
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source, ability);
|
||||
|
||||
if (typeList.size() < i) {
|
||||
return false;
|
||||
|
||||
@@ -134,7 +134,8 @@ public class CostPutCounter extends CostPartWithList {
|
||||
}
|
||||
} else {
|
||||
// 3 Cards have Put a -1/-1 Counter on a Creature you control.
|
||||
final List<Card> typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
|
||||
final List<Card> typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield),
|
||||
this.getType().split(";"), activator, source, ability);
|
||||
|
||||
if (typeList.size() == 0) {
|
||||
return false;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CostRemoveAnyCounter extends CostPartWithList {
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
final Card source = ability.getHostCard();
|
||||
CardCollectionView validCards = activator.getCardsIn(ZoneType.Battlefield);
|
||||
validCards = CardLists.getValidCards(validCards, this.getType().split(";"), activator, source);
|
||||
validCards = CardLists.getValidCards(validCards, this.getType().split(";"), activator, source, ability);
|
||||
validCards = CardLists.filter(validCards, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -136,7 +136,7 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
if (type.equals("OriginalHost")) {
|
||||
typeList = Lists.newArrayList(ability.getOriginalHost());
|
||||
} else {
|
||||
typeList = CardLists.getValidCards(activator.getCardsIn(this.zone), type.split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(activator.getCardsIn(this.zone), type.split(";"), activator, source, ability);
|
||||
}
|
||||
if (amount != null) {
|
||||
if (this.getTypeDescription().equals("among creatures you control")) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class CostReturn extends CostPartWithList {
|
||||
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
|
||||
|
||||
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
if (!needsAnnoucement && amount != null && typeList.size() < amount) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class CostReveal extends CostPartWithList {
|
||||
modifiedHand.remove(source); // can't pay for itself
|
||||
handList = modifiedHand;
|
||||
}
|
||||
handList = CardLists.getValidCards(handList, type.split(";"), activator, source);
|
||||
handList = CardLists.getValidCards(handList, type.split(";"), activator, source, ability);
|
||||
if ((amount != null) && (amount > handList.size())) {
|
||||
// not enough cards in hand to pay
|
||||
return false;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
|
||||
|
||||
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
|
||||
@@ -121,7 +121,7 @@ public class CostTapType extends CostPartWithList {
|
||||
type = type.replace("+withTotalPowerGE" + totalP, "");
|
||||
}
|
||||
|
||||
CardCollection typeList = CardLists.getValidCards(activator.getCardsIn(ZoneType.Battlefield), type.split(";"), activator, source);
|
||||
CardCollection typeList = CardLists.getValidCards(activator.getCardsIn(ZoneType.Battlefield), type.split(";"), activator, source, ability);
|
||||
|
||||
if (!canTapSource) {
|
||||
typeList.remove(source);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
final Card source = ability.getHostCard();
|
||||
|
||||
CardCollection typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield), getType().split(";"), activator, source);
|
||||
CardCollection typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield), getType().split(";"), activator, source, ability);
|
||||
|
||||
if (!canUntapSource) {
|
||||
typeList.remove(source);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class ManaCostAdjustment {
|
||||
* a StaticAbility
|
||||
* @param sa
|
||||
* the SpellAbility
|
||||
* @param originalCost
|
||||
* @param manaCost
|
||||
* a ManaCost
|
||||
*/
|
||||
private static void applyRaiseCostAbility(final StaticAbility staticAbility, final SpellAbility sa, final ManaCostBeingPaid manaCost) {
|
||||
@@ -217,12 +217,12 @@ public class ManaCostAdjustment {
|
||||
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, sa)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (params.containsKey("Activator") && ((activator == null)
|
||||
|| !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard))) {
|
||||
|| !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard, sa))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public class ManaCostAdjustment {
|
||||
}
|
||||
boolean targetValid = false;
|
||||
for (GameObject target : sa.getTargets().getTargets()) {
|
||||
if (target.isValid(params.get("ValidTarget").split(","), hostCard.getController(), hostCard)) {
|
||||
if (target.isValid(params.get("ValidTarget").split(","), hostCard.getController(), hostCard, sa)) {
|
||||
targetValid = true;
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public class ManaCostAdjustment {
|
||||
boolean targetValid = false;
|
||||
for (SpellAbility target : sa.getTargets().getTargetSpells()) {
|
||||
Card targetCard = target.getHostCard();
|
||||
if (targetCard.isValid(params.get("ValidSpellTarget").split(","), hostCard.getController(), hostCard)) {
|
||||
if (targetCard.isValid(params.get("ValidSpellTarget").split(","), hostCard.getController(), hostCard, sa)) {
|
||||
targetValid = true;
|
||||
}
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class ManaCostAdjustment {
|
||||
* a StaticAbility
|
||||
* @param sa
|
||||
* the SpellAbility
|
||||
* @param originalCost
|
||||
* @param manaCost
|
||||
* a ManaCost
|
||||
*/
|
||||
private static void applyReduceCostAbility(final StaticAbility staticAbility, final SpellAbility sa, final ManaCostBeingPaid manaCost) {
|
||||
@@ -367,11 +367,11 @@ public class ManaCostAdjustment {
|
||||
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, sa)) {
|
||||
return;
|
||||
}
|
||||
if (params.containsKey("Activator") && ((activator == null)
|
||||
|| !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard))) {
|
||||
|| !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard, sa))) {
|
||||
return;
|
||||
}
|
||||
if (params.containsKey("Type")) {
|
||||
@@ -433,7 +433,7 @@ public class ManaCostAdjustment {
|
||||
}
|
||||
boolean targetValid = false;
|
||||
for (GameObject target : sa.getTargets().getTargets()) {
|
||||
if (target.isValid(params.get("ValidTarget").split(","), hostCard.getController(), hostCard)) {
|
||||
if (target.isValid(params.get("ValidTarget").split(","), hostCard.getController(), hostCard, sa)) {
|
||||
targetValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class Untap extends Phase {
|
||||
if (!Untap.canUntap(c)) {
|
||||
return false;
|
||||
}
|
||||
if (c.isValid(restrict, player, null)) {
|
||||
if (c.isValid(restrict, player, null, null)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -175,7 +175,7 @@ public class Untap extends Phase {
|
||||
|
||||
CardCollection restrictUntapped = new CardCollection();
|
||||
CardCollection cardList = CardLists.filter(untapList, tappedCanUntap);
|
||||
cardList = CardLists.getValidCards(cardList, restrict, player, null);
|
||||
cardList = CardLists.getValidCards(cardList, restrict, player, null, null);
|
||||
|
||||
while (!cardList.isEmpty()) {
|
||||
Map<String, Integer> remaining = new HashMap<String, Integer>(restrictUntap);
|
||||
@@ -189,7 +189,7 @@ public class Untap extends Phase {
|
||||
"Select a card to untap\r\n(Selected:" + restrictUntapped + ")\r\n" + "Remaining cards that can untap: " + remaining);
|
||||
if (chosen != null) {
|
||||
for (Entry<String, Integer> rest : restrictUntap.entrySet()) {
|
||||
if (chosen.isValid(rest.getKey(), player, null)) {
|
||||
if (chosen.isValid(rest.getKey(), player, null, null)) {
|
||||
restrictUntap.put(rest.getKey(), rest.getValue().intValue() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1123,7 +1123,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
if (kw.startsWith("Protection:")) { // uses isValid
|
||||
final String characteristic = kw.split(":")[1];
|
||||
final String[] characteristics = characteristic.split(",");
|
||||
if (source.isValid(characteristics, this, null)) {
|
||||
if (source.isValid(characteristics, this, null, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1917,7 +1917,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source) {
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
final String[] incR = restriction.split("\\.", 2);
|
||||
|
||||
if (incR[0].equals("Opponent")) {
|
||||
@@ -1948,7 +1948,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
final String[] exR = excR.split("\\+"); // Exclusive Restrictions
|
||||
// are ...
|
||||
for (int j = 0; j < exR.length; j++) {
|
||||
if (!hasProperty(exR[j], sourceController, source)) {
|
||||
if (!hasProperty(exR[j], sourceController, source, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1957,7 +1957,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
||||
public final boolean hasProperty(final String property, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
if (property.equals("You")) {
|
||||
if (!equals(sourceController)) {
|
||||
return false;
|
||||
|
||||
@@ -77,12 +77,6 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
*
|
||||
* @param sourceCard
|
||||
* a {@link forge.game.card.Card} object.
|
||||
* @param parse
|
||||
* a {@link java.lang.String} object.
|
||||
* @param produced
|
||||
* a {@link java.lang.String} object.
|
||||
* @param num
|
||||
* a int.
|
||||
*/
|
||||
public AbilityManaPart(final Card sourceCard, final Map<String, String> params) {
|
||||
this.sourceCard = sourceCard;
|
||||
@@ -103,7 +97,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
* <p>
|
||||
* produceMana.
|
||||
* </p>
|
||||
* @param ability
|
||||
* @param sa
|
||||
*/
|
||||
public final void produceMana(SpellAbility sa) {
|
||||
this.produceMana(this.getOrigProduced(), this.getSourceCard().getController(), sa);
|
||||
@@ -197,7 +191,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
|
||||
Card source = saBeingPaid.getHostCard();
|
||||
if (source == null) return false;
|
||||
return source.isValid(cannotCounterSpell, sourceCard.getController(), sourceCard);
|
||||
return source.isValid(cannotCounterSpell, sourceCard.getController(), sourceCard, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +218,6 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
* <p>
|
||||
* getKeywords.
|
||||
* </p>
|
||||
* @param saBeingPaid
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
@@ -250,7 +243,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
public void createETBCounters(Card c) {
|
||||
String[] parse = this.addsCounters.split("_");
|
||||
// Convert random SVars if there are other cards with this effect
|
||||
if (c.isValid(parse[0], c.getController(), c)) {
|
||||
if (c.isValid(parse[0], c.getController(), c, null)) {
|
||||
String abStr = "DB$ PutCounter | Defined$ Self | CounterType$ " + parse[1]
|
||||
+ " | ETB$ True | CounterNum$ " + parse[2] + " | SubAbility$ ManaDBETBCounters";
|
||||
String dbStr = "DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Battlefield"
|
||||
@@ -341,7 +334,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
|
||||
|
||||
if (sa.getHostCard() != null) {
|
||||
if (sa.getHostCard().isValid(restriction, this.getSourceCard().getController(), this.getSourceCard())) {
|
||||
if (sa.getHostCard().isValid(restriction, this.getSourceCard().getController(), this.getSourceCard(), null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +212,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
manaPart = manaPart0;
|
||||
}
|
||||
|
||||
public final String getSvarWithFallback(final String name) {
|
||||
String var = sVars.get(name);
|
||||
if (var == null) {
|
||||
var = hostCard.getSVar(name);
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
public final String getSVar(final String name) {
|
||||
String var = sVars.get(name);
|
||||
if (var == null) {
|
||||
@@ -397,7 +405,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
paidLists.get(str).add(c);
|
||||
}
|
||||
public void resetPaidHash() {
|
||||
paidLists = new HashMap<String, CardCollection>();
|
||||
paidLists.clear();
|
||||
}
|
||||
|
||||
public Iterable<OptionalCost> getOptionalCosts() {
|
||||
@@ -727,7 +735,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
|
||||
String[] validTgt = tr.getValidTgts();
|
||||
if (entity instanceof GameEntity && !((GameEntity) entity).isValid(validTgt, getActivatingPlayer(), getHostCard())) {
|
||||
if (entity instanceof GameEntity && !((GameEntity) entity).isValid(validTgt, getActivatingPlayer(), getHostCard(), this)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1098,7 +1106,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
public boolean canTargetSpellAbility(final SpellAbility topSA) {
|
||||
final TargetRestrictions tgt = getTargetRestrictions();
|
||||
|
||||
if (hasParam("TargetType") && !topSA.isValid(getParam("TargetType").split(","), getActivatingPlayer(), getHostCard())) {
|
||||
if (hasParam("TargetType") && !topSA.isValid(getParam("TargetType").split(","), getActivatingPlayer(), getHostCard(), this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1115,7 +1123,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
boolean result = false;
|
||||
|
||||
for (final GameObject o : matchTgt.getTargets()) {
|
||||
if (o.isValid(splitTargetRestrictions.split(","), getActivatingPlayer(), getHostCard())) {
|
||||
if (o.isValid(splitTargetRestrictions.split(","), getActivatingPlayer(), getHostCard(), this)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
@@ -1131,7 +1139,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
continue;
|
||||
}
|
||||
for (final GameObject o : matchTgt.getTargets()) {
|
||||
if (o.isValid(splitTargetRestrictions.split(","), getActivatingPlayer(), getHostCard())) {
|
||||
if (o.isValid(splitTargetRestrictions.split(","), getActivatingPlayer(), getHostCard(), this)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
@@ -1161,12 +1169,12 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
}
|
||||
|
||||
return topSA.getHostCard().isValid(tgt.getValidTgts(), getActivatingPlayer(), getHostCard());
|
||||
return topSA.getHostCard().isValid(tgt.getValidTgts(), getActivatingPlayer(), getHostCard(), this);
|
||||
}
|
||||
|
||||
// Takes one argument like Permanent.Blue+withFlying
|
||||
@Override
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source) {
|
||||
public final boolean isValid(final String restriction, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
// Inclusive restrictions are Card types
|
||||
final String[] incR = restriction.split("\\.", 2);
|
||||
|
||||
@@ -1193,7 +1201,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
final String excR = incR[1];
|
||||
final String[] exR = excR.split("\\+"); // Exclusive Restrictions are ...
|
||||
for (int j = 0; j < exR.length; j++) {
|
||||
if (!hasProperty(exR[j], sourceController, source)) {
|
||||
if (!hasProperty(exR[j], sourceController, source, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1203,7 +1211,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
|
||||
// Takes arguments like Blue or withFlying
|
||||
@Override
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source) {
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source, SpellAbility spellAbility) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
list = game.getCardsIn(ZoneType.Battlefield);
|
||||
}
|
||||
|
||||
list = CardLists.getValidCards(list, this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getHostCard());
|
||||
list = CardLists.getValidCards(list, this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||
|
||||
int right;
|
||||
final String rightString = this.getPresentCompare().substring(2);
|
||||
@@ -382,7 +382,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
boolean result = false;
|
||||
|
||||
for (final GameObject o : matchTgt.getFirstTargetedSpell().getTargets().getTargets()) {
|
||||
if (o.isValid(this.getTargetValidTargeting().split(","), sa.getActivatingPlayer(), sa.getHostCard())) {
|
||||
if (o.isValid(this.getTargetValidTargeting().split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
if (this.getIsPresent() != null) {
|
||||
CardCollectionView list = game.getCardsIn(this.getPresentZone());
|
||||
|
||||
list = CardLists.getValidCards(list, this.getIsPresent().split(","), activator, c);
|
||||
list = CardLists.getValidCards(list, this.getIsPresent().split(","), activator, c, sa);
|
||||
|
||||
int right = 1;
|
||||
final String rightString = this.getPresentCompare().substring(2);
|
||||
|
||||
@@ -113,9 +113,7 @@ public class TargetRestrictions {
|
||||
* <p>
|
||||
* Constructor for Target.
|
||||
* </p>
|
||||
*
|
||||
* @param src
|
||||
* a {@link forge.game.card.Card} object.
|
||||
*
|
||||
* @param prompt
|
||||
* a {@link java.lang.String} object.
|
||||
* @param valid
|
||||
@@ -475,7 +473,7 @@ public class TargetRestrictions {
|
||||
return true;
|
||||
} else {
|
||||
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
||||
if (!c.isValid(this.validTgts, srcCard.getController(), srcCard)) {
|
||||
if (!c.isValid(this.validTgts, srcCard.getController(), srcCard, sa)) {
|
||||
continue;
|
||||
}
|
||||
if (isTargeted && !sa.canTarget(c)) {
|
||||
@@ -552,7 +550,7 @@ public class TargetRestrictions {
|
||||
final Card srcCard = sa.getHostCard(); // should there be OrginalHost at any moment?
|
||||
if (this.tgtZone.contains(ZoneType.Stack)) {
|
||||
for (final Card c : game.getStackZone().getCards()) {
|
||||
if (c.isValid(this.validTgts, srcCard.getController(), srcCard)
|
||||
if (c.isValid(this.validTgts, srcCard.getController(), srcCard, sa)
|
||||
&& (!isTargeted || sa.canTarget(c))
|
||||
&& !sa.getTargets().isTargeting(c)) {
|
||||
candidates.add(c);
|
||||
@@ -560,7 +558,7 @@ public class TargetRestrictions {
|
||||
}
|
||||
} else {
|
||||
for (final Card c : game.getCardsIn(this.tgtZone)) {
|
||||
if (c.isValid(this.validTgts, srcCard.getController(), srcCard)
|
||||
if (c.isValid(this.validTgts, srcCard.getController(), srcCard, sa)
|
||||
&& (!isTargeted || sa.canTarget(c))
|
||||
&& !sa.getTargets().isTargeting(c)) {
|
||||
candidates.add(c);
|
||||
|
||||
@@ -502,7 +502,7 @@ public class StaticAbility extends CardTraitBase {
|
||||
return false;
|
||||
}
|
||||
final Card topCard = controller.getCardsIn(ZoneType.Library).get(0);
|
||||
if (!topCard.isValid(this.mapParams.get("TopCardOfLibraryIs").split(","), controller, this.hostCard)) {
|
||||
if (!topCard.isValid(this.mapParams.get("TopCardOfLibraryIs").split(","), controller, this.hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +580,7 @@ public class StaticAbility extends CardTraitBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param c the ignoreEffectCards to set
|
||||
* @param cards the ignoreEffectCards to set
|
||||
*/
|
||||
public void setIgnoreEffectCards(final CardCollectionView cards) {
|
||||
ignoreEffectCards = cards;
|
||||
|
||||
@@ -49,12 +49,12 @@ public class StaticAbilityCantAttackBlock {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("Target")
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class StaticAbilityCantAttackBlock {
|
||||
if (params.containsKey("UnlessDefenderControls")) {
|
||||
String type = params.get("UnlessDefenderControls");
|
||||
CardCollectionView list = defender.getCardsIn(ZoneType.Battlefield);
|
||||
if (Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard))) {
|
||||
if (Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard, null))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (params.containsKey("IfDefenderControls")) {
|
||||
String type = params.get("IfDefenderControls");
|
||||
CardCollectionView list = defender.getCardsIn(ZoneType.Battlefield);
|
||||
if (!Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard))) {
|
||||
if (!Iterables.any(list, CardPredicates.restriction(type.split(","), hostCard.getController(), hostCard, null))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
}
|
||||
if (params.containsKey("UnlessDefender")) {
|
||||
final String type = params.get("UnlessDefender");
|
||||
if (defender.hasProperty(type, hostCard.getController(), hostCard)) {
|
||||
if (defender.hasProperty(type, hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -103,12 +103,12 @@ public class StaticAbilityCantAttackBlock {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (params.containsKey("Target")
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return null;
|
||||
}
|
||||
String costString = params.get("Cost");
|
||||
@@ -139,12 +139,12 @@ public class StaticAbilityCantAttackBlock {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !blocker.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !blocker.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (params.containsKey("Attacker") && attacker != null
|
||||
&& !attacker.isValid(params.get("Attacker").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !attacker.isValid(params.get("Attacker").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return null;
|
||||
}
|
||||
String costString = params.get("Cost");
|
||||
|
||||
@@ -47,12 +47,12 @@ public class StaticAbilityCantBeCast {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("Caster") && (activator != null)
|
||||
&& !activator.isValid(params.get("Caster"), hostCard.getController(), hostCard)) {
|
||||
&& !activator.isValid(params.get("Caster"), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class StaticAbilityCantBeCast {
|
||||
final Player activator = spellAbility.getActivatingPlayer();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class StaticAbilityCantBeCast {
|
||||
}
|
||||
|
||||
if (params.containsKey("Activator") && (activator != null)
|
||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,12 +138,12 @@ public class StaticAbilityCantBeCast {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& (card == null || !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard))) {
|
||||
&& (card == null || !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("Player") && (player != null)
|
||||
&& !player.isValid(params.get("Player"), hostCard.getController(), hostCard)) {
|
||||
&& !player.isValid(params.get("Player"), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,17 +62,17 @@ public class StaticAbilityCantTarget {
|
||||
}
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("ValidSource")
|
||||
&& !source.isValid(params.get("ValidSource").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !source.isValid(params.get("ValidSource").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.containsKey("Activator") && (activator != null)
|
||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard)) {
|
||||
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard, spellAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
|
||||
CardCollectionView cardsIGainedAbilitiesFrom = game.getCardsIn(validZones);
|
||||
cardsIGainedAbilitiesFrom = CardLists.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard);
|
||||
cardsIGainedAbilitiesFrom = CardLists.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard, null);
|
||||
|
||||
if (cardsIGainedAbilitiesFrom.size() > 0) {
|
||||
addFullAbs = new ArrayList<SpellAbility>();
|
||||
@@ -671,7 +671,7 @@ public final class StaticAbilityContinuous {
|
||||
final String[] strngs = params.get("Affected").split(",");
|
||||
|
||||
for (Player p : controller.getGame().getPlayersInTurnOrder()) {
|
||||
if (p.isValid(strngs, controller, hostCard)) {
|
||||
if (p.isValid(strngs, controller, hostCard, null)) {
|
||||
players.add(p);
|
||||
}
|
||||
}
|
||||
@@ -712,7 +712,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
|
||||
if (params.containsKey("Affected")) {
|
||||
affectedCards = CardLists.getValidCards(affectedCards, params.get("Affected").split(","), controller, hostCard);
|
||||
affectedCards = CardLists.getValidCards(affectedCards, params.get("Affected").split(","), controller, hostCard, null);
|
||||
}
|
||||
affectedCards.removeAll((List<?>) stAb.getIgnoreEffectCards());
|
||||
return affectedCards;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StaticAbilityETBTapped {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
if (params.containsKey("ValidCard")
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ public class StaticAbilityPreventDamage {
|
||||
int restDamage = damage;
|
||||
|
||||
if (params.containsKey("Source")
|
||||
&& !source.isValid(params.get("Source").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !source.isValid(params.get("Source").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return restDamage;
|
||||
}
|
||||
|
||||
if (params.containsKey("Target")
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard)) {
|
||||
&& !target.isValid(params.get("Target").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return restDamage;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
} else if ("AttackedPlayerWithMostLife".equals(condition)) {
|
||||
GameEntity attacked = (GameEntity) runParams.get("Attacked");
|
||||
if (attacked == null || !attacked.isValid("Player.withMostLife",
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TriggerAttached extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
if (!src.isValid(this.mapParams.get("ValidSource").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TriggerAttacks extends Trigger {
|
||||
if (this.mapParams.containsKey("Attacked")) {
|
||||
GameEntity attacked = (GameEntity) runParams2.get("Attacked");
|
||||
if (!attacked.isValid(this.mapParams.get("Attacked").split(",")
|
||||
, this.getHostCard().getController(), this.getHostCard())) {
|
||||
, this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ public class TriggerChampioned extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!championed.isValid(this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
if (!source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class TriggerChangesController extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TriggerChangesZone extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
final Card moved = (Card) runParams2.get("Card");
|
||||
if (!moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class TriggerCombatDamageDoneOnce extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
boolean valid = false;
|
||||
for (Card c : srcs) {
|
||||
if (c.isValid(this.mapParams.get("ValidSource").split(","), this.getHostCard().getController(),this.getHostCard())) {
|
||||
if (c.isValid(this.mapParams.get("ValidSource").split(","), this.getHostCard().getController(),this.getHostCard(), null)) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TriggerCounterAdded extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!addedTo.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TriggerCounterAddedOnce extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!addedTo.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TriggerCounterRemoved extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!addedTo.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TriggerDamageDone extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
if (!src.isValid(this.mapParams.get("ValidSource").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TriggerDealtCombatDamageOnce extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidTarget")) {
|
||||
boolean valid = false;
|
||||
for (GameEntity c : tgt) {
|
||||
if (c.isValid(this.mapParams.get("ValidTarget").split(","), this.getHostCard().getController(),this.getHostCard())) {
|
||||
if (c.isValid(this.mapParams.get("ValidTarget").split(","), this.getHostCard().getController(),this.getHostCard(), null)) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TriggerDevoured extends Trigger {
|
||||
final Card sac = (Card) runParams2.get("Devoured");
|
||||
if (this.mapParams.containsKey("ValidDevoured")) {
|
||||
if (!sac.isValid(this.mapParams.get("ValidDevoured").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TriggerDrawn extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!draw.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TriggerEvolved extends Trigger {
|
||||
final Card sac = (Card) runParams2.get("Card");
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!sac.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ public class TriggerExploited extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!exploited.isValid(this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidSource")) {
|
||||
if (!source.isValid(this.mapParams.get("ValidSource").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TriggerFight extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!fighter.isValid(this.mapParams.get("ValidCard").split(","),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TriggerPayCumulativeUpkeep extends Trigger {
|
||||
final Card card = (Card) runParams2.get("Card");
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TriggerPayEcho extends Trigger {
|
||||
final Card card = (Card) runParams2.get("Card");
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class TriggerPhaseIn extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!phaser.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TriggerPhaseOut extends Trigger {
|
||||
return false;
|
||||
}
|
||||
} else if (!phaser.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TriggerPlaneswalkedFrom extends Trigger {
|
||||
final CardCollection moved = (CardCollection) runParams2.get("Cards");
|
||||
for(Card c : moved) {
|
||||
if (c.isValid(this.mapParams.get("ValidCard").split(","), this
|
||||
.getHostCard().getController(), this.getHostCard())) {
|
||||
.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TriggerPlaneswalkedTo extends Trigger {
|
||||
for(Card moved : (Iterable<Card>)runParams2.get("Cards"))
|
||||
{
|
||||
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,13 +59,13 @@ public class TriggerSacrificed extends Trigger {
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!sac.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.mapParams.containsKey("ValidSourceController")) {
|
||||
if (sourceSA == null || !sourceSA.getActivatingPlayer().isValid(this.mapParams.get("ValidSourceController"),
|
||||
this.getHostCard().getController(), this.getHostCard())) {
|
||||
this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class TriggerSpellAbilityCast extends Trigger {
|
||||
while (sa != null && !validTgtFound) {
|
||||
for (final Card tgt : sa.getTargets().getTargetCards()) {
|
||||
if (tgt.isValid(this.mapParams.get("TargetsValid").split(","), this.getHostCard()
|
||||
.getController(), this.getHostCard())) {
|
||||
.getController(), this.getHostCard(), null)) {
|
||||
validTgtFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TriggerTaps extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!tapper.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class TriggerTapsForMana extends Trigger {
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
final Card tapper = (Card) runParams2.get("Card");
|
||||
if (!tapper.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("Player")) {
|
||||
final Player player = (Player) runParams2.get("Player");
|
||||
if (!player.isValid(this.mapParams.get("Player").split(","), this.getHostCard().getController(), this.getHostCard())) {
|
||||
if (!player.isValid(this.mapParams.get("Player").split(","), this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class TriggerTapsForMana extends Trigger {
|
||||
final SpellAbility sa = (SpellAbility) runParams2.get("AbilityMana");
|
||||
if (sa == null) return false;
|
||||
final Player activator = sa.getActivatingPlayer();
|
||||
if (!activator.isValid(this.mapParams.get("Activator").split(","), this.getHostCard().getController(), this.getHostCard())) {
|
||||
if (!activator.isValid(this.mapParams.get("Activator").split(","), this.getHostCard().getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ public class TriggerUnequip extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!equipped.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mapParams.containsKey("ValidEquipment")) {
|
||||
if (!equipment.isValid(this.mapParams.get("ValidEquipment").split(","), this.getHostCard()
|
||||
.getController(), this.getHostCard())) {
|
||||
.getController(), this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TriggerUntaps extends Trigger {
|
||||
|
||||
if (this.mapParams.containsKey("ValidCard")) {
|
||||
if (!untapper.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
this.getHostCard(), null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user