AbilityUtils: add Valid to xCount to fix Mana Echoes

This commit is contained in:
Hans Mackowiak
2021-04-02 00:53:46 +02:00
parent 5030f6e901
commit 479f72f160
4 changed files with 13 additions and 20 deletions

View File

@@ -1834,6 +1834,19 @@ public class AbilityUtils {
return CardFactoryUtil.doXMath(game.getCounterAddedThisTurn(cType, parts[2], parts[3], c, player, ctb), expr, c);
}
// count valid cards in any specified zone/s
if (l[0].startsWith("Valid")) {
String[] lparts = l[0].split(" ", 2);
final String[] rest = lparts[1].split(",");
final CardCollectionView cardsInZones = lparts[0].length() > 5
? game.getCardsIn(ZoneType.listValueOf(lparts[0].substring(5)))
: game.getCardsIn(ZoneType.Battlefield);
CardCollection cards = CardLists.getValidCards(cardsInZones, rest, player, c, ctb);
return CardFactoryUtil.doXMath(cards.size(), expr, c);
}
}
return CardFactoryUtil.xCount(c, s2);
}

View File

@@ -1156,24 +1156,6 @@ public class Player extends GameEntity implements Comparable<Player> {
addChangedKeywords(ImmutableList.of(keyword), ImmutableList.of(), getGame().getNextTimestamp());
}
/**
* Replace all instances of added keywords.
* @param oldKeyword the keyword to replace.
* @param newKeyword the keyword with which to replace.
*/
private final void replaceAllKeywordInstances(final String oldKeyword, final String newKeyword) {
boolean keywordReplaced = false;
for (final KeywordsChange ck : changedKeywords.values()) {
if (ck.removeKeywordfromAdd(oldKeyword)) {
ck.addKeyword(newKeyword);
keywordReplaced = true;
}
}
if (keywordReplaced) {
updateKeywords();
}
}
/**
* Remove all keyword changes which grant this {@link Player} the specified
* keyword.

View File

@@ -55,7 +55,6 @@ public class TriggerCounterRemoved extends Trigger {
* @param runParams*/
@Override
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
final Card addedTo = (Card) runParams.get(AbilityKey.Card);
final CounterType addedType = (CounterType) runParams.get(AbilityKey.CounterType);
final Integer addedNewCounterAmount = (Integer) runParams.get(AbilityKey.NewCounterAmount);

View File

@@ -55,7 +55,6 @@ public class TriggerCounterRemovedOnce extends Trigger {
* @param runParams*/
@Override
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
final Card removedFrom = (Card) runParams.get(AbilityKey.Card);
final CounterType removedType = (CounterType) runParams.get(AbilityKey.CounterType);
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {