From e2972acad0a4c169560741a07f6b61c2afbce260 Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Sat, 5 Apr 2025 17:14:43 +0200 Subject: [PATCH] Put ForColor for Call of the Spirit Dragons (#7348) * Support for Call the Spirit Dragons * ~ better ChoiceTitle * ~ add AI flags --- .../ability/effects/CountersPutEffect.java | 18 ++++++++++++++++++ .../cardsfolder/c/call_the_spirit_dragons.txt | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 forge-gui/res/cardsfolder/c/call_the_spirit_dragons.txt 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 e89b62e9635..f155d20aca0 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 @@ -7,6 +7,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import forge.card.MagicColor; import forge.game.Game; import forge.game.GameEntity; import forge.game.GameEntityCounterTable; @@ -618,6 +619,23 @@ public class CountersPutEffect extends SpellAbilityEffect { for (String k : keywords) { resolvePerType(sa, placer, CounterType.getType(k), counterAmount, table, false); } + } else if (sa.hasParam("ForColor")) { + Iterable oldColors = card.getChosenColors(); + CounterType counterType = null; + try { + counterType = chooseTypeFromList(sa, sa.getParam("CounterType"), null, placer.getController()); + } catch (Exception e) { + System.out.println("Counter type doesn't match, nor does an SVar exist with the type name."); + return; + } + for (String color : MagicColor.Constant.ONLY_COLORS) { + card.setChosenColors(Lists.newArrayList(color)); + if (sa.getOriginalParam("ChoiceTitle") != null) { + sa.getMapParams().put("ChoiceTitle", sa.getOriginalParam("ChoiceTitle").replace("chosenColor", color)); + } + resolvePerType(sa, placer, counterType, counterAmount, table, true); + } + card.setChosenColors(Lists.newArrayList(oldColors)); } else { CounterType counterType = null; if (!sa.hasParam("EachExistingCounter") && !sa.hasParam("EachFromSource") diff --git a/forge-gui/res/cardsfolder/c/call_the_spirit_dragons.txt b/forge-gui/res/cardsfolder/c/call_the_spirit_dragons.txt new file mode 100644 index 00000000000..fca9c7d781c --- /dev/null +++ b/forge-gui/res/cardsfolder/c/call_the_spirit_dragons.txt @@ -0,0 +1,15 @@ +Name:Call the Spirit Dragons +ManaCost:W U B R G +Types:Enchantment +S:Mode$ Continuous | Affected$ Dragon.YouCtrl | AddKeyword$ Indestructible | Description$ Dragons you control have indestructible. +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ PutCounter | TriggerDescription$ At the beginning of your upkeep, for each color, put a +1/+1 counter on a Dragon you control of that color. If you put +1/+1 counters on five Dragons this way, you win the game. +SVar:PutCounter:DB$ PutCounter | Choices$ Dragon.ChosenColor+YouCtrl | ChoiceTitle$ Choose a Dragon for chosenColor | CounterType$ P1P1 | CounterNum$ 1 | RememberPut$ True | ForColor$ True | SubAbility$ WinGame +SVar:WinGame:DB$ WinsGame | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ5 | SubAbility$ DBCleanup | SpellDescription$ If you put +1/+1 counters on five Dragons this way, you win the game. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:Count$RememberedSize +DeckNeeds:Type$Dragon +DeckHas:Ability$Counters +AI:RemoveDeck:Random +SVar:NeedsToPlay:Creature.Dragon+YouCtrl +Oracle:Dragons you control have indestructible.\nAt the beginning of your upkeep, for each color, put a +1/+1 counter on a Dragon you control of that color. If you put +1/+1 counters on five Dragons this way, you win the game. +