From e222c0f7a98cca51a4e964082d8de56f2f0a0759 Mon Sep 17 00:00:00 2001 From: swordshine Date: Fri, 27 Dec 2013 12:59:31 +0000 Subject: [PATCH] - Added Pools of Becoming --- .gitattributes | 2 + forge-gui/res/cardsfolder/g/goldmeadow.txt | 2 +- forge-gui/res/cardsfolder/m/mount_keralia.txt | 2 +- .../res/cardsfolder/p/pools_of_becoming.txt | 15 ++++++++ .../main/java/forge/game/ability/ApiType.java | 1 + .../ability/effects/ChangeZoneAllEffect.java | 5 ++- .../ability/effects/RunSVarAbilityEffect.java | 37 +++++++++++++++++++ 7 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 forge-gui/res/cardsfolder/p/pools_of_becoming.txt create mode 100644 forge-gui/src/main/java/forge/game/ability/effects/RunSVarAbilityEffect.java diff --git a/.gitattributes b/.gitattributes index 632ccfcbb2b..98520d19818 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8638,6 +8638,7 @@ forge-gui/res/cardsfolder/p/ponder.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/pongify.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/pontiff_of_blight.txt -text forge-gui/res/cardsfolder/p/pooling_venom.txt svneol=native#text/plain +forge-gui/res/cardsfolder/p/pools_of_becoming.txt -text forge-gui/res/cardsfolder/p/porcelain_legionnaire.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/porphyry_nodes.txt svneol=native#text/plain forge-gui/res/cardsfolder/p/port_inspector.txt svneol=native#text/plain @@ -14956,6 +14957,7 @@ forge-gui/src/main/java/forge/game/ability/effects/RestartGameEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/RevealEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/RevealHandEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/RollPlanarDiceEffect.java -text +forge-gui/src/main/java/forge/game/ability/effects/RunSVarAbilityEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/SacrificeAllEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/SacrificeEffect.java -text forge-gui/src/main/java/forge/game/ability/effects/ScryEffect.java -text diff --git a/forge-gui/res/cardsfolder/g/goldmeadow.txt b/forge-gui/res/cardsfolder/g/goldmeadow.txt index 576a5940926..204d29b773f 100644 --- a/forge-gui/res/cardsfolder/g/goldmeadow.txt +++ b/forge-gui/res/cardsfolder/g/goldmeadow.txt @@ -4,7 +4,7 @@ Types:Plane Lorwyn T:Mode$ ChangesZone | ValidCard$ Land | Destination$ Battlefield | Execute$ TripleGoat | TriggerZones$ Command | TriggerDescription$ Whenever a land enters the battlefield, that land's controller puts three 0/1 white Goat creature tokens onto the battlefield. SVar:TripleGoat:AB$ Token | Cost$ 0 | TokenName$ Goat | TokenTypes$ Creature,Goat | TokenPower$ 0 | TokenToughness$ 1 | TokenColors$ White | TokenOwner$ TriggeredCardController | TokenImage$ W 0 1 Goat | TokenAmount$ 3 T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll {C}, put a 0/1 white Goat creature token onto the battlefield. -SVar:RolledChaos:AB$ Token | Cost$ 0 | TokenName$ Goat | TokenTypes$ Creature,Goat | TokenPower$ 0 | TokenToughness$ 1 | TokenColors$ White | TokenOwner$ TriggeredPlayer | TokenImage$ W 0 1 Goat | TokenAmount$ 1 +SVar:RolledChaos:AB$ Token | Cost$ 0 | TokenName$ Goat | TokenTypes$ Creature,Goat | TokenPower$ 0 | TokenToughness$ 1 | TokenColors$ White | TokenOwner$ You | TokenImage$ W 0 1 Goat | TokenAmount$ 1 SVar:Picture:http://www.wizards.com/global/images/magic/general/goldmeadow.jpg SVar:AIRollPlanarDieParams:Mode$ Always | LowPriority$ True | MaxRollsPerTurn$ 9 Oracle:Whenever a land enters the battlefield, that land's controller puts three 0/1 white Goat creature tokens onto the battlefield.\nWhenever you roll {C}, put a 0/1 white Goat creature token onto the battlefield. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/m/mount_keralia.txt b/forge-gui/res/cardsfolder/m/mount_keralia.txt index 5031bb43ba8..c60b0a42855 100644 --- a/forge-gui/res/cardsfolder/m/mount_keralia.txt +++ b/forge-gui/res/cardsfolder/m/mount_keralia.txt @@ -6,7 +6,7 @@ SVar:BuildPressure:AB$ PutCounter | Cost$ 0 | Defined$ Self | CounterType$ PRESS T:Mode$ PlaneswalkedFrom | ValidCard$ Plane.Self | Execute$ Eruption | TriggerDescription$ When you planeswalk away from CARDNAME, it deals damage equal to the number of pressure counters on it to each creature and each planeswalker. SVar:Eruption:AB$ DamageAll | Cost$ 0 | ValidCards$ Creature,Planeswalker | ValidDescription$ each creature and each planeswalker. | NumDmg$ KeraliaX | References$ KeraliaX T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll {C}, prevent all damage that planes named CARDNAME would deal this game to permanents you control. -SVar:RolledChaos:AB$ Effect | Cost$ 0 | Name$ Mount Keralia Effect | StaticAbilities$ KeraliaProtection | EffectOwner$ TriggeredPlayer | Duration$ Permanent | SpellDescription$ Prevent all damage that planes named CARDNAME would deal this game to permanents you control. +SVar:RolledChaos:AB$ Effect | Cost$ 0 | Name$ Mount Keralia Effect | StaticAbilities$ KeraliaProtection | EffectOwner$ You | Duration$ Permanent | SpellDescription$ Prevent all damage that planes named CARDNAME would deal this game to permanents you control. SVar:KeraliaProtection:Mode$ PreventDamage | EffectZone$ Command | Target$ Permanent.YouCtrl | Source$ Plane.namedMount Keralia | Description$ Prevent all damage that planes named Mount Keralia would deal this game to permanents you control. SVar:KeraliaX:TriggeredSource$CardCounters.PRESSURE SVar:AIRollPlanarDieParams:Mode$ Always | LowPriority$ True diff --git a/forge-gui/res/cardsfolder/p/pools_of_becoming.txt b/forge-gui/res/cardsfolder/p/pools_of_becoming.txt new file mode 100644 index 00000000000..6e9c458b6da --- /dev/null +++ b/forge-gui/res/cardsfolder/p/pools_of_becoming.txt @@ -0,0 +1,15 @@ +Name:Pools of Becoming +ManaCost:no cost +Types:Plane Bolas's Meditation Realm +T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Command | Execute$ TrigChangeZone | TriggerDescription$ At the beginning of your end step, put the cards in your hand on the bottom of your library in any order, then draw that many cards. +SVar:TrigChangeZone:AB$ ChangeZoneAll | Cost$ 0 | ChangeType$ Card.YouOwn | Origin$ Hand | Destination$ Library | LibraryPosition$ -1 | RememberChanged$ True | SubAbility$ DBDraw +SVar:DBDraw:DB$ Draw | NumCards$ Y | References$ Y | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:Y:Remembered$Amount +T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ RolledChaos | TriggerDescription$ Whenever you roll {C}, reveal the top three cards of your planar deck. Each of the revealed cards' {C} abilities triggers. Then put the revealed cards on the bottom of your planar deck in any order. +SVar:RolledChaos:AB$ Dig | Cost$ 0 | DigNum$ 3 | NoMove$ True | Reveal$ True | SourceZone$ PlanarDeck | RememberRevealed$ True | SubAbility$ DBRunChaos +SVar:DBRunChaos:DB$ RunSVarAbility | Defined$ Remembered | SVars$ RolledChaos | IsTrigger$ True | SubAbility$ DBChangeZone +SVar:DBChangeZone:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ PlanarDeck | Destination$ PlanarDeck | LibraryPosition$ -1 | SubAbility$ DBCleanup +SVar:Picture:http://www.wizards.com/global/images/magic/general/pools_of_becoming.jpg +SVar:AIRollPlanarDieParams:Mode$ Always +Oracle:At the beginning of your end step, put the cards in your hand on the bottom of your library in any order, then draw that many cards.\nWhenever you roll {C}, reveal the top three cards of your planar deck. Each of the revealed cards' {C} abilities triggers. Then put the revealed cards on the bottom of your planar deck in any order. diff --git a/forge-gui/src/main/java/forge/game/ability/ApiType.java b/forge-gui/src/main/java/forge/game/ability/ApiType.java index cba31ab531d..67e04ad14f9 100644 --- a/forge-gui/src/main/java/forge/game/ability/ApiType.java +++ b/forge-gui/src/main/java/forge/game/ability/ApiType.java @@ -108,6 +108,7 @@ public enum ApiType { Reveal (RevealEffect.class, RevealAi.class), RevealHand (RevealHandEffect.class, RevealHandAi.class), RollPlanarDice (RollPlanarDiceEffect.class, RollPlanarDiceAi.class), + RunSVarAbility (RunSVarAbilityEffect.class, AlwaysPlayAi.class), Sacrifice (SacrificeEffect.class, SacrificeAi.class), SacrificeAll (SacrificeAllEffect.class, SacrificeAllAi.class), Scry (ScryEffect.class, ScryAi.class), diff --git a/forge-gui/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java b/forge-gui/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java index be4f3ddd0c3..9ee1fe2c21e 100644 --- a/forge-gui/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java +++ b/forge-gui/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java @@ -85,7 +85,8 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect { final int libraryPos = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : 0; - if (destination.equals(ZoneType.Library) && !sa.hasParam("Shuffle") && cards.size() >= 2 && !random) { + if ((destination == ZoneType.Library || destination == ZoneType.PlanarDeck) + && !sa.hasParam("Shuffle") && cards.size() >= 2 && !random) { cards = sa.getActivatingPlayer().getController().orderMoveToZoneList(cards, destination); } @@ -94,7 +95,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect { } for (final Card c : cards) { - if (destination.equals(ZoneType.Battlefield)) { + if (destination == ZoneType.Battlefield) { // Auras without Candidates stay in their current location if (c.isAura()) { final SpellAbility saAura = AttachEffect.getAttachSpellAbility(c); diff --git a/forge-gui/src/main/java/forge/game/ability/effects/RunSVarAbilityEffect.java b/forge-gui/src/main/java/forge/game/ability/effects/RunSVarAbilityEffect.java new file mode 100644 index 00000000000..ca163ea2b19 --- /dev/null +++ b/forge-gui/src/main/java/forge/game/ability/effects/RunSVarAbilityEffect.java @@ -0,0 +1,37 @@ +package forge.game.ability.effects; + +import java.util.ArrayList; +import java.util.List; +import forge.game.ability.AbilityFactory; +import forge.game.ability.SpellAbilityEffect; +import forge.game.card.Card; +import forge.game.spellability.SpellAbility; + +public class RunSVarAbilityEffect extends SpellAbilityEffect { + + /* (non-Javadoc) + * @see forge.card.abilityfactory.SpellEffect#resolve(forge.card.spellability.SpellAbility) + */ + @Override + public void resolve(SpellAbility sa) { + String sVars = sa.getParam("SVars"); + List cards = getTargetCards(sa); + if (sVars == null || cards.isEmpty()) { + return; + } + List validSA = new ArrayList(); + final boolean isTrigger = sa.hasParam("IsTrigger"); + for (final Card tgtC : cards) { + if (!tgtC.hasSVar(sVars)) { + continue; + } + final SpellAbility actualSA = AbilityFactory.getAbility(tgtC.getSVar(sVars), tgtC); + actualSA.setTrigger(isTrigger); + actualSA.setActivatingPlayer(sa.getActivatingPlayer()); + actualSA.setDescription(tgtC.getName() + "'s ability"); + validSA.add(actualSA); + } + sa.getActivatingPlayer().getController().orderAndPlaySimultaneousSa(validSA); + + } +}