From dee961c6037c6e91f4b451cf5bb0b9842e6ddb37 Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Thu, 4 Feb 2021 14:33:57 +0100 Subject: [PATCH] TriggerSpellAbilityCast: extra flag for spent Snow shares color with card --- .../game/trigger/TriggerSpellAbilityCast.java | 18 ++++++++++++++++++ .../cardsfolder/upcoming/boreal_outrider.txt | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 forge-gui/res/cardsfolder/upcoming/boreal_outrider.txt diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java index 067ed6ee530..d129121c30d 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java @@ -23,6 +23,7 @@ import java.util.Set; import com.google.common.collect.Sets; +import forge.card.ColorSet; import forge.game.Game; import forge.game.GameEntity; import forge.game.GameObject; @@ -32,6 +33,7 @@ import forge.game.card.CardCollection; import forge.game.card.CardLists; import forge.game.card.CardUtil; import forge.game.cost.Cost; +import forge.game.mana.Mana; import forge.game.player.Player; import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbilityStackInstance; @@ -261,6 +263,22 @@ public class TriggerSpellAbilityCast extends Trigger { return false; } } + + if (hasParam("SnowSpentForCardsColor")) { + boolean found = false; + for (Mana m : spellAbility.getPayingMana()) { + if (!m.isSnow()) { + continue; + } + if (cast.determineColor().sharesColorWith(ColorSet.fromMask(m.getColor()))) { + found = true; + break; + } + } + if (!found) { + return false; + } + } return true; } diff --git a/forge-gui/res/cardsfolder/upcoming/boreal_outrider.txt b/forge-gui/res/cardsfolder/upcoming/boreal_outrider.txt new file mode 100644 index 00000000000..a408ffc6f90 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/boreal_outrider.txt @@ -0,0 +1,13 @@ +Name:Boreal Outrider +ManaCost:2 G +Types:Snow Creature Elf Warrior +PT:3/2 +T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ You | Execute$ TrigEffect | TriggerZones$ Battlefield | SnowSpentForCardsColor$ True | TriggerDescription$ Whenever you cast a creature spell, if {S} of any of that spell’s colors was spent to cast it, that creature enters the battlefield with an additional +1/+1 counter on it. ({S} is mana from a snow source.) +SVar:TrigEffect:DB$ Effect | RememberObjects$ TriggeredCard | ReplacementEffects$ ETBCreat | SVars$ DBPutP1P1,ToBattlefield,DBExile | References$ ETBCreat,DBPutP1P1,ToBattlefield,DBExile +SVar:ETBCreat:Event$ Moved | ValidCard$ Card.IsRemembered | Destination$ Battlefield | ReplaceWith$ DBPutP1P1 | Description$ That creature enters the battlefield with an additional +1/+1 counter on it. +SVar:DBPutP1P1:DB$ PutCounter | Defined$ ReplacedCard | CounterType$ P1P1 | ETB$ True | CounterNum$ 1 | SubAbility$ ToBattlefield +SVar:ToBattlefield:DB$ InternalEtbReplacement | SubAbility$ DBExile +SVar:DBExile:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile +DeckHints:Type$Snow +DeckHas:Ability$Counters +Oracle:Whenever you cast a creature spell, if {S} of any of that spell’s colors was spent to cast it, that creature enters the battlefield with an additional +1/+1 counter on it. ({S} is mana from a snow source.)