From 1b37bc88795835aa3c16da2d8f6df8a091a136f3 Mon Sep 17 00:00:00 2001 From: jendave Date: Sun, 7 Aug 2011 01:17:59 +0000 Subject: [PATCH] add AEthermage's Touch (from Dissension) --- .gitattributes | 1 + res/cardsfolder/aethermages_touch.txt | 9 +++++++++ src/forge/EndOfTurn.java | 18 ++++++++++++++++++ .../abilityFactory/AbilityFactory_Reveal.java | 16 ++++++++++++++-- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/aethermages_touch.txt diff --git a/.gitattributes b/.gitattributes index ffa02670344..e07f4583004 100644 --- a/.gitattributes +++ b/.gitattributes @@ -172,6 +172,7 @@ res/cardsfolder/aether_tradewinds.txt svneol=native#text/plain res/cardsfolder/aether_vial.txt -text svneol=native#text/plain res/cardsfolder/aether_web.txt -text svneol=native#text/plain res/cardsfolder/aetherflame_wall.txt -text svneol=native#text/plain +res/cardsfolder/aethermages_touch.txt -text svneol=native#text/plain res/cardsfolder/aethersnipe.txt -text svneol=native#text/plain res/cardsfolder/affa_guard_hound.txt -text svneol=native#text/plain res/cardsfolder/afflict.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/aethermages_touch.txt b/res/cardsfolder/aethermages_touch.txt new file mode 100644 index 00000000000..911eb5ac5a9 --- /dev/null +++ b/res/cardsfolder/aethermages_touch.txt @@ -0,0 +1,9 @@ +Name:AEthermage's Touch +ManaCost:2 W U +Types:Instant +Text:no text +A:SP$ Dig | Cost$ 2 W U | DigNum$ 4 | Reveal$ True | ChangeNum$ 1 | Optional$ True | ChangeValid$ Creature | DestinationZone$ Battlefield | Keywords$ HIDDEN At the beginning of your end step, return CARDNAME to its owner's hand.| SpellDescription$ Reveal the top four cards of your library. You may put a creature card from among them onto the battlefield. It has "At the beginning of your end step, return this creature to its owner's hand." Then put the rest of the cards revealed this way on the bottom of your library in any order. +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/aethermages_touch.jpg +End \ No newline at end of file diff --git a/src/forge/EndOfTurn.java b/src/forge/EndOfTurn.java index 23205c23eef..ca16366d594 100644 --- a/src/forge/EndOfTurn.java +++ b/src/forge/EndOfTurn.java @@ -159,6 +159,24 @@ public class EndOfTurn implements java.io.Serializable AllZone.Stack.addSimultaneousStackEntry(change); } + if(c.hasKeyword("At the beginning of your end step, return CARDNAME to its owner's hand.") + && AllZone.Phase.isPlayerTurn(c.getController())) { + final Card source = c; + final SpellAbility change = new Ability(source, "0") { + @Override + public void resolve() { + if(AllZoneUtil.isCardInPlay(source)) { + AllZone.GameAction.moveToHand(source); + } + } + }; + StringBuilder sb = new StringBuilder(); + sb.append(source).append(" - At the beginning of your end step, return CARDNAME to its owner's hand."); + change.setStackDescription(sb.toString()); + + AllZone.Stack.addSimultaneousStackEntry(change); + + } } diff --git a/src/forge/card/abilityFactory/AbilityFactory_Reveal.java b/src/forge/card/abilityFactory/AbilityFactory_Reveal.java index 7695576cf36..9f32f9954ad 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_Reveal.java +++ b/src/forge/card/abilityFactory/AbilityFactory_Reveal.java @@ -3,6 +3,7 @@ package forge.card.abilityFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.Random; +import java.util.Arrays; import javax.swing.JOptionPane; @@ -224,6 +225,10 @@ public class AbilityFactory_Reveal { boolean optional = params.containsKey("Optional"); boolean noMove = params.containsKey("NoMove"); boolean changeAll = false; + ArrayList keywords = new ArrayList(); + if(params.containsKey("Keywords")) { + keywords.addAll(Arrays.asList(params.get("Keywords").split(" & "))); + } if(params.containsKey("ChangeNum")) { if(params.get("ChangeNum").equalsIgnoreCase("All")) changeAll = true; @@ -324,7 +329,10 @@ public class AbilityFactory_Reveal { AllZone.GameAction.moveToLibrary(chosen, libraryPosition); } else { - AllZone.GameAction.moveTo(zone, chosen); + Card c = AllZone.GameAction.moveTo(zone, chosen); + if(destZone1.equals("Battlefield") && !keywords.isEmpty()) { + for(String kw : keywords) c.addExtrinsicKeyword(kw); + } } //AllZone.GameAction.revealToComputer() - for when this exists j++; @@ -372,8 +380,12 @@ public class AbilityFactory_Reveal { for(int i = 0; i < rest.size(); i++) { Card c = rest.get(i); PlayerZone toZone = AllZone.getZone(destZone2, c.getOwner()); - AllZone.GameAction.moveTo(toZone, c); + c = AllZone.GameAction.moveTo(toZone, c); + if(destZone2.equals("Battlefield") && !keywords.isEmpty()) { + for(String kw : keywords) c.addExtrinsicKeyword(kw); + } } + } } }//end if canTarget