From 4cd6fca6d1cc2e27bbfcbfffa046b653f9b4520c Mon Sep 17 00:00:00 2001 From: Lyu Zong-Hong Date: Tue, 19 Jan 2021 22:35:41 +0900 Subject: [PATCH] Implement Ice Cauldron --- .../forge/game/ability/effects/ManaEffect.java | 17 +++++++++++++---- forge-gui/res/cardsfolder/i/ice_cauldron.txt | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 forge-gui/res/cardsfolder/i/ice_cauldron.txt diff --git a/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java index 56ad0850a19..c452d8c1e34 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ManaEffect.java @@ -181,12 +181,21 @@ public class ManaEffect extends SpellAbilityEffect { } abMana.setExpressChoice(sb.toString().trim()); } else if (type.equals("LastNotedType")) { - Mana manaType = (Mana) Iterables.getFirst(card.getRemembered(), null); - if (manaType == null) { + final StringBuilder sb = new StringBuilder(); + int nMana = 0; + for (Object o : card.getRemembered()) { + if (o instanceof Mana) { + if (nMana > 0) { + sb.append(" "); + } + sb.append(o.toString()); + nMana++; + } + } + if (nMana == 0) { return; } - String cs = manaType.toString(); - abMana.setExpressChoice(cs); + abMana.setExpressChoice(sb.toString()); } else if (type.startsWith("EachColorAmong")) { final String res = type.split("_")[1]; final CardCollection list = CardLists.getValidCards(card.getGame().getCardsIn(ZoneType.Battlefield), diff --git a/forge-gui/res/cardsfolder/i/ice_cauldron.txt b/forge-gui/res/cardsfolder/i/ice_cauldron.txt new file mode 100644 index 00000000000..f6ab7bfa0be --- /dev/null +++ b/forge-gui/res/cardsfolder/i/ice_cauldron.txt @@ -0,0 +1,16 @@ +Name:Ice Cauldron +ManaCost:4 +Types:Artifact +A:AB$ PutCounter | Cost$ X T | RememberCostMana$ True | CounterType$ CHARGE | CounterNum$ 1 | CheckSVar$ Y | SVarCompare$ EQ0 | References$ X,Y | SubAbility$ DBExile | SpellDescription$ You may exile a nonland card from your hand. You may cast that card for as long as it remains exiled. Put a charge counter on CARDNAME and note the type and amount of mana spent to pay this activation cost. Activate this ability only if there are no charge counters on CARDNAME. +SVar:X:Count$xPaid +SVar:Y:Count$CardCounters.CHARGE +SVar:DBExile:DB$ ChangeZone | Optional$ True | RememberChanged$ True | Origin$ Hand | Destination$ Exile | ChangeType$ Card.nonLand | ChangeNum$ 1 | SubAbility$ DBEffect +SVar:DBEffect:DB$ Effect | StaticAbilities$ STPlay | RememberObjects$ Remembered | Duration$ Permanent | ForgetOnMoved$ Exile +SVar:STPlay:Mode$ Continuous | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile +T:Mode$ ChangesZone | ValidCard$ Card.IsRemembered+ExiledWithSource | Origin$ Exile | Destination$ Any | Execute$ ForgetCard | Static$ True +SVar:ForgetCard:DB$ Cleanup | ForgetDefined$ TriggeredCard +T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | Static$ True | ValidCard$ Card.Self | Execute$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +A:AB$ Mana | Cost$ T SubCounter<1/CHARGE> | Produced$ Special LastNotedType | RestrictValid$ Card.IsRemembered | SpellDescription$ Add CARDNAME's last noted type and amount of mana. Spend this mana only to cast the last card exiled with CARDNAME. +AI:RemoveDeck:All +Oracle:{X}, {T}: You may exile a nonland card from your hand. You may cast that card for as long as it remains exiled. Put a charge counter on Ice Cauldron and note the type and amount of mana spent to pay this activation cost. Activate this ability only if there are no charge counters on Ice Cauldron.\n{T}, Remove a charge counter from Ice Cauldron: Add Ice Cauldron's last noted type and amount of mana. Spend this mana only to cast the last card exiled with Ice Cauldron.