Hinata & X spells fix

This commit is contained in:
Bug Hunter
2022-02-10 12:58:01 +00:00
committed by Michael Kamensky
parent e44c53bc68
commit 60cd9ab369
34 changed files with 62 additions and 72 deletions

View File

@@ -1343,7 +1343,7 @@ public class ComputerUtil {
}
final CardCollection typeList =
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), source.getController(), source, sa);
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type, source.getController(), source, sa);
for (Card c : typeList) {
if (c.getSVar("SacMe").equals("6")) {
return true;
@@ -1620,7 +1620,7 @@ public class ComputerUtil {
objects = AbilityUtils.getDefinedObjects(source, topStack.getParam("Defined"), topStack);
} else if (topStack.hasParam("ValidCards")) {
CardCollectionView battleField = aiPlayer.getCardsIn(ZoneType.Battlefield);
objects = CardLists.getValidCards(battleField, topStack.getParam("ValidCards").split(","), source.getController(), source, topStack);
objects = CardLists.getValidCards(battleField, topStack.getParam("ValidCards"), source.getController(), source, topStack);
} else {
return threatened;
}

View File

@@ -36,7 +36,7 @@ public class ComputerUtilAbility {
public boolean apply(final Card c) {
if (!c.getSVar("NeedsToPlay").isEmpty()) {
final String needsToPlay = c.getSVar("NeedsToPlay");
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), needsToPlay.split(","), c.getController(), c, null);
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), needsToPlay, c.getController(), c, null);
if (list.isEmpty()) {
return false;
}

View File

@@ -1951,7 +1951,7 @@ public class ComputerUtilCard {
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, needsToPlay.split(","), card.getController(), card, sa);
list = CardLists.getValidCards(list, needsToPlay, card.getController(), card, sa);
if (list.isEmpty()) {
return AiPlayDecision.MissingNeededCards;
}

View File

@@ -144,7 +144,7 @@ public class ComputerUtilCost {
return true;
}
}
final CardCollection typeList = CardLists.getValidCards(hand, type.split(","), source.getController(), source, sa);
final CardCollection typeList = CardLists.getValidCards(hand, type, source.getController(), source, sa);
if (typeList.size() > ai.getMaxHandSize()) {
continue;
}

View File

@@ -69,14 +69,14 @@ public class AnimateAi extends SpellAbilityAi {
final String valid = topStack.getParamOrDefault("SacValid", "Card.Self");
String num = topStack.getParamOrDefault("Amount", "1");
final int nToSac = AbilityUtils.calculateAmount(topStack.getHostCard(), num, topStack);
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","),
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid,
ai.getWeakestOpponent(), topStack.getHostCard(), topStack);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack, true));
ComputerUtilCard.sortByEvaluateCreature(list);
if (!list.isEmpty() && list.size() == nToSac && ComputerUtilCost.canPayCost(sa, ai, sa.isTrigger())) {
Card animatedCopy = becomeAnimated(source, sa);
list.add(animatedCopy);
list = CardLists.getValidCards(list, valid.split(","), ai.getWeakestOpponent(), topStack.getHostCard(),
list = CardLists.getValidCards(list, valid, ai.getWeakestOpponent(), topStack.getHostCard(),
topStack);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack, true));
if (ComputerUtilCard.evaluateCreature(animatedCopy) < ComputerUtilCard.evaluateCreature(list.get(0))

View File

@@ -184,7 +184,7 @@ public class ChooseCardAi extends SpellAbilityAi {
choice = ComputerUtilCard.getBestCreatureAI(options);
} else if (logic.equals("Clone")) {
final String filter = "Permanent.YouDontCtrl,Permanent.nonLegendary";
CardCollection newOptions = CardLists.getValidCards(options, filter.split(","), ctrl, host, sa);
CardCollection newOptions = CardLists.getValidCards(options, filter, ctrl, host, sa);
if (!newOptions.isEmpty()) {
options = newOptions;
}
@@ -194,7 +194,7 @@ public class ChooseCardAi extends SpellAbilityAi {
choice = Aggregates.random(options);
} else if (logic.equals("Untap")) {
final String filter = "Permanent.YouCtrl,Permanent.tapped";
CardCollection newOptions = CardLists.getValidCards(options, filter.split(","), ctrl, host, sa);
CardCollection newOptions = CardLists.getValidCards(options, filter, ctrl, host, sa);
if (!newOptions.isEmpty()) {
options = newOptions;
}

View File

@@ -198,7 +198,7 @@ public class CloneAi extends SpellAbilityAi {
filter = filter.replace(".nonLegendary+", ".").replace(".nonLegendary", "");
}
CardCollection newOptions = CardLists.getValidCards(options, filter.split(","), ctrl, host, sa);
CardCollection newOptions = CardLists.getValidCards(options, filter, ctrl, host, sa);
if (!newOptions.isEmpty()) {
options = newOptions;
}

View File

@@ -248,7 +248,7 @@ public class CopyPermanentAi extends SpellAbilityAi {
final boolean canCopyLegendary = sa.hasParam("NonLegendary");
final String filter = canCopyLegendary ? "Permanent" : "Permanent.YouDontCtrl,Permanent.nonLegendary";
// TODO add filter to not select Legendary from Other Player when ai already have a Legendary with that name
return CardLists.getValidCards(options, filter.split(","), ctrl, host, sa);
return CardLists.getValidCards(options, filter, ctrl, host, sa);
}
@Override

View File

@@ -251,7 +251,7 @@ public class DamageAllAi extends SpellAbilityAi {
// TODO: X may be something different than X paid
CardCollection list =
CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), validC.split(","), source.getController(), source, sa);
CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), validC, source.getController(), source, sa);
final Predicate<Card> filterKillable = new Predicate<Card>() {
@Override

View File

@@ -92,8 +92,8 @@ public class DestroyAllAi extends SpellAbilityAi {
// TODO should probably sort results when targeted to use on biggest threat instead of first match
for (Player opponent: ai.getOpponents()) {
CardCollection opplist = CardLists.getValidCards(opponent.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source, sa);
CardCollection ailist = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source, sa);
CardCollection opplist = CardLists.getValidCards(opponent.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source, sa);
CardCollection ailist = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, source.getController(), source, sa);
opplist = CardLists.filter(opplist, predicate);
ailist = CardLists.filter(ailist, predicate);

View File

@@ -68,7 +68,7 @@ public class DigUntilAi extends SpellAbilityAi {
} else {
if (sa.hasParam("Valid")) {
final String valid = sa.getParam("Valid");
if (CardLists.getValidCards(ai.getCardsIn(ZoneType.Library), valid.split(","), source.getController(), source, sa).isEmpty()) {
if (CardLists.getValidCards(ai.getCardsIn(ZoneType.Library), valid, source.getController(), source, sa).isEmpty()) {
return false;
}
}

View File

@@ -29,7 +29,7 @@ public class RegenerateAllAi extends SpellAbilityAi {
final String valid = sa.getParamOrDefault("ValidCards", "");
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard, sa);
list = CardLists.getValidCards(list, valid, hostCard.getController(), hostCard, sa);
list = CardLists.filter(list, CardPredicates.isController(ai));
if (list.size() == 0) {

View File

@@ -79,7 +79,7 @@ public class SacrificeAi extends SpellAbilityAi {
List<Card> list = null;
try {
list = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), source, sa);
list = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid, sa.getActivatingPlayer(), source, sa);
} catch (NullPointerException e) {
return false;
} finally {
@@ -141,7 +141,7 @@ public class SacrificeAi extends SpellAbilityAi {
List<Card> humanList = null;
try {
humanList = CardLists.getValidCards(ai.getStrongestOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), source, sa);
humanList = CardLists.getValidCards(ai.getStrongestOpponent().getCardsIn(ZoneType.Battlefield), valid, sa.getActivatingPlayer(), source, sa);
} catch (NullPointerException e) {
return false;
} finally {
@@ -155,7 +155,7 @@ public class SacrificeAi extends SpellAbilityAi {
} else if (defined.equals("You")) {
List<Card> computerList = null;
try {
computerList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), source, sa);
computerList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, sa.getActivatingPlayer(), source, sa);
} catch (NullPointerException e) {
return false;
} finally {

View File

@@ -241,14 +241,14 @@ public class TokenAi extends SpellAbilityAi {
final String valid = topStack.getParamOrDefault("SacValid", "Card.Self");
String num = sa.getParamOrDefault("Amount", "1");
final int nToSac = AbilityUtils.calculateAmount(topStack.getHostCard(), num, topStack);
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","),
CardCollection list = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid,
ai.getWeakestOpponent(), topStack.getHostCard(), sa);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack, true));
// only care about saving single creature for now
if (!list.isEmpty() && nTokens > 0 && list.size() == nToSac) {
ComputerUtilCard.sortByEvaluateCreature(list);
list.add(token);
list = CardLists.getValidCards(list, valid.split(","), ai.getWeakestOpponent(), topStack.getHostCard(), sa);
list = CardLists.getValidCards(list, valid, ai.getWeakestOpponent(), topStack.getHostCard(), sa);
list = CardLists.filter(list, CardPredicates.canBeSacrificedBy(topStack, true));
return ComputerUtilCard.evaluateCreature(token) < ComputerUtilCard.evaluateCreature(list.get(0))
&& list.contains(token);

View File

@@ -26,7 +26,7 @@ public class UntapAllAi extends SpellAbilityAi {
}
CardCollectionView list = CardLists.filter(aiPlayer.getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.TAPPED);
final String valid = sa.getParamOrDefault("ValidCards", "");
list = CardLists.getValidCards(list, valid.split(","), source.getController(), source, sa);
list = CardLists.getValidCards(list, valid, source.getController(), source, sa);
// don't untap if only opponent benefits
PlayerCollection goodControllers = aiPlayer.getAllies();
goodControllers.add(aiPlayer);
@@ -43,7 +43,7 @@ public class UntapAllAi extends SpellAbilityAi {
if (sa.hasParam("ValidCards")) {
String valid = sa.getParam("ValidCards");
CardCollectionView list = CardLists.filter(aiPlayer.getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.TAPPED);
list = CardLists.getValidCards(list, valid.split(","), source.getController(), source, sa);
list = CardLists.getValidCards(list, valid, source.getController(), source, sa);
return mandatory || !list.isEmpty();
}

View File

@@ -368,7 +368,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
list.addAll(p.getCardsIn(presentZone));
}
}
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard(), this);
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(), this.getHostCard(), this);
final String rightString = presentCompare.substring(2);
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);
@@ -397,7 +397,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
}
}
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard(), this);
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(), this.getHostCard(), this);
final String rightString = presentCompare.substring(2);
int right = AbilityUtils.calculateAmount(getHostCard(), rightString, this);

View File

@@ -346,7 +346,7 @@ public class AbilityUtils {
candidates = game.getCardsIn(ZoneType.smartValueOf(zone));
validDefined = s[1];
}
cards.addAll(CardLists.getValidCards(candidates, validDefined.split(","), hostCard.getController(), hostCard, sa));
cards.addAll(CardLists.getValidCards(candidates, validDefined, hostCard.getController(), hostCard, sa));
return cards;
} else {
CardCollection list = null;
@@ -977,7 +977,7 @@ public class AbilityUtils {
String var = sa.getParam("AbilityCount");
valid = TextUtil.fastReplace(valid, var, Integer.toString(calculateAmount(source, var, sa)));
}
return CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), source, sa);
return CardLists.getValidCards(list, valid, sa.getActivatingPlayer(), source, sa);
}
/**
@@ -1884,7 +1884,7 @@ public class AbilityUtils {
return doXMath(0, expr, c, ctb);
}
}
list = CardLists.getValidCards(list, k[1].split(","), sa.getActivatingPlayer(), c, sa);
list = CardLists.getValidCards(list, k[1], sa.getActivatingPlayer(), c, sa);
if (k[0].contains("TotalToughness")) {
return doXMath(Aggregates.sum(list, CardPredicates.Accessors.fnGetNetToughness), expr, c, ctb);
}
@@ -1911,7 +1911,7 @@ public class AbilityUtils {
return doXMath(0, expr, c, ctb);
}
}
list = CardLists.getValidCards(list, k[1].split(","), sa.getActivatingPlayer(), c, sa);
list = CardLists.getValidCards(list, k[1], sa.getActivatingPlayer(), c, sa);
return doXMath(list.size(), expr, c, ctb);
}
@@ -1940,14 +1940,14 @@ public class AbilityUtils {
if (sq[0].startsWith("LastStateBattlefield")) {
final String[] k = l[0].split(" ");
CardCollection list = new CardCollection(game.getLastStateBattlefield());
list = CardLists.getValidCards(list, k[1].split(","), player, c, ctb);
list = CardLists.getValidCards(list, k[1], player, c, ctb);
return doXMath(list.size(), expr, c, ctb);
}
if (sq[0].startsWith("LastStateGraveyard")) {
final String[] k = l[0].split(" ");
CardCollection list = new CardCollection(game.getLastStateGraveyard());
list = CardLists.getValidCards(list, k[1].split(","), player, c, ctb);
list = CardLists.getValidCards(list, k[1], player, c, ctb);
return doXMath(list.size(), expr, c, ctb);
}
@@ -2176,7 +2176,7 @@ public class AbilityUtils {
if (sq[0].startsWith("Devoured")) {
final String validDevoured = sq[0].split(" ")[1];
CardCollection cl = CardLists.getValidCards(c.getDevouredCards(), validDevoured.split(","), player, c, ctb);
CardCollection cl = CardLists.getValidCards(c.getDevouredCards(), validDevoured, player, c, ctb);
return doXMath(cl.size(), expr, c, ctb);
}
@@ -2451,8 +2451,7 @@ public class AbilityUtils {
if (sq[0].startsWith("ColorsCtrl")) {
final String restriction = l[0].substring(11);
final String[] rest = restriction.split(",");
final CardCollection list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), rest, player, c, ctb);
final CardCollection list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), restriction, player, c, ctb);
byte n = 0;
for (final Card card : list) {
n |= card.getColor().getColor();
@@ -2711,8 +2710,7 @@ public class AbilityUtils {
// Count$SumPower_valid
if (sq[0].startsWith("SumPower")) {
final String[] restrictions = l[0].split("_");
final String[] rest = restrictions[1].split(",");
CardCollection filteredCards = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), rest, player, c, ctb);
CardCollection filteredCards = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), restrictions[1], player, c, ctb);
return doXMath(Aggregates.sum(filteredCards, CardPredicates.Accessors.fnGetNetPower), expr, c, ctb);
}
@@ -2723,9 +2721,8 @@ public class AbilityUtils {
if (sq[0].contains("Graveyard"))
zone = ZoneType.Graveyard;
final String[] restrictions = l[0].split("_");
final String[] rest = restrictions[1].split(",");
CardCollectionView cardsonbattlefield = game.getCardsIn(zone);
CardCollection filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, player, c, ctb);
CardCollection filteredCards = CardLists.getValidCards(cardsonbattlefield, restrictions[1], player, c, ctb);
return Aggregates.sum(filteredCards, CardPredicates.Accessors.fnGetCmc);
}
@@ -2821,8 +2818,7 @@ public class AbilityUtils {
if (sq[0].startsWith("GreatestToughness_")) {
final String restriction = l[0].substring(18);
final String[] rest = restriction.split(",");
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), rest, player, c, ctb);
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), restriction, player, c, ctb);
int highest = 0;
for (final Card crd : list) {
if (crd.getNetToughness() > highest) {
@@ -2834,8 +2830,7 @@ public class AbilityUtils {
if (sq[0].startsWith("HighestCMC_")) {
final String restriction = l[0].substring(11);
final String[] rest = restriction.split(",");
CardCollection list = CardLists.getValidCards(game.getCardsInGame(), rest, player, c, ctb);
CardCollection list = CardLists.getValidCards(game.getCardsInGame(), restriction, player, c, ctb);
int highest = 0;
for (final Card crd : list) {
// dont check for Split card anymore
@@ -2874,8 +2869,7 @@ public class AbilityUtils {
if (sq[0].startsWith("DifferentCardNames_")) {
final List<String> crdname = Lists.newArrayList();
final String restriction = l[0].substring(19);
final String[] rest = restriction.split(",");
CardCollection list = CardLists.getValidCards(game.getCardsInGame(), rest, player, c, ctb);
CardCollection list = CardLists.getValidCards(game.getCardsInGame(), restriction, player, c, ctb);
for (final Card card : list) {
String name = card.getName();
// CR 201.2b Those objects have different names only if each of them has at least one name and no two objects in that group have a name in common
@@ -2889,8 +2883,7 @@ public class AbilityUtils {
if (sq[0].startsWith("DifferentPower_")) {
final List<Integer> powers = Lists.newArrayList();
final String restriction = l[0].substring(15);
final String[] rest = restriction.split(",");
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), rest, player, c, ctb);
CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), restriction, player, c, ctb);
for (final Card card : list) {
Integer pow = card.getNetPower();
if (!powers.contains(pow)) {
@@ -2915,8 +2908,7 @@ public class AbilityUtils {
if (sq[0].startsWith("ColorsCtrl")) {
final String restriction = l[0].substring(11);
final String[] rest = restriction.split(",");
final CardCollection list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), rest, player, c, ctb);
final CardCollection list = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), restriction, player, c, ctb);
byte n = 0;
for (final Card card : list) {
n |= card.getColor().getColor();
@@ -3417,16 +3409,14 @@ public class AbilityUtils {
String[] lparts = l[0].split(" ", 2);
final List<ZoneType> vZone = ZoneType.listValueOf(lparts[0].split("Valid")[1]);
String restrictions = TextUtil.fastReplace(l[0], TextUtil.addSuffix(lparts[0]," "), "");
final String[] rest = restrictions.split(",");
CardCollection cards = CardLists.getValidCards(game.getCardsIn(vZone), rest, player, source, ctb);
CardCollection cards = CardLists.getValidCards(game.getCardsIn(vZone), restrictions, player, source, ctb);
return doXMath(cards.size(), m, source, ctb);
}
// count valid cards on the battlefield
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, ctb);
CardCollection cardsonbattlefield = CardLists.getValidCards(game.getCardsIn(ZoneType.Battlefield), restrictions, player, source, ctb);
return doXMath(cardsonbattlefield.size(), m, source, ctb);
}

View File

@@ -130,7 +130,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
list = getTargetPlayers(sa).getCardsIn(ZoneType.Battlefield);
}
list = CardLists.getValidCards(list, valid.split(","), host.getController(), host, sa);
list = CardLists.getValidCards(list, valid, host.getController(), host, sa);
for (final Card c : list) {
doAnimate(c, sa, power, toughness, types, removeTypes, finalColors,

View File

@@ -67,7 +67,7 @@ public class CharmEffect extends SpellAbilityEffect {
} else {
num = Math.min(AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa), list.size());
}
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParamOrDefault("MinCharmNum", "1"), sa) : num;
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParam("MinCharmNum"), sa) : num;
boolean repeat = sa.hasParam("CanRepeatModes");
boolean random = sa.hasParam("Random");
@@ -120,7 +120,7 @@ public class CharmEffect extends SpellAbilityEffect {
}
if (additionalDesc) {
String addDescS = (sa.getParam("AdditionalDescription"));
String addDescS = sa.getParam("AdditionalDescription");
if (optional) {
sb.append(". ").append(addDescS.trim());
} else if (addDescS.startsWith(("."))) {

View File

@@ -132,7 +132,7 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
}
}
}
valid = CardLists.getValidCards(valid, type.split(","), chosenSA.getActivatingPlayer(), chosenSA.getHostCard(), sa);
valid = CardLists.getValidCards(valid, type, chosenSA.getActivatingPlayer(), chosenSA.getHostCard(), sa);
Card originalTarget = Iterables.getFirst(getTargetCards(chosenSA), null);
valid.remove(originalTarget);

View File

@@ -209,7 +209,7 @@ public class DigEffect extends SpellAbilityEffect {
if (changeValid.contains("ChosenType")) {
changeValid = changeValid.replace("ChosenType", host.getChosenType());
}
valid = CardLists.getValidCards(top, changeValid.split(","), cont, host, sa);
valid = CardLists.getValidCards(top, changeValid, cont, host, sa);
if (totalCMC) {
valid = CardLists.getValidCards(valid, "Card.cmcLE" + totcmc, cont, host, sa);
}

View File

@@ -233,7 +233,7 @@ public class DiscardEffect extends SpellAbilityEffect {
"X", Integer.toString(AbilityUtils.calculateAmount(source, "X", sa)));
}
toBeDiscarded = CardLists.getValidCards(dPHand, valid.split(","), source.getController(), source, sa);
toBeDiscarded = CardLists.getValidCards(dPHand, valid, source.getController(), source, sa);
toBeDiscarded = CardLists.filter(toBeDiscarded, Presets.NON_TOKEN);
if (toBeDiscarded.size() > 1) {
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
@@ -250,8 +250,7 @@ public class DiscardEffect extends SpellAbilityEffect {
}
final String valid = sa.getParamOrDefault("DiscardValid", "Card");
String[] dValid = valid.split(",");
CardCollection validCards = CardLists.getValidCards(dPHand, dValid, source.getController(), source, sa);
CardCollection validCards = CardLists.getValidCards(dPHand, valid, source.getController(), source, sa);
Player chooser = p;
if (mode.equals("RevealYouChoose")) {

View File

@@ -29,7 +29,7 @@ public class RegenerateAllEffect extends RegenerateBaseEffect {
final String valid = sa.getParamOrDefault("ValidCards", "");
CardCollectionView list = game.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard, sa);
list = CardLists.getValidCards(list, valid, hostCard.getController(), hostCard, sa);
// create Effect for Regeneration
createRegenerationEffect(sa, list);

View File

@@ -84,7 +84,7 @@ public class RepeatEffect extends SpellAbilityEffect {
} else {
list = game.getCardsIn(ZoneType.Battlefield);
}
list = CardLists.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
list = CardLists.getValidCards(list, repeatPresent, sa.getActivatingPlayer(), sa.getHostCard(), sa);
final String rightString = repeatCompare.substring(2);
int right = AbilityUtils.calculateAmount(sa.getHostCard(), rightString, sa);

View File

@@ -140,7 +140,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, sa);
unattachList = CardLists.getValidCards(unattachList, valid, source.getController(), source, sa);
for (final Card c : unattachList) {
handleUnattachment((GameEntity) o, c);
}

View File

@@ -37,7 +37,7 @@ public class UntapAllEffect extends SpellAbilityEffect {
}
list = list2;
}
list = CardLists.getValidCards(list, valid.split(","), card.getController(), card, sa);
list = CardLists.getValidCards(list, valid, card.getController(), card, sa);
boolean remember = sa.hasParam("RememberUntapped");
for (Card c : list) {

View File

@@ -90,7 +90,7 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
}
if (valid != null) {
allCards = CardLists.getValidCards(allCards, valid.split(","), host.getController(), host, sa);
allCards = CardLists.getValidCards(allCards, valid, host.getController(), host, sa);
}
return allCards;
}

View File

@@ -138,6 +138,7 @@ public class CostAdjustment {
count = Integer.parseInt(amount);
} else {
if (st.hasParam("Relative")) {
// grab SVar here already to avoid potential collision when SA has one with same name
count = AbilityUtils.calculateAmount(hostCard, st.hasSVar(amount) ? st.getSVar(amount) : amount, sa);
} else {
count = AbilityUtils.calculateAmount(hostCard, amount, st);
@@ -379,7 +380,7 @@ public class CostAdjustment {
// TODO: update cards with "This spell costs X less to cast...if you..."
// The caster is sa.getActivatingPlayer()
// cards like Hostage Taker can cast spells from other players.
value = AbilityUtils.calculateAmount(hostCard, amount, sa);
value = AbilityUtils.calculateAmount(hostCard, staticAbility.hasSVar(amount) ? staticAbility.getSVar(amount) : amount, sa);
} else {
value = AbilityUtils.calculateAmount(hostCard, amount, staticAbility);
}

View File

@@ -172,7 +172,7 @@ public class AbilityManaPart implements java.io.Serializable {
runParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer());
player.getGame().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams, false);
if (source.isLand() && sa.getPayCosts() != null && sa.getPayCosts().hasTapCost() ) {
if (source.isLand() && sa.getPayCosts() != null && sa.getPayCosts().hasTapCost()) {
player.setTappedLandForManaThisTurn(true);
}
} // end produceMana(String)

View File

@@ -467,7 +467,7 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
CardCollectionView list = game.getCardsIn(zone);
final String present = getParam("IsPresent");
list = CardLists.getValidCards(list, present.split(","), controller, hostCard, this);
list = CardLists.getValidCards(list, present, controller, hostCard, this);
int right = 1;
final String rightString = compare.substring(2);

View File

@@ -1070,7 +1070,7 @@ public final class StaticAbilityContinuous {
affectedCardsOriginal = new CardCollection(affectedCards);
}
affectedCards = CardLists.getValidCards(affectedCards, stAb.getParam("Affected").split(","), controller, hostCard, stAb);
affectedCards = CardLists.getValidCards(affectedCards, stAb.getParam("Affected"), controller, hostCard, stAb);
// Add back all cards that are in other player's graveyard, and meet the restrictions without YouOwn/YouCtrl (treat it as in your graveyard)
if (affectedCardsOriginal != null) {

View File

@@ -74,7 +74,7 @@ public class TriggerAttackersDeclared extends Trigger {
CardCollection attackers = (CardCollection) runParams.get(AbilityKey.Attackers);
if (hasParam("ValidAttackers")) {
attackers = CardLists.getValidCards(attackers, getParam("ValidAttackers").split(","), getHostCard().getController(), getHostCard(), this);
attackers = CardLists.getValidCards(attackers, getParam("ValidAttackers"), getHostCard().getController(), getHostCard(), this);
FCollection<GameEntity> defenders = new FCollection<>();
for (Card attacker : attackers) {
defenders.add(attacker.getGame().getCombat().getDefenderByAttacker(attacker));

View File

@@ -74,7 +74,7 @@ public class TriggerDrawn extends Trigger {
final String sIsPresent = this.getParam("ValidPlayerControls");
final Player p = ((Player)runParams.get(AbilityKey.Player));
CardCollection list = (CardCollection) p.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(),
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(),
this.getHostCard(), this);
if (list.size() == 0) {
return false;

View File

@@ -64,7 +64,7 @@ public class TriggerLifeGained extends Trigger {
final String sIsPresent = this.getParam("ValidPlayerControls");
final Player p = ((Player)runParams.get(AbilityKey.Player));
CardCollection list = (CardCollection) p.getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(),
list = CardLists.getValidCards(list, sIsPresent, this.getHostCard().getController(),
this.getHostCard(), this);
if (list.size() == 0) {
return false;