From 94fc6239e14c34cc3b0fbe5b16246e3677e9a963 Mon Sep 17 00:00:00 2001 From: swordshine Date: Tue, 30 Apr 2013 05:53:44 +0000 Subject: [PATCH] - Added Possibility Storm and Rhystic Lightning --- .gitattributes | 2 ++ res/cardsfolder/p/possibility_storm.txt | 12 ++++++++++++ res/cardsfolder/r/rhystic_lightning.txt | 13 +++++++++++++ src/main/java/forge/Card.java | 7 +++---- .../card/ability/effects/ChangeZoneAllEffect.java | 11 ++++++++++- .../forge/card/ability/effects/DigUntilEffect.java | 5 +++++ 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 res/cardsfolder/p/possibility_storm.txt create mode 100644 res/cardsfolder/r/rhystic_lightning.txt diff --git a/.gitattributes b/.gitattributes index 65c7f99f42c..f56b9399394 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8077,6 +8077,7 @@ res/cardsfolder/p/possessed_barbarian.txt svneol=native#text/plain res/cardsfolder/p/possessed_centaur.txt svneol=native#text/plain res/cardsfolder/p/possessed_nomad.txt svneol=native#text/plain res/cardsfolder/p/possessed_portal.txt -text +res/cardsfolder/p/possibility_storm.txt -text res/cardsfolder/p/postmortem_lunge.txt svneol=native#text/plain res/cardsfolder/p/poultice_sliver.txt svneol=native#text/plain res/cardsfolder/p/pouncing_jaguar.txt svneol=native#text/plain @@ -8769,6 +8770,7 @@ res/cardsfolder/r/rhys_the_redeemed.txt svneol=native#text/plain res/cardsfolder/r/rhystic_cave.txt -text res/cardsfolder/r/rhystic_circle.txt -text res/cardsfolder/r/rhystic_deluge.txt svneol=native#text/plain +res/cardsfolder/r/rhystic_lightning.txt -text res/cardsfolder/r/rhystic_scrying.txt -text res/cardsfolder/r/rhystic_shield.txt -text res/cardsfolder/r/rhystic_study.txt svneol=native#text/plain diff --git a/res/cardsfolder/p/possibility_storm.txt b/res/cardsfolder/p/possibility_storm.txt new file mode 100644 index 00000000000..c1f6d3f371f --- /dev/null +++ b/res/cardsfolder/p/possibility_storm.txt @@ -0,0 +1,12 @@ +Name:Possibility Storm +ManaCost:3 R R +Types:Enchantment +T:Mode$ SpellCast | ValidCard$ Card.wasCastFromHand | Execute$ TrigExileSpell | TriggerZones$ Battlefield | TriggerDescription$ Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from the top of his or her library until he or she exiles a card that shares a card type with it. That player may cast that card without paying its mana cost. Then he or she puts all cards exiled with CARDNAME on the bottom of his or her library in a random order. +SVar:TrigExileSpell:AB$ ChangeZone | Cost$ 0 | Defined$ TriggeredCard | Origin$ Stack | Destination$ Exile | Fizzle$ True | SubAbility$ DBDig | Imprint$ True +SVar:DBDig:DB$ DigUntil | Defined$ TriggeredCardController | Valid$ Card.sharesTypeWith FirstImprinted | ValidDescription$ shares a card type with exiled card | FoundDestination$ Exile | RevealedDestination$ Exile | RememberFound$ True | ImprintRevealed$ True | SubAbility$ DBPlay +SVar:DBPlay:DB$ Play | Defined$ Remembered | Controller$ RememberedController | WithoutManaCost$ True | Optional$ True | SubAbility$ DBChangeZone +SVar:DBChangeZone:DB$ ChangeZoneAll | Origin$ Exile | ChangeType$ Card.IsRemembered,Card.IsImprinted | Destination$ Library | LibraryPosition$ -1 | RandomOrder$ True | SubAbility$ DBPossibilityCleanup +SVar:DBPossibilityCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True +SVar:Picture:http://www.wizards.com/global/images/magic/general/possibility_storm.jpg +Oracle:Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from the top of his or her library until he or she exiles a card that shares a card type with it. That player may cast that card without paying its mana cost. Then he or she puts all cards exiled with Possibility Storm on the bottom of his or her library in a random order. +SetInfo:DGM Rare \ No newline at end of file diff --git a/res/cardsfolder/r/rhystic_lightning.txt b/res/cardsfolder/r/rhystic_lightning.txt new file mode 100644 index 00000000000..78f5e97003c --- /dev/null +++ b/res/cardsfolder/r/rhystic_lightning.txt @@ -0,0 +1,13 @@ +Name:Rhystic Lightning +ManaCost:2 R +Types:Instant +A:SP$ StoreSVar | Cost$ 2 R | SVar$ RhysticPaid | Type$ Number | Expression$ 0 | UnlessPayer$ Targeted | UnlessCost$ 2 | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | ConditionDefined$ Targeted | ConditionPresent$ Creature | ConditionCompare$ EQ0 | SubAbility$ DBStore2 | SpellDescription$ CARDNAME deals 4 damage to target creature or player unless that creature's controller or that player pays 2. If he or she does, CARDNAME deals 2 damage to the creature or player. +SVar:DBStore2:DB$ StoreSVar | SVar$ RhysticPaid | Type$ Number | Expression$ 0 | UnlessPayer$ TargetedController | UnlessCost$ 2 | ConditionDefined$ Targeted | ConditionPresent$ Creature | ConditionCompare$ GE1 | SubAbility$ DBDmg +SVar:DBDmg:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | References$ X,RhysticPaid | SubAbility$ DBReset +SVar:DBReset:DB$ StoreSVar | SVar$ RhysticPaid | Type$ Number | Expression$ 1 +SVar:RhysticPaid:Number$1 +SVar:X:Count$Compare RhysticPaid EQ1.2.4 +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/rhystic_lightning.jpg +Oracle:Rhystic Lightning deals 4 damage to target creature or player unless that creature's controller or that player pays {2}. If he or she does, Rhystic Lightning deals 2 damage to the creature or player. +SetInfo:PCY Common \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 4ed77b7583e..f3b2777a378 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -5536,10 +5536,9 @@ public class Card extends GameEntity implements Comparable { } } } else if (property.substring(10).equals("Enchanted")) { - for (final Card card : source.getEnchantedBy()) { - if (!this.equippedBy.contains(card)) { - return false; - } + if (source.getEnchantingCard() == null || + !this.equippedBy.contains(source.getEnchantingCard())) { + return false; } } else { if (!this.equippedBy.contains(source)) { diff --git a/src/main/java/forge/card/ability/effects/ChangeZoneAllEffect.java b/src/main/java/forge/card/ability/effects/ChangeZoneAllEffect.java index c6757debb74..ad02b1fef87 100644 --- a/src/main/java/forge/card/ability/effects/ChangeZoneAllEffect.java +++ b/src/main/java/forge/card/ability/effects/ChangeZoneAllEffect.java @@ -1,7 +1,9 @@ package forge.card.ability.effects; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Random; import com.google.common.collect.Iterables; @@ -15,6 +17,7 @@ import forge.game.GameState; import forge.game.player.Player; import forge.game.zone.ZoneType; import forge.gui.GuiChoose; +import forge.util.MyRandom; public class ChangeZoneAllEffect extends SpellAbilityEffect { @@ -59,14 +62,20 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect { final String remember = sa.getParam("RememberChanged"); final String forget = sa.getParam("ForgetChanged"); final String imprint = sa.getParam("Imprint"); + final boolean random = sa.hasParam("RandomOrder"); final int libraryPos = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : 0; if (sa.getActivatingPlayer().isHuman() && destination.equals(ZoneType.Library) && !sa.hasParam("Shuffle") - && cards.size() >= 2) { + && cards.size() >= 2 && !random) { cards = GuiChoose.order("Choose order of cards to put into the library", "Put first", 0, cards, null, null); } + if (destination.equals(ZoneType.Library) && random) { + final Random ran = MyRandom.getRandom(); + Collections.shuffle(cards, ran); + } + for (final Card c : cards) { if (destination.equals(ZoneType.Battlefield)) { // Auras without Candidates stay in their current location diff --git a/src/main/java/forge/card/ability/effects/DigUntilEffect.java b/src/main/java/forge/card/ability/effects/DigUntilEffect.java index cbd1f0e8e72..fae2b14a05c 100644 --- a/src/main/java/forge/card/ability/effects/DigUntilEffect.java +++ b/src/main/java/forge/card/ability/effects/DigUntilEffect.java @@ -148,6 +148,11 @@ public class DigUntilEffect extends SpellAbilityEffect { host.addRemembered(c); } } + if (sa.hasParam("ImprintRevealed")) { + for (final Card c : revealed) { + host.addImprinted(c); + } + } // TODO Use getOrderChoices before this moveTo call for the Human final Iterator itr = revealed.iterator();