choices = CardLists.getTargetableCards(validCards, ability);
if (canTgtStack) {
// Since getTargetableCards doesn't have additional checks if one of the Zones is stack
diff --git a/forge-game/src/main/java/forge/game/combat/CombatUtil.java b/forge-game/src/main/java/forge/game/combat/CombatUtil.java
index adfdcfd589e..c86ffc454c6 100644
--- a/forge-game/src/main/java/forge/game/combat/CombatUtil.java
+++ b/forge-game/src/main/java/forge/game/combat/CombatUtil.java
@@ -157,7 +157,6 @@ public class CombatUtil {
*
*
* This method doesn't check effects related to other creatures attacking
- * (but see {@link CombatUtil}.{@link #canAttack(Card, GameEntity, Combat)}.
*
*
* 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;
}
}
diff --git a/forge-game/src/main/java/forge/game/cost/CostDiscard.java b/forge-game/src/main/java/forge/game/cost/CostDiscard.java
index 871e188f101..eb232aaa95a 100644
--- a/forge-game/src/main/java/forge/game/cost/CostDiscard.java
+++ b/forge-game/src/main/java/forge/game/cost/CostDiscard.java
@@ -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) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostDraw.java b/forge-game/src/main/java/forge/game/cost/CostDraw.java
index c1d9d3c4b88..86f989d05a3 100644
--- a/forge-game/src/main/java/forge/game/cost/CostDraw.java
+++ b/forge-game/src/main/java/forge/game/cost/CostDraw.java
@@ -59,7 +59,7 @@ public class CostDraw extends CostPart {
List res = new ArrayList();
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);
}
}
diff --git a/forge-game/src/main/java/forge/game/cost/CostExile.java b/forge-game/src/main/java/forge/game/cost/CostExile.java
index aa8bce2193c..3ea4587e19d 100644
--- a/forge-game/src/main/java/forge/game/cost/CostExile.java
+++ b/forge-game/src/main/java/forge/game/cost/CostExile.java
@@ -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)) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostExileFromStack.java b/forge-game/src/main/java/forge/game/cost/CostExileFromStack.java
index 161dd4051c6..996d1b5d9b8 100644
--- a/forge-game/src/main/java/forge/game/cost/CostExileFromStack.java
+++ b/forge-game/src/main/java/forge/game/cost/CostExileFromStack.java
@@ -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)) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostExiledMoveToGrave.java b/forge-game/src/main/java/forge/game/cost/CostExiledMoveToGrave.java
index 5c3b819274c..d8b2c05b46c 100644
--- a/forge-game/src/main/java/forge/game/cost/CostExiledMoveToGrave.java
+++ b/forge-game/src/main/java/forge/game/cost/CostExiledMoveToGrave.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/cost/CostGainControl.java b/forge-game/src/main/java/forge/game/cost/CostGainControl.java
index 16dbf11b612..07b63fac99c 100644
--- a/forge-game/src/main/java/forge/game/cost/CostGainControl.java
+++ b/forge-game/src/main/java/forge/game/cost/CostGainControl.java
@@ -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) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostGainLife.java b/forge-game/src/main/java/forge/game/cost/CostGainLife.java
index 1264d364843..17447a0f2e4 100644
--- a/forge-game/src/main/java/forge/game/cost/CostGainLife.java
+++ b/forge-game/src/main/java/forge/game/cost/CostGainLife.java
@@ -65,7 +65,7 @@ public class CostGainLife extends CostPart {
List res = new ArrayList();
for(Player p : payer.getGame().getPlayers())
{
- if(p.isValid(getType(), payer, source))
+ if(p.isValid(getType(), payer, source, null))
res.add(p);
}
return res;
diff --git a/forge-game/src/main/java/forge/game/cost/CostPutCardToLib.java b/forge-game/src/main/java/forge/game/cost/CostPutCardToLib.java
index b8d1fa48fe8..2b2395e1ffc 100644
--- a/forge-game/src/main/java/forge/game/cost/CostPutCardToLib.java
+++ b/forge-game/src/main/java/forge/game/cost/CostPutCardToLib.java
@@ -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;
diff --git a/forge-game/src/main/java/forge/game/cost/CostPutCounter.java b/forge-game/src/main/java/forge/game/cost/CostPutCounter.java
index 49ad73c9e8f..33147358f21 100644
--- a/forge-game/src/main/java/forge/game/cost/CostPutCounter.java
+++ b/forge-game/src/main/java/forge/game/cost/CostPutCounter.java
@@ -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 typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
+ final List typeList = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Battlefield),
+ this.getType().split(";"), activator, source, ability);
if (typeList.size() == 0) {
return false;
diff --git a/forge-game/src/main/java/forge/game/cost/CostRemoveAnyCounter.java b/forge-game/src/main/java/forge/game/cost/CostRemoveAnyCounter.java
index 662f14b3de8..01c1127e89a 100644
--- a/forge-game/src/main/java/forge/game/cost/CostRemoveAnyCounter.java
+++ b/forge-game/src/main/java/forge/game/cost/CostRemoveAnyCounter.java
@@ -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() {
@Override
public boolean apply(final Card c) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostRemoveCounter.java b/forge-game/src/main/java/forge/game/cost/CostRemoveCounter.java
index d4e89dccbce..7742be86b51 100644
--- a/forge-game/src/main/java/forge/game/cost/CostRemoveCounter.java
+++ b/forge-game/src/main/java/forge/game/cost/CostRemoveCounter.java
@@ -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")) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostReturn.java b/forge-game/src/main/java/forge/game/cost/CostReturn.java
index be8fa487b74..cdde80a41fc 100644
--- a/forge-game/src/main/java/forge/game/cost/CostReturn.java
+++ b/forge-game/src/main/java/forge/game/cost/CostReturn.java
@@ -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) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostReveal.java b/forge-game/src/main/java/forge/game/cost/CostReveal.java
index 1b095b8acce..d5ee0f798a3 100644
--- a/forge-game/src/main/java/forge/game/cost/CostReveal.java
+++ b/forge-game/src/main/java/forge/game/cost/CostReveal.java
@@ -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;
diff --git a/forge-game/src/main/java/forge/game/cost/CostSacrifice.java b/forge-game/src/main/java/forge/game/cost/CostSacrifice.java
index b04a28b8e1c..066ba32e51d 100644
--- a/forge-game/src/main/java/forge/game/cost/CostSacrifice.java
+++ b/forge-game/src/main/java/forge/game/cost/CostSacrifice.java
@@ -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.")) {
diff --git a/forge-game/src/main/java/forge/game/cost/CostTapType.java b/forge-game/src/main/java/forge/game/cost/CostTapType.java
index 200fa7d71e2..4621b38bf1b 100644
--- a/forge-game/src/main/java/forge/game/cost/CostTapType.java
+++ b/forge-game/src/main/java/forge/game/cost/CostTapType.java
@@ -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);
diff --git a/forge-game/src/main/java/forge/game/cost/CostUntapType.java b/forge-game/src/main/java/forge/game/cost/CostUntapType.java
index 61fc60fb7a1..d577745c640 100644
--- a/forge-game/src/main/java/forge/game/cost/CostUntapType.java
+++ b/forge-game/src/main/java/forge/game/cost/CostUntapType.java
@@ -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);
diff --git a/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java b/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java
index 1592a78ee06..3308f798037 100644
--- a/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java
+++ b/forge-game/src/main/java/forge/game/mana/ManaCostAdjustment.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/phase/Untap.java b/forge-game/src/main/java/forge/game/phase/Untap.java
index 73cdb29e676..775819a0137 100644
--- a/forge-game/src/main/java/forge/game/phase/Untap.java
+++ b/forge-game/src/main/java/forge/game/phase/Untap.java
@@ -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 remaining = new HashMap(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 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);
}
}
diff --git a/forge-game/src/main/java/forge/game/player/Player.java b/forge-game/src/main/java/forge/game/player/Player.java
index ddf4343558a..2f5a9e2429a 100644
--- a/forge-game/src/main/java/forge/game/player/Player.java
+++ b/forge-game/src/main/java/forge/game/player/Player.java
@@ -1123,7 +1123,7 @@ public class Player extends GameEntity implements Comparable {
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 {
}
@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 {
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 {
}
@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;
diff --git a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java
index b71313d24be..69bd5cf8bfa 100644
--- a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java
+++ b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java
@@ -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 params) {
this.sourceCard = sourceCard;
@@ -103,7 +97,7 @@ public class AbilityManaPart implements java.io.Serializable {
*
* produceMana.
*
- * @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 {
*
* getKeywords.
*
- * @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;
}
}
diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java
index ee5053718a6..0390a9267c1 100644
--- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java
+++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java
@@ -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();
+ paidLists.clear();
}
public Iterable 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;
}
diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java
index 53cd20daf20..20a77a76045 100644
--- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java
+++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityCondition.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java
index 685a9dc10e8..7b2e03b202b 100644
--- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java
+++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java
@@ -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);
diff --git a/forge-game/src/main/java/forge/game/spellability/TargetRestrictions.java b/forge-game/src/main/java/forge/game/spellability/TargetRestrictions.java
index 4edd5ca4993..88f6c7f4656 100644
--- a/forge-game/src/main/java/forge/game/spellability/TargetRestrictions.java
+++ b/forge-game/src/main/java/forge/game/spellability/TargetRestrictions.java
@@ -113,9 +113,7 @@ public class TargetRestrictions {
*
* Constructor for Target.
*
- *
- * @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);
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java
index 06c2e088856..97caf996ae2 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java
@@ -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;
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantAttackBlock.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantAttackBlock.java
index a5f876e2073..551a2b05eb2 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantAttackBlock.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantAttackBlock.java
@@ -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");
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java
index 9a472342e7f..6a6fe5d3a5d 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantTarget.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantTarget.java
index 25826d3618a..a740853e516 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantTarget.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantTarget.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java
index d316ffb4be3..3d970bc8036 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java
@@ -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();
@@ -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;
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityETBTapped.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityETBTapped.java
index b1b28320224..281edbf6618 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityETBTapped.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityETBTapped.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java
index 28fc7fe1ef6..1608837e826 100644
--- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java
+++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityPreventDamage.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/trigger/Trigger.java b/forge-game/src/main/java/forge/game/trigger/Trigger.java
index cad1cb7f312..1d1cbcfcdf0 100644
--- a/forge-game/src/main/java/forge/game/trigger/Trigger.java
+++ b/forge-game/src/main/java/forge/game/trigger/Trigger.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerAttached.java b/forge-game/src/main/java/forge/game/trigger/TriggerAttached.java
index 67773daab52..38db20fbdc1 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerAttached.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerAttached.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java b/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java
index e5f1bdb8912..5da3e8231e8 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerAttacks.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerChampioned.java b/forge-game/src/main/java/forge/game/trigger/TriggerChampioned.java
index 0bfae8891c1..2604e2d55c7 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerChampioned.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerChampioned.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerChangesController.java b/forge-game/src/main/java/forge/game/trigger/TriggerChangesController.java
index d2d417abe4e..6b52f085b30 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerChangesController.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerChangesController.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java
index aa885f04866..a8b1feee7f8 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerCombatDamageDoneOnce.java b/forge-game/src/main/java/forge/game/trigger/TriggerCombatDamageDoneOnce.java
index a2cc7c5ad08..16f567c2fd0 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerCombatDamageDoneOnce.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerCombatDamageDoneOnce.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerCounterAdded.java b/forge-game/src/main/java/forge/game/trigger/TriggerCounterAdded.java
index 3cf5b6e6542..eb9264e7a6f 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerCounterAdded.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerCounterAdded.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerCounterAddedOnce.java b/forge-game/src/main/java/forge/game/trigger/TriggerCounterAddedOnce.java
index 3653f0ea6a6..3f139d0e2ea 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerCounterAddedOnce.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerCounterAddedOnce.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java b/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java
index 75522ebfbd3..bd5ece1a443 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerDamageDone.java b/forge-game/src/main/java/forge/game/trigger/TriggerDamageDone.java
index 5e474ba2794..dd3aa7a713f 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerDamageDone.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerDamageDone.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerDealtCombatDamageOnce.java b/forge-game/src/main/java/forge/game/trigger/TriggerDealtCombatDamageOnce.java
index d6cbf467888..d498a582215 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerDealtCombatDamageOnce.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerDealtCombatDamageOnce.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerDevoured.java b/forge-game/src/main/java/forge/game/trigger/TriggerDevoured.java
index 6002f4b98e1..7d5bd513b9f 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerDevoured.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerDevoured.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerDrawn.java b/forge-game/src/main/java/forge/game/trigger/TriggerDrawn.java
index 6c2cab62fe0..a03cc760acd 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerDrawn.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerDrawn.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerEvolved.java b/forge-game/src/main/java/forge/game/trigger/TriggerEvolved.java
index 95daba1d0a3..117ad5fdf2a 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerEvolved.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerEvolved.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerExploited.java b/forge-game/src/main/java/forge/game/trigger/TriggerExploited.java
index 1de368877bc..4ea8bae856b 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerExploited.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerExploited.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerFight.java b/forge-game/src/main/java/forge/game/trigger/TriggerFight.java
index 55519520217..1a7e752a865 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerFight.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerFight.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPayCumulativeUpkeep.java b/forge-game/src/main/java/forge/game/trigger/TriggerPayCumulativeUpkeep.java
index 7d19453dc0c..a76c3112b3f 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPayCumulativeUpkeep.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPayCumulativeUpkeep.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPayEcho.java b/forge-game/src/main/java/forge/game/trigger/TriggerPayEcho.java
index c3033fec37b..744b56c83ba 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPayEcho.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPayEcho.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPhaseIn.java b/forge-game/src/main/java/forge/game/trigger/TriggerPhaseIn.java
index 8b5ec22f143..14df6564a97 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPhaseIn.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPhaseIn.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPhaseOut.java b/forge-game/src/main/java/forge/game/trigger/TriggerPhaseOut.java
index b85f3ba1b25..0e5a827a1c6 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPhaseOut.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPhaseOut.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedFrom.java b/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedFrom.java
index 45ace5d067d..8709b42538f 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedFrom.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedFrom.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedTo.java b/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedTo.java
index ebd89c2d1b3..272d8b53179 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedTo.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerPlaneswalkedTo.java
@@ -37,7 +37,7 @@ public class TriggerPlaneswalkedTo extends Trigger {
for(Card moved : (Iterable)runParams2.get("Cards"))
{
if (moved.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
- this.getHostCard())) {
+ this.getHostCard(), null)) {
return true;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerSacrificed.java b/forge-game/src/main/java/forge/game/trigger/TriggerSacrificed.java
index 68889b90f13..5c6631923bb 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerSacrificed.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerSacrificed.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java
index 4efa883caf0..0b01c0a81b5 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java
@@ -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;
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerTaps.java b/forge-game/src/main/java/forge/game/trigger/TriggerTaps.java
index b954784514d..b1bff87bae1 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerTaps.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerTaps.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerTapsForMana.java b/forge-game/src/main/java/forge/game/trigger/TriggerTapsForMana.java
index 68aa7e4b963..af408cf6604 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerTapsForMana.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerTapsForMana.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerUnequip.java b/forge-game/src/main/java/forge/game/trigger/TriggerUnequip.java
index 2b444034f53..ba2f52ae518 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerUnequip.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerUnequip.java
@@ -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;
}
}
diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerUntaps.java b/forge-game/src/main/java/forge/game/trigger/TriggerUntaps.java
index 36ed47ccbd7..7c583f1467d 100644
--- a/forge-game/src/main/java/forge/game/trigger/TriggerUntaps.java
+++ b/forge-game/src/main/java/forge/game/trigger/TriggerUntaps.java
@@ -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;
}
}
diff --git a/forge-gui/res/cardsfolder/h/harness_the_storm.txt b/forge-gui/res/cardsfolder/h/harness_the_storm.txt
index 57d0319dfc0..10bd5fa6f3f 100644
--- a/forge-gui/res/cardsfolder/h/harness_the_storm.txt
+++ b/forge-gui/res/cardsfolder/h/harness_the_storm.txt
@@ -1,7 +1,7 @@
Name:Harness the Storm
ManaCost:2 R
Types:Enchantment
-T:Mode$ SpellCast | ValidCard$ Instant.wasCastFromHand,Sorcery.wasCastFromHand | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever you cast an instant or sorcery spell from your hand, you may cast target card with the same name as that spell from your graveyard. (you still pay its costs.)
+T:Mode$ SpellCast | ValidCard$ Instant.wasCastFromHand,Sorcery.wasCastFromHand | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever you cast an instant or sorcery spell from your hand, you may cast target card with the same name as that spell from your graveyard. (You still pay its costs.)
SVar:TrigPump:AB$ Pump | Cost$ 0 | TgtZone$ Graveyard | ValidTgts$ Instant.YouCtrl+sharesNameWith TriggeredCard,Sorcery.YouCtrl+sharesNameWith TriggeredCard | TgtPrompt$ Choose target instant or sorcery from your graveyard | PumpZone$ Graveyard | SubAbility$ TrigPlay
SVar:TrigPlay:DB$ Play | Defined$ Targeted | Optional$ True
SVar:NonStackingEffect:True
diff --git a/forge-gui/src/main/java/forge/player/HumanCostDecision.java b/forge-gui/src/main/java/forge/player/HumanCostDecision.java
index 8381c008948..e9f49259365 100644
--- a/forge-gui/src/main/java/forge/player/HumanCostDecision.java
+++ b/forge-gui/src/main/java/forge/player/HumanCostDecision.java
@@ -143,7 +143,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
if (discardType.contains("+WithSameName")) {
final String type = discardType.replace("+WithSameName", "");
- hand = CardLists.getValidCards(hand, type.split(";"), player, source);
+ hand = CardLists.getValidCards(hand, type.split(";"), player, source, ability);
final CardCollectionView landList2 = hand;
hand = CardLists.filter(hand, new Predicate() {
@Override
@@ -180,7 +180,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final String type = new String(discardType);
final String[] validType = type.split(";");
- hand = CardLists.getValidCards(hand, validType, player, source);
+ hand = CardLists.getValidCards(hand, validType, player, source, ability);
if (c == null) {
final String sVar = ability.getSVar(amount);
@@ -276,7 +276,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (type.equals("All")) {
return PaymentDecision.card(list);
}
- list = CardLists.getValidCards(list, type.split(";"), player, source);
+ list = CardLists.getValidCards(list, type.split(";"), player, source, ability);
if (c == null) {
final String sVar = ability.getSVar(amount);
// Generalize this
@@ -357,7 +357,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
for (final SpellAbilityStackInstance si : game.getStack()) {
final Card stC = si.getSourceCard();
final SpellAbility stSA = si.getSpellAbility(true).getRootAbility();
- if (stC.isValid(cost.getType().split(";"), ability.getActivatingPlayer(), source) && stSA.isSpell()) {
+ if (stC.isValid(cost.getType().split(";"), ability.getActivatingPlayer(), source, ability) && stSA.isSpell()) {
saList.add(stSA);
if (stC.isCopiedSpell()) {
descList.add(stSA.getStackDescription() + " (Copied Spell)");
@@ -448,7 +448,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
final Player activator = ability.getActivatingPlayer();
- final CardCollection list = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Exile), cost.getType().split(";"), activator, source);
+ final CardCollection list = CardLists.getValidCards(activator.getGame().getCardsIn(ZoneType.Exile),
+ cost.getType().split(";"), activator, source, ability);
if (list.size() < c) {
return null;
@@ -491,7 +492,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability);
}
final CardCollectionView list = player.getCardsIn(ZoneType.Battlefield);
- final CardCollectionView validCards = CardLists.getValidCards(list, cost.getType().split(";"), player, source);
+ final CardCollectionView validCards = CardLists.getValidCards(list, cost.getType().split(";"), player, source, ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, validCards);
final String desc = cost.getTypeDescription() == null ? cost.getType() : cost.getTypeDescription();
@@ -610,7 +611,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
}
- final CardCollection list = CardLists.getValidCards(cost.sameZone ? player.getGame().getCardsIn(cost.getFrom()) : player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source);
+ final CardCollection list = CardLists.getValidCards(cost.sameZone ? player.getGame().getCardsIn(cost.getFrom()) :
+ player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source, ability);
if (cost.from == ZoneType.Hand) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list);
@@ -691,7 +693,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
// Cards to use this branch: Scarscale Ritual, Wandering Mage - each adds only one counter
- final CardCollectionView typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), player, ability.getHostCard());
+ final CardCollectionView typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield),
+ cost.getType().split(";"), player, ability.getHostCard(), ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, typeList);
inp.setMessage("Put " + Lang.nounWithAmount(c, cost.getCounter().getName() + " counter") + " on " + cost.getDescriptiveType());
@@ -727,7 +730,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
}
else {
- final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), ability.getActivatingPlayer(), ability.getHostCard());
+ final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield),
+ cost.getType().split(";"), player, source, ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, validCards);
inp.setCancelAllowed(true);
@@ -788,7 +792,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
Integer num = cost.convertAmount();
CardCollectionView hand = player.getCardsIn(ZoneType.Hand);
- hand = CardLists.getValidCards(hand, cost.getType().split(";"), player, ability.getHostCard());
+ hand = CardLists.getValidCards(hand, cost.getType().split(";"), player, source, ability);
if (num == null) {
final String sVar = ability.getSVar(amount);
@@ -823,7 +827,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
}
CardCollectionView list = new CardCollection(player.getCardsIn(ZoneType.Battlefield));
- list = CardLists.getValidCards(list, type.split(";"), player, source);
+ list = CardLists.getValidCards(list, type.split(";"), player, source, ability);
list = CardLists.filter(list, new Predicate() {
@@ -971,7 +975,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
return PaymentDecision.card(ability.getOriginalHost(), cntRemoved >= 0 ? cntRemoved : maxCounters);
}
- final CardCollectionView validCards = CardLists.getValidCards(player.getCardsIn(cost.zone), type.split(";"), player, source);
+ final CardCollectionView validCards = CardLists.getValidCards(player.getCardsIn(cost.zone), type.split(";"), player, source, ability);
if (cost.zone.equals(ZoneType.Battlefield)) {
if (cntRemoved == 0) {
return PaymentDecision.card(source, 0);
@@ -1019,7 +1023,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final String type = cost.getType();
CardCollectionView list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.canBeSacrificedBy(ability));
- list = CardLists.getValidCards(list, type.split(";"), player, source);
+ list = CardLists.getValidCards(list, type.split(";"), player, source, ability);
if (player.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
list = CardLists.getNotType(list, "Creature");
}
@@ -1092,7 +1096,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
type = type.replace("+withTotalPowerGE" + totalP, "");
}
- CardCollection typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type.split(";"), player, ability.getHostCard());
+ CardCollection typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), type.split(";"), player,
+ source, ability);
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
if (c == null && !amount.equals("Any")) {
final String sVar = ability.getSVar(amount);
@@ -1174,7 +1179,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
@Override
public PaymentDecision visit(final CostUntapType cost) {
CardCollection typeList = CardLists.getValidCards(player.getGame().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"),
- player, ability.getHostCard());
+ player, source, ability);
typeList = CardLists.filter(typeList, Presets.TAPPED);
if (!cost.canUntapSource) {
typeList.remove(source);
diff --git a/forge-gui/src/main/java/forge/player/HumanPlay.java b/forge-gui/src/main/java/forge/player/HumanPlay.java
index dabfccb696a..3258a76c8dc 100644
--- a/forge-gui/src/main/java/forge/player/HumanPlay.java
+++ b/forge-gui/src/main/java/forge/player/HumanPlay.java
@@ -322,7 +322,7 @@ public class HumanPlay {
List res = new ArrayList();
String type = part.getType();
for (Player player : p.getGame().getPlayers()) {
- if (player.isValid(type, p, source) && player.canDraw()) {
+ if (player.isValid(type, p, source, sourceAbility) && player.canDraw()) {
res.add(player);
}
}
@@ -412,7 +412,7 @@ public class HumanPlay {
}
else {
CardCollectionView list = p.getGame().getCardsIn(ZoneType.Battlefield);
- list = CardLists.getValidCards(list, part.getType().split(";"), p, source);
+ list = CardLists.getValidCards(list, part.getType().split(";"), p, source, sourceAbility);
if (list.isEmpty()) { return false; }
if (!p.getController().confirmPayment(part, "Do you want to put " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " on " + part.getTypeDescription() + "?")) {
return false;
@@ -460,7 +460,7 @@ public class HumanPlay {
return false;
}
- list = CardLists.getValidCards(list, part.getType().split(";"), p, source);
+ list = CardLists.getValidCards(list, part.getType().split(";"), p, source, sourceAbility);
while (amount > 0) {
final CounterType counterType;
list = CardLists.filter(list, new Predicate() {
@@ -510,7 +510,7 @@ public class HumanPlay {
else {
CostExile costExile = (CostExile) part;
ZoneType from = costExile.getFrom();
- List list = CardLists.getValidCards(p.getCardsIn(from), part.getType().split(";"), p, source);
+ List list = CardLists.getValidCards(p.getCardsIn(from), part.getType().split(";"), p, source, sourceAbility);
final int nNeeded = getAmountFromPart(costPart, source, sourceAbility);
if (list.size() < nNeeded) {
return false;
@@ -549,7 +549,7 @@ public class HumanPlay {
else {
listView = p.getCardsIn(from);
}
- CardCollection list = CardLists.getValidCards(listView, part.getType().split(";"), p, source);
+ CardCollection list = CardLists.getValidCards(listView, part.getType().split(";"), p, source, sourceAbility);
if (sameZone) { // Jotun Grunt
FCollectionView players = p.getGame().getPlayers();
diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java
index 0151f462a34..db34e9994c2 100644
--- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java
+++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java
@@ -1352,7 +1352,7 @@ public class PlayerControllerHuman
while (true) {
final PaperCard cp = chooseSinglePaperCard(sa, message, cpp, sa.getHostCard().getName());
final Card instanceForPlayer = Card.fromPaperCard(cp, player); // the Card instance for test needs a game to be tested
- if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard())) {
+ if (instanceForPlayer.isValid(valid, sa.getHostCard().getController(), sa.getHostCard(), sa)) {
return cp.getName();
}
}