diff --git a/.gitattributes b/.gitattributes index 6de7d2da4ab..8959ece0c0f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -890,6 +890,7 @@ res/cardsfolder/cloak_of_feathers.txt -text svneol=native#text/plain res/cardsfolder/cloak_of_mists.txt -text svneol=native#text/plain res/cardsfolder/clock_of_omens.txt -text svneol=native#text/plain res/cardsfolder/clockwork_gnomes.txt -text svneol=native#text/plain +res/cardsfolder/clone.txt -text svneol=native#text/plain res/cardsfolder/close_quarters.txt -text svneol=native#text/plain res/cardsfolder/cloud_crusader.txt -text svneol=native#text/plain res/cardsfolder/cloud_djinn.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/clone.txt b/res/cardsfolder/clone.txt new file mode 100644 index 00000000000..d659c076ebd --- /dev/null +++ b/res/cardsfolder/clone.txt @@ -0,0 +1,8 @@ +Name:Clone +ManaCost:3 U +Types:Creature Shapeshifter +Text:You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield. +PT:0/0 +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/clone.jpg +End diff --git a/src/forge/Card.java b/src/forge/Card.java index 70720e2c076..cb0c46dec44 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -139,6 +139,7 @@ public class Card extends MyObservable { private String namedCard = ""; private String topCardName = ""; private String reflectableMana = ""; + private String cloneOrigin = ""; private ArrayList gainControlTargets = new ArrayList(); private ArrayList gainControlReleaseCommands = new ArrayList();; @@ -308,7 +309,15 @@ public class Card extends MyObservable { public boolean getSirenAttackOrDestroy() { return sirenAttackOrDestroy; - } + } + + public String getCloneOrigin() { + return cloneOrigin; + } + + public void setCloneOrigin(String name) { + cloneOrigin = name; + } public boolean getSacrificeAtEOT() { return sacrificeAtEOT || getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME."); diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index d466da0ee01..55fab1b31e6 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -13335,6 +13335,71 @@ public class CardFactory_Creatures { card.addComesIntoPlayCommand(comesIntoPlay); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Clone")) { + final CardFactory cfact = cf; + final Card[] copyTarget = new Card[1]; + final Card[] cloned = new Card[1]; + + final SpellAbility copyBack = new Ability(card, "0") { + @Override + public void resolve() { + Card orig = cfact.getCard(cloned[0].getCloneOrigin(), card.getController()); + PlayerZone dest = AllZone.getZone(cloned[0]); + AllZone.GameAction.moveTo(dest, orig); + dest.remove(cloned[0]); + } + };//SpellAbility + + final Command leaves = new Command() { + private static final long serialVersionUID = 8590474793502538215L; + + public void execute() { + StringBuilder sb = new StringBuilder(); + sb.append(card.getName()).append(" - reverting "+cloned[0].getName()+" to "+card.getName()+"."); + copyBack.setStackDescription(sb.toString()); + + AllZone.Stack.add(copyBack); + + } + }; + + final SpellAbility copy = new Spell(card) { + private static final long serialVersionUID = 4496978456522751302L; + + @Override + public void resolve() { + cloned[0] = cfact.getCard(copyTarget[0].getName(), card.getController()); + cloned[0].setCloneOrigin(card.getName()); + cloned[0].addLeavesPlayCommand(leaves); + PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); + play.add(cloned[0]); + } + };//SpellAbility + + Input runtime = new Input() { + private static final long serialVersionUID = 7615038074569687330L; + + @Override + public void showMessage() { + AllZone.Display.showMessage(cardName+" - Select a creature on the battlefield"); + } + + @Override + public void selectCard(Card c, PlayerZone z) { + if( z.is(Constant.Zone.Battlefield) && c.isCreature()) { + copyTarget[0] = c; + stopSetNext(new Input_PayManaCost(copy)); + } + } + }; + card.clearSpellAbility(); + card.addSpellAbility(copy); + copy.setStackDescription(cardName+" - enters the battlefield as a copy of selected card."); + copy.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + if(hasKeyword(card, "Level up") != -1 && hasKeyword(card, "maxLevel") != -1) {