diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index fc808c6e874..dd576e9442a 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -1015,7 +1015,7 @@ public class CountersPutAi extends CountersAi { if (mine.isEmpty()) { // Try to Benefit Ally if possible final CardCollection ally = CardLists.filterControlledBy(options, ai.getAllies()); - if (ally.isEmpty()) { + if (!ally.isEmpty()) { return ComputerUtilCard.getBestAI(ally); } return isOptional ? null : ComputerUtilCard.getWorstAI(options); diff --git a/forge-game/src/main/java/forge/game/ability/effects/CountersMoveEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CountersMoveEffect.java index 3f8587eda36..5630f1df2c5 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CountersMoveEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CountersMoveEffect.java @@ -166,8 +166,6 @@ public class CountersMoveEffect extends SpellAbilityEffect { } game.updateLastStateForCard(dest); - table.replaceCounterEffect(game, sa, true); - return; } else if (sa.hasParam("ValidDefined")) { // one Source to many Targets // need given CounterType @@ -231,9 +229,7 @@ public class CountersMoveEffect extends SpellAbilityEffect { if (updateSource) { // update source game.updateLastStateForCard(source); - table.replaceCounterEffect(game, sa, true); } - return; } else { Card source = null; List tgtCards = getDefinedCardsOrTargeted(sa); @@ -276,7 +272,14 @@ public class CountersMoveEffect extends SpellAbilityEffect { for (Map.Entry e : tgtCounters.entrySet()) { removeCounter(sa, source, cur, e.getKey(), counterNum, countersToAdd); } - + } else if ("EachNotOn".equals(counterName)) { + final Map tgtCounters = Maps.newHashMap(source.getCounters()); + for (Map.Entry e : tgtCounters.entrySet()) { + if (cur.getCounters(e.getKey()) > 0) { + continue; + } + removeCounter(sa, source, cur, e.getKey(), counterNum, countersToAdd); + } } else if ("Any".equals(counterName)) { // any counterType currently only Leech Bonder final Map tgtCounters = source.getCounters(); @@ -292,18 +295,20 @@ public class CountersMoveEffect extends SpellAbilityEffect { return; } - Map params = Maps.newHashMap(); - params.put("Source", source); - params.put("Target", dest); - String title = Localizer.getInstance().getMessage("lblSelectRemoveCounterType"); - CounterType chosenType = pc.chooseCounterType(typeChoices, sa, title, params); + while (!typeChoices.isEmpty()) { + Map params = Maps.newHashMap(); + params.put("Source", source); + params.put("Target", dest); + String title = Localizer.getInstance().getMessage("lblSelectRemoveCounterType"); + CounterType chosenType = pc.chooseCounterType(typeChoices, sa, title, params); - removeCounter(sa, source, cur, chosenType, counterNum, countersToAdd); - } else { - if (!cur.canReceiveCounters(cType)) { - continue; + removeCounter(sa, source, cur, chosenType, counterNum, countersToAdd); + if (!counterNum.equals("Any")) { + break; + } + typeChoices.remove(chosenType); } - + } else { removeCounter(sa, source, cur, cType, counterNum, countersToAdd); } @@ -346,10 +351,11 @@ public class CountersMoveEffect extends SpellAbilityEffect { params.put("CounterType", cType); params.put("Source", src); params.put("Target", dest); + int min = sa.hasParam("NonZero") && countersToAdd.isEmpty() ? 1 : 0; cnum = pc.chooseNumber( sa, Localizer.getInstance().getMessage("lblTakeHowManyTargetCounterFromCard", cType.getName(), CardTranslation.getTranslatedName(src.getName())), - 0, cmax, params); + min, cmax, params); } else { cnum = Math.min(cmax, AbilityUtils.calculateAmount(host, counterNum, sa)); } diff --git a/forge-game/src/main/java/forge/game/ability/effects/CountersRemoveEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CountersRemoveEffect.java index 2b17995ad58..e1109cf5c6c 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CountersRemoveEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CountersRemoveEffect.java @@ -140,10 +140,13 @@ public class CountersRemoveEffect extends SpellAbilityEffect { CardCollection choices = CardLists.getValidCards(game.getCardsIn(choiceZone), sa.getParam("Choices"), player, card, sa); - //currently only used by one card, so for now - //amount is locked at 1 and choice is mandatory - srcCards = pc.chooseCardsForEffect(choices, sa, title, 1, 1, - false, null); + int min = 1; + int max = 1; + if (sa.hasParam("ChoiceOptional")) { + min = 0; + max = choices.size(); + } + srcCards = pc.chooseCardsForEffect(choices, sa, title, min, max, min == 0, null); } else { srcCards = getTargetCards(sa); } diff --git a/forge-game/src/main/java/forge/game/player/PlayerController.java b/forge-game/src/main/java/forge/game/player/PlayerController.java index c881605e79c..a06c3602c2e 100644 --- a/forge-game/src/main/java/forge/game/player/PlayerController.java +++ b/forge-game/src/main/java/forge/game/player/PlayerController.java @@ -230,8 +230,7 @@ public abstract class PlayerController { public abstract ICardFace chooseSingleCardFace(SpellAbility sa, String message, Predicate cpp, String name); public abstract List chooseColors(String message, SpellAbility sa, int min, int max, List options); - public abstract CounterType chooseCounterType(List options, SpellAbility sa, String prompt, - Map params); + public abstract CounterType chooseCounterType(List options, SpellAbility sa, String prompt, Map params); public abstract String chooseKeywordForPump(List options, SpellAbility sa, String prompt, Card tgtCard); diff --git a/forge-gui/res/cardsfolder/g/gyrus_waker_of_corpses.txt b/forge-gui/res/cardsfolder/g/gyrus_waker_of_corpses.txt index 916f225fd97..43f9d65c658 100644 --- a/forge-gui/res/cardsfolder/g/gyrus_waker_of_corpses.txt +++ b/forge-gui/res/cardsfolder/g/gyrus_waker_of_corpses.txt @@ -3,7 +3,7 @@ ManaCost:X B R G Types:Legendary Creature Hydra PT:0/0 K:etbCounter:P1P1:Y:no Condition:CARDNAME enters the battlefield with a number of +1/+1 counters on it equal to the amount of mana spent to cast it. -T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may exile target creature card with lesser power from your graveyard. If you do, create a token that's a copy of that card and that's tapped and attacking. Exile the token at the end of combat. +T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever NICKNAME attacks, you may exile target creature card with lesser power from your graveyard. If you do, create a token that's a copy of that card and that's tapped and attacking. Exile the token at the end of combat. SVar:TrigExile:DB$ ChangeZone | ValidTgts$ Creature.YouCtrl+powerLTZ | Origin$ Graveyard | Destination$ Exile | TgtPrompt$ Select target creature card with lesser power in your graveyard | RememberChanged$ True | Optional$ True | SubAbility$ DBCopy SVar:DBCopy:DB$ CopyPermanent | Defined$ Remembered | TokenTapped$ True | TokenAttacking$ True | AtEOT$ ExileCombat | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True diff --git a/forge-gui/res/cardsfolder/m/marath_will_of_the_wild.txt b/forge-gui/res/cardsfolder/m/marath_will_of_the_wild.txt index cd52ae9725c..7651afee496 100644 --- a/forge-gui/res/cardsfolder/m/marath_will_of_the_wild.txt +++ b/forge-gui/res/cardsfolder/m/marath_will_of_the_wild.txt @@ -4,10 +4,10 @@ Types:Legendary Creature Elemental Beast PT:0/0 K:etbCounter:P1P1:Y:no Condition:CARDNAME enters the battlefield with a number of +1/+1 counters on it equal to the amount of mana spent to cast it. SVar:Y:Count$CastTotalManaSpent -A:AB$ Charm | Cost$ XCantBe0 X SubCounter | Choices$ MarathCounters,MarathDmg,MarathToken | Defined$ You -SVar:MarathCounters:DB$ PutCounter | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SpellDescription$ Put X +1/+1 counters on target creature. X can't be 0. -SVar:MarathDmg:DB$ DealDamage | ValidTgts$ Any | NumDmg$ X | SpellDescription$ CARDNAME deals X damage to any target. X can't be 0. -SVar:MarathToken:DB$ Token | TokenAmount$ 1 | TokenScript$ g_x_x_elemental | TokenOwner$ You | TokenPower$ X | TokenToughness$ X | SpellDescription$ Create an X/X green Elemental creature token. X can't be 0. +A:AB$ Charm | Cost$ XCantBe0 X SubCounter | Choices$ MarathCounters,MarathDmg,MarathToken | Defined$ You | MinCharmNum$ 1 | AdditionalDescription$ . X can't be 0. +SVar:MarathCounters:DB$ PutCounter | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SpellDescription$ Put X +1/+1 counters on target creature. +SVar:MarathDmg:DB$ DealDamage | ValidTgts$ Any | NumDmg$ X | SpellDescription$ NICKNAME deals X damage to any target. +SVar:MarathToken:DB$ Token | TokenAmount$ 1 | TokenScript$ g_x_x_elemental | TokenOwner$ You | TokenPower$ X | TokenToughness$ X | SpellDescription$ Create an X/X green Elemental creature token. SVar:X:Count$xPaid AI:RemoveDeck:All Oracle:Marath, Will of the Wild enters the battlefield with a number of +1/+1 counters on it equal to the amount of mana spent to cast it.\n{X}, Remove X +1/+1 counters from Marath: Choose one —\n• Put X +1/+1 counters on target creature. X can't be 0.\n• Marath deals X damage to any target. X can't be 0.\n• Create an X/X green Elemental creature token. X can't be 0. diff --git a/forge-gui/res/cardsfolder/upcoming/goldberry_river_daughter.txt b/forge-gui/res/cardsfolder/upcoming/goldberry_river_daughter.txt new file mode 100644 index 00000000000..eb339d5048b --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/goldberry_river_daughter.txt @@ -0,0 +1,11 @@ +Name:Goldberry, River-Daughter +ManaCost:1 U +Types:Legendary Creature Nymph +PT:1/3 +A:AB$ MoveCounter | Cost$ T | Defined$ Self | ValidTgts$ Permanent.YouCtrl+Other | TgtPrompt$ Select another target permanent you control | CounterNum$ 1 | CounterType$ EachNotOn | SpellDescription$ Move a counter of each kind not on CARDNAME from another target permanent you control onto NICKNAME. +A:AB$ MoveCounter | Cost$ U T | Source$ Self | ValidTgts$ Permanent.YouCtrl+Other | RememberPut$ True | TgtPrompt$ Select another target permanent you control | CounterNum$ Any | CounterType$ Any | NonZero$ True | SubAbility$ DBDraw | SpellDescription$ Move one or more counters from NICKNAME onto another target permanent you control. If you do, draw a card. +SVar:DBDraw:DB$ Draw | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:Remembered$Amount +DeckHints:Ability$Counters +Oracle:{T}: Move a counter of each kind not on Goldberry, River-Daughter from another target permanent you control onto Goldberry.\n{U}, {T}: Move one or more counters from Goldberry onto another target permanent you control. If you do, draw a card. \ No newline at end of file