From f1690f2d84a2921f91572862b0a4ba9f378f248b Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Tue, 14 Apr 2020 06:25:53 +0000 Subject: [PATCH] CounterPutEffect: add Choicer Param --- .../game/ability/effects/CountersPutEffect.java | 15 ++++++++++++--- .../src/main/java/forge/game/card/Card.java | 5 ++++- forge-gui/res/cardsfolder/e/eye_of_doom.txt | 5 ++--- .../cardsfolder/upcoming/C2020/agitator_ant.txt | 7 +++---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java index 63a8536f1ff..c7ba5ebf244 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java @@ -148,21 +148,30 @@ public class CountersPutEffect extends SpellAbilityEffect { if (sa.hasParam("Bolster")) { CardCollection creatsYouCtrl = CardLists.filter(activator.getCardsIn(ZoneType.Battlefield), Presets.CREATURES); CardCollection leastToughness = new CardCollection(Aggregates.listWithMin(creatsYouCtrl, CardPredicates.Accessors.fnGetDefense)); - tgtCards.addAll(pc.chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false)); + tgtCards.addAll(activator.getController().chooseCardsForEffect(leastToughness, sa, Localizer.getInstance().getMessage("lblChooseACreatureWithLeastToughness"), 1, 1, false)); tgtObjects.addAll(tgtCards); } else if (sa.hasParam("Choices")) { ZoneType choiceZone = ZoneType.Battlefield; if (sa.hasParam("ChoiceZone")) { choiceZone = ZoneType.smartValueOf(sa.getParam("ChoiceZone")); } + Player chooser = activator; + if (sa.hasParam("Chooser")) { + List choosers = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("Chooser"), sa); + if (choosers.isEmpty()) { + return; + } + chooser = choosers.get(0); + } + CardCollection choices = new CardCollection(game.getCardsIn(choiceZone)); int n = sa.hasParam("ChoiceAmount") ? Integer.parseInt(sa.getParam("ChoiceAmount")) : 1; - choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, card); + choices = CardLists.getValidCards(choices, sa.getParam("Choices"), activator, card, sa); String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " "; - tgtObjects.addAll(new CardCollection(pc.chooseCardsForEffect(choices, sa, title, n, n, !sa.hasParam("ChoiceOptional")))); + tgtObjects.addAll(new CardCollection(chooser.getController().chooseCardsForEffect(choices, sa, title, n, n, sa.hasParam("ChoiceOptional")))); } else { tgtObjects.addAll(getDefinedOrTargeted(sa, "Defined")); } diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index b16350a164b..548e7001496 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -6350,10 +6350,13 @@ public class Card extends GameEntity implements Comparable { public final void addGoad(Long timestamp, final Player p) { goad.put(timestamp, p); + updateAbilityTextForView(); } public final void removeGoad(Long timestamp) { - goad.remove(timestamp); + if (goad.remove(timestamp) != null) { + updateAbilityTextForView(); + } } public final boolean isGoaded() { diff --git a/forge-gui/res/cardsfolder/e/eye_of_doom.txt b/forge-gui/res/cardsfolder/e/eye_of_doom.txt index 9a002bde0c2..43abb2b5a3a 100644 --- a/forge-gui/res/cardsfolder/e/eye_of_doom.txt +++ b/forge-gui/res/cardsfolder/e/eye_of_doom.txt @@ -2,9 +2,8 @@ Name:Eye of Doom ManaCost:4 Types:Artifact T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ TrigChoose | TriggerDescription$ When CARDNAME enters the battlefield, each player chooses a nonland permanent and puts a doom counter on it. -SVar:TrigChoose:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBChoose -SVar:DBChoose:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Permanent.nonLand | AILogic$ OppPreferred | Mandatory$ True | SubAbility$ DBPutCounter -SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ DOOM | CounterNum$ 1 +SVar:TrigChoose:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBPutCounter +SVar:DBPutCounter:DB$ PutCounter | Chooser$ Remembered | Choices$ Permanent.nonLand | CounterType$ DOOM | CounterNum$ 1 A:AB$ DestroyAll | Cost$ 2 T Sac<1/CARDNAME> | ValidCards$ Permanent.counters_GE1_DOOM | SpellDescription$ Destroy each permanent with a doom counter. AI:RemoveDeck:All SVar:Picture:http://www.wizards.com/global/images/magic/general/eye_of_doom.jpg diff --git a/forge-gui/res/cardsfolder/upcoming/C2020/agitator_ant.txt b/forge-gui/res/cardsfolder/upcoming/C2020/agitator_ant.txt index 90bd546f0cb..be28f69d4c7 100755 --- a/forge-gui/res/cardsfolder/upcoming/C2020/agitator_ant.txt +++ b/forge-gui/res/cardsfolder/upcoming/C2020/agitator_ant.txt @@ -3,9 +3,8 @@ ManaCost:2 R Types:Creature Insect PT:2/2 T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRepeat | TriggerDescription$ At the beginning of your end step, each player may put two +1/+1 counters on a creature they control. Goad each creature that had counters put on it this way. (Until your next turn, those creatures attack each combat if able and attack a player other than you if able.) -SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBChoose | SubAbility$ DBGoad -SVar:DBChoose:DB$ ChooseCard | Defined$ Player.IsRemembered | Amount$ 1 | MinAmount$ 0 | Choices$ Creature.RememberedPlayerCtrl | SubAbility$ DBPutCounter -SVar:DBPutCounter:DB$ PutCounter | Defined$ ChosenCard | CounterType$ P1P1 | CounterNum$ 2 | RememberCards$ True +SVar:TrigRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBPutCounter | SubAbility$ DBGoad +SVar:DBPutCounter:DB$ PutCounter | Chooser$ Remembered | Choices$ Creature.RememberedPlayerCtrl | ChoiceOptional$ True | CounterType$ P1P1 | CounterNum$ 2 | RememberCards$ True SVar:DBGoad:DB$ Goad | Defined$ Remembered | SubAbility$ DBCleanup -SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosenCard$ True +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True Oracle:At the beginning of your end step, each player may put two +1/+1 counters on a creature they control. Goad each creature that had counters put on it this way. (Until your next turn, those creatures attack each combat if able and attack a player other than you if able.)