diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index 985f0f04b76..f1d8307bfb3 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -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); } 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 c126974e05c..ae0bb4295c0 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -1156,24 +1156,6 @@ public class Player extends GameEntity implements Comparable { 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. 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 b7e5cb37e07..8c792356ba0 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemoved.java @@ -55,7 +55,6 @@ public class TriggerCounterRemoved extends Trigger { * @param runParams*/ @Override public final boolean performTest(final Map 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); diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemovedOnce.java b/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemovedOnce.java index b71f51c6091..6f46b4df5c6 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemovedOnce.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerCounterRemovedOnce.java @@ -55,7 +55,6 @@ public class TriggerCounterRemovedOnce extends Trigger { * @param runParams*/ @Override public final boolean performTest(final Map runParams) { - final Card removedFrom = (Card) runParams.get(AbilityKey.Card); final CounterType removedType = (CounterType) runParams.get(AbilityKey.CounterType); if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {