diff --git a/res/cardsfolder/boggart_harbinger.txt b/res/cardsfolder/boggart_harbinger.txt index d8324c81515..dbd2b7321f0 100644 --- a/res/cardsfolder/boggart_harbinger.txt +++ b/res/cardsfolder/boggart_harbinger.txt @@ -1,8 +1,10 @@ Name:Boggart Harbinger ManaCost:2 B Types:Creature Goblin Shaman -Text:When Boggart Harbinger enters the battlefield, you may search your library for a Goblin card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:2/1 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Goblin card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Goblin | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/boggart_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/102.jpg diff --git a/res/cardsfolder/elvish_harbinger.txt b/res/cardsfolder/elvish_harbinger.txt index 606dca2655f..9a9baeb66d1 100644 --- a/res/cardsfolder/elvish_harbinger.txt +++ b/res/cardsfolder/elvish_harbinger.txt @@ -1,13 +1,15 @@ Name:Elvish Harbinger ManaCost:2 G Types:Creature Elf Druid -Text:When Elvish Harbinger enters the battlefield, you may search your library for an Elf card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:1/2 -A:AB$Mana|Cost$T|Produced$W|SpellDescription$Add W to your mana pool. -A:AB$Mana|Cost$T|Produced$B|SpellDescription$Add B to your mana pool. -A:AB$Mana|Cost$T|Produced$U|SpellDescription$Add U to your mana pool. -A:AB$Mana|Cost$T|Produced$R|SpellDescription$Add R to your mana pool. -A:AB$Mana|Cost$T|Produced$G|SpellDescription$Add G to your mana pool. +A:AB$Mana | Cost$T | Produced$W | SpellDescription$Add W to your mana pool. +A:AB$Mana | Cost$T | Produced$B | SpellDescription$Add B to your mana pool. +A:AB$Mana | Cost$T | Produced$U | SpellDescription$Add U to your mana pool. +A:AB$Mana | Cost$T | Produced$R | SpellDescription$Add R to your mana pool. +A:AB$Mana | Cost$T | Produced$G | SpellDescription$Add G to your mana pool. +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for an Elf card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Elf | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/elvish_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/207.jpg diff --git a/res/cardsfolder/faerie_harbinger.txt b/res/cardsfolder/faerie_harbinger.txt index 477e08f9b92..a2baf28d27e 100644 --- a/res/cardsfolder/faerie_harbinger.txt +++ b/res/cardsfolder/faerie_harbinger.txt @@ -1,10 +1,12 @@ Name:Faerie Harbinger ManaCost:3 U Types:Creature Faerie Wizard -Text:When Faerie Harbinger enters the battlefield, you may search your library for a Faerie card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:2/2 K:Flying K:Flash +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Merfolk card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Merfolk | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/faerie_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/61.jpg diff --git a/res/cardsfolder/flamekin_harbinger.txt b/res/cardsfolder/flamekin_harbinger.txt index 8d7815f1f17..3107739546d 100644 --- a/res/cardsfolder/flamekin_harbinger.txt +++ b/res/cardsfolder/flamekin_harbinger.txt @@ -1,8 +1,10 @@ Name:Flamekin Harbinger ManaCost:R Types:Creature Elemental Shaman -Text:When Flamekin Harbinger enters the battlefield, you may search your library for an Elemental card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:1/1 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Elemental card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Elemental | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/flamekin_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/167.jpg diff --git a/res/cardsfolder/giant_harbinger.txt b/res/cardsfolder/giant_harbinger.txt index 0fd3600e80f..535817fb735 100644 --- a/res/cardsfolder/giant_harbinger.txt +++ b/res/cardsfolder/giant_harbinger.txt @@ -1,8 +1,10 @@ Name:Giant Harbinger ManaCost:4 R Types:Creature Giant -Text:When Giant Harbinger enters the battlefield, you may search your library for a Giant card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:3/4 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Giant card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Giant | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/giant_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/169.jpg diff --git a/res/cardsfolder/kithkin_harbinger.txt b/res/cardsfolder/kithkin_harbinger.txt index ea741742aaf..ced74d756e2 100644 --- a/res/cardsfolder/kithkin_harbinger.txt +++ b/res/cardsfolder/kithkin_harbinger.txt @@ -1,8 +1,10 @@ Name:Kithkin Harbinger ManaCost:2 W Types:Creature Kithkin Wizard -Text:When CARDNAME enters the battlefield, you may search your library for a Kithkin card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:1/3 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Goblin card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Kithkin | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/kithkin_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/26.jpg diff --git a/res/cardsfolder/merrow_harbinger.txt b/res/cardsfolder/merrow_harbinger.txt index 1610b7b628c..6711130d655 100644 --- a/res/cardsfolder/merrow_harbinger.txt +++ b/res/cardsfolder/merrow_harbinger.txt @@ -1,9 +1,11 @@ Name:Merrow Harbinger ManaCost:3 U Types:Creature Merfolk Wizard -Text:When Merrow Harbinger enters the battlefield, you may search your library for a Merfolk card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:2/3 K:Islandwalk +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Merfolk card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Merfolk | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/merrow_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/73.jpg diff --git a/res/cardsfolder/treefolk_harbinger.txt b/res/cardsfolder/treefolk_harbinger.txt index 6cded52212c..acec1d85547 100644 --- a/res/cardsfolder/treefolk_harbinger.txt +++ b/res/cardsfolder/treefolk_harbinger.txt @@ -1,8 +1,10 @@ Name:Treefolk Harbinger ManaCost:G Types:Creature Treefolk Druid -Text:When CARDNAME enters the battlefield, you may search your library for a Treefolk or Forest card, reveal it, then shuffle your library and put that card on top of it. +Text:no text PT:0/3 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a Treefolk or Forest card, reveal it, then shuffle your library and put that card on top of it. +SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Treefolk,Forest | ChangeNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/treefolk_harbinger.jpg SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/239.jpg diff --git a/src/forge/AbilityFactory.java b/src/forge/AbilityFactory.java index 8987ff3b46e..9557a6e3e70 100644 --- a/src/forge/AbilityFactory.java +++ b/src/forge/AbilityFactory.java @@ -710,7 +710,6 @@ public class AbilityFactory { String defined = (def == null) ? "Self" : def; if (defined.equals("Targeted")){ - Target tgt = sa.getTarget(); SpellAbility parent = sa; do{ parent = ((Ability_Sub)parent).getParent(); diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 0d6c154d099..5c0bfe3c129 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -5992,10 +5992,7 @@ public class CardFactory implements NewConstants { final Ability ability1 = new Ability(card, "0") { @Override public void resolve() { - - //String player = card.getController(); PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer); - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); if(hand.size() == 0) return; @@ -6013,9 +6010,7 @@ public class CardFactory implements NewConstants { creatures.toArray()); if(o != null) { Card c = (Card) o; - hand.remove(c); - play.add(c); - c.setSickness(true); + AllZone.Stack.add(c.getSpellPermanent()); } diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index 66a02fe789b..89dc66c29d8 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -968,7 +968,6 @@ public class CardFactoryUtil { */ public static SpellAbility ability_Morph_Down(final Card sourceCard) { - final Player player = sourceCard.getController(); final SpellAbility morph_down = new Spell(sourceCard) { private static final long serialVersionUID = -1438810964807867610L; diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 4b53bd3ad12..f38a61aab30 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -5864,114 +5864,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Kithkin Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 4022442363194287539L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList kithkin = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).isType("Kithkin")) { - kithkin.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(kithkin.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", kithkin.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - kithkin.shuffle(); - ability.setTargetCard(kithkin.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Treefolk Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 9170723718484515120L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList treefolkForests = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if((cards.get(i).getType().contains("Treefolk") || cards.get(i).getKeyword().contains( - "Changeling")) - || cards.get(i).getType().contains("Forest")) { - treefolkForests.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(treefolkForests.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", - treefolkForests.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - treefolkForests.shuffle(); - ability.setTargetCard(treefolkForests.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - //*************** START *********** START ************************** else if(cardName.equals("Knight of the White Orchid")) { final Ability ability = new Ability(card, "0") { @@ -8431,168 +8323,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Boggart Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 4022442363194287539L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList goblins = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Goblin") - || cards.get(i).getKeyword().contains("Changeling")) { - goblins.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(goblins.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", goblins.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - goblins.shuffle(); - ability.setTargetCard(goblins.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Merrow Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 4022442363194287539L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList merfolk = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Merfolk") - || cards.get(i).getKeyword().contains("Changeling")) { - merfolk.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(merfolk.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", merfolk.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - merfolk.shuffle(); - ability.setTargetCard(merfolk.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Elvish Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 4022442363194287539L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList elves = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Elf") - || cards.get(i).getKeyword().contains("Changeling")) { - elves.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(elves.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", elves.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - elves.shuffle(); - ability.setTargetCard(elves.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if(cardName.equals("Vendilion Clique")) { final SpellAbility ability = new Ability(card, "0") { @@ -8652,169 +8382,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Faerie Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - - private static final long serialVersionUID = -708639335039567945L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList faeries = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Faerie") - || cards.get(i).getKeyword().contains("Changeling")) { - faeries.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(faeries.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", faeries.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - faeries.shuffle(); - ability.setTargetCard(faeries.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Flamekin Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = 7114265436722599216L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList ele = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Elemental") - || cards.get(i).getKeyword().contains("Changeling")) { - ele.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(ele.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", ele.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - ele.shuffle(); - ability.setTargetCard(ele.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Giant Harbinger")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void resolve() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) { - Card c = getTargetCard(); - card.getController().shuffle(); - lib.remove(c); - lib.add(c, 0); - if (card.getController().isPlayer(AllZone.ComputerPlayer)) - GuiUtils.getChoiceOptional(card + " - Computer picked:", c); - } - }//resolve() - }; - Command intoPlay = new Command() { - private static final long serialVersionUID = -2671592749882297551L; - - public void execute() { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList giants = new CardList(); - - for(int i = 0; i < cards.size(); i++) { - if(cards.get(i).getType().contains("Giant") - || cards.get(i).getKeyword().contains("Changeling")) { - giants.add(cards.get(i)); - } - } - - Player controller = card.getController(); - - if(giants.size() == 0) return; - - if(controller.equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select target card", giants.toArray()); - if(o != null) { - ability.setTargetCard((Card) o); - AllZone.Stack.add(ability); - } - } else //computer - { - giants.shuffle(); - ability.setTargetCard(giants.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if(cardName.equals("Kor Cartographer")) { final Ability ab1 = new Ability(card, "no cost") { diff --git a/src/forge/CardFactory_Planeswalkers.java b/src/forge/CardFactory_Planeswalkers.java index 91926fa66c5..1366df9dab7 100644 --- a/src/forge/CardFactory_Planeswalkers.java +++ b/src/forge/CardFactory_Planeswalkers.java @@ -1630,7 +1630,6 @@ class CardFactory_Planeswalkers { public void humanResolve() { PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, AllZone.HumanPlayer); CardList putOnTop = new CardList(hand.getCards()); diff --git a/src/forge/CardFactory_Sorceries.java b/src/forge/CardFactory_Sorceries.java index b42134ebe84..5d775f3bb16 100644 --- a/src/forge/CardFactory_Sorceries.java +++ b/src/forge/CardFactory_Sorceries.java @@ -2430,19 +2430,14 @@ public class CardFactory_Sorceries { }//computerResolve() public void resolve(Card selectedCard) { - Player opponent = card.getController().getOpponent(); - PlayerZone library = AllZone.getZone(Constant.Zone.Library, opponent); - + Player opponent = card.getController().getOpponent(); Card c = selectedCard; - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); //need to set controller before adding it to "play" c.setController(card.getController()); c.setSickness(true); - library.remove(c); - play.add(c); - + AllZone.GameAction.moveToPlay(c, card.getController()); opponent.shuffle(); }//resolve() diff --git a/src/forge/ComputerUtil.java b/src/forge/ComputerUtil.java index eac409a4b61..f0c133bd72c 100644 --- a/src/forge/ComputerUtil.java +++ b/src/forge/ComputerUtil.java @@ -2,7 +2,6 @@ package forge; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; -import java.util.HashMap; public class ComputerUtil diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index f8544fbc2c9..f4b5ba75c46 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -223,6 +223,11 @@ public class GameAction { return moveTo(play, c); } + public Card moveToPlay(Card c, Player p) { + PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, p); + return moveTo(play, c); + } + public Card moveToBottomOfLibrary(Card c) { return moveToLibrary(c, -1); } diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 4350bbc45be..09470d8cabc 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -4071,23 +4071,20 @@ public class GameActionUtil { @Override public void resolve() { // should check if Genesis is still there - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); if(player.equals(AllZone.HumanPlayer) && grave.size() > 0) { CardList creatures = AllZoneUtil.getPlayerGraveyard(player); creatures = creatures.filter(creatureFilter); Object creatureChoice = GuiUtils.getChoice("Creature to move to hand", creatures.toArray()); Card creatureCard = (Card) creatureChoice; - graveyard.remove(creatureCard); - hand.add(creatureCard); +; + AllZone.GameAction.moveToHand(creatureCard); //}//end choice="Yes" } else{ //computer resolve CardList compCreatures = AllZoneUtil.getPlayerGraveyard(player); compCreatures = compCreatures.filter(creatureFilter); Card target = CardFactoryUtil.AI_getBestCreature(compCreatures); - graveyard.remove(target); - hand.add(target); + AllZone.GameAction.moveToHand(target); } } }; @@ -7859,7 +7856,6 @@ public class GameActionUtil { @Override public void resolve() { PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); CardList rats = new CardList(lib.getCards()); rats = rats.getType("Rat"); @@ -7870,14 +7866,13 @@ public class GameActionUtil { rats.toArray()); if(o != null) { Card card = (Card) o; - lib.remove(card); - hand.add(card); + + AllZone.GameAction.moveToHand(card); } } else if(player.equals(AllZone.ComputerPlayer)) { Card card = rats.get(0); - lib.remove(card); - hand.add(card); + AllZone.GameAction.moveToHand(card); } player.shuffle(); } @@ -8215,7 +8210,6 @@ public class GameActionUtil { if (player.isHuman()) { Card c = library.get(0); AllZone.GameAction.playCardNoCost(c); - library.remove(c); } // player isComputer() else { @@ -9113,8 +9107,6 @@ public class GameActionUtil { @Override public void resolve() { CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature"); - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); if(graveyardCreatures.size() >= 4) { if(player.equals(AllZone.HumanPlayer)) { @@ -9122,14 +9114,13 @@ public class GameActionUtil { graveyardCreatures.toArray()); if(o != null) { Card card = (Card) o; - graveyard.remove(card); - hand.add(card); + + AllZone.GameAction.moveToHand(card); } } else if(player.equals(AllZone.ComputerPlayer)) { Card card = graveyardCreatures.get(0); - graveyard.remove(card); - hand.add(card); + AllZone.GameAction.moveToHand(card); } } } @@ -9156,7 +9147,6 @@ public class GameActionUtil { @Override public void resolve() { PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); - PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player); CardList creatures = new CardList(graveyard.getCards()); creatures = creatures.getType("Creature"); @@ -9166,14 +9156,12 @@ public class GameActionUtil { creatures.toArray()); if(o != null) { Card card = (Card) o; - graveyard.remove(card); - playZone.add(card); + + AllZone.GameAction.moveToPlay(card); } } else if(player.equals(AllZone.ComputerPlayer)) { Card card = creatures.get(0); - graveyard.remove(card); - playZone.add(card); - + AllZone.GameAction.moveToPlay(card); } } @@ -9186,7 +9174,6 @@ public class GameActionUtil { private static void upkeep_Nether_Spirit() { final Player player = AllZone.Phase.getPlayerTurn(); final PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); - final PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player); CardList all = new CardList(graveyard.getCards()); all = all.getType("Creature"); @@ -9199,8 +9186,7 @@ public class GameActionUtil { Ability ability = new Ability(list.get(0), "0") { @Override public void resolve() { - graveyard.remove(nether); - playZone.add(nether); + AllZone.GameAction.moveToHand(nether); } }; @@ -9507,8 +9493,6 @@ public class GameActionUtil { @Override public void resolve() { CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature"); - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); if(AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) { if(player.equals(AllZone.HumanPlayer)) { @@ -9516,14 +9500,14 @@ public class GameActionUtil { graveyardCreatures.toArray()); if(o != null) { Card card = (Card) o; - graveyard.remove(card); - hand.add(card); + + AllZone.GameAction.moveToHand(card); } } else if(player.equals(AllZone.ComputerPlayer)) { Card card = graveyardCreatures.get(0); - graveyard.remove(card); - hand.add(card); + + AllZone.GameAction.moveToHand(card); } } } @@ -10320,6 +10304,7 @@ public class GameActionUtil { }//upkeep_Shapeshifter private static void upkeep_Vesuvan_Doppelganger_Keyword() { + // todo: what about enchantments? i dont know how great this solution is final Player player = AllZone.Phase.getPlayerTurn(); final String keyword = "At the beginning of your upkeep, you may have this creature become a copy of target creature except it doesn't copy that creature's color. If you do, this creature gains this ability."; CardList list = AllZoneUtil.getPlayerCardsInPlay(player); diff --git a/src/forge/PlayerZone_ComesIntoPlay.java b/src/forge/PlayerZone_ComesIntoPlay.java index 890583091be..2425d6c1d35 100644 --- a/src/forge/PlayerZone_ComesIntoPlay.java +++ b/src/forge/PlayerZone_ComesIntoPlay.java @@ -328,7 +328,6 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone { } PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, c.getController()); CardList meek = new CardList(grave.getCards()); meek = meek.getName("Sword of the Meek"); @@ -338,7 +337,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone { final Card crd = meek.get(i); final Card creat = c; final PlayerZone graveZone = grave; - final PlayerZone playZone = play; + Ability ability = new Ability(meek.get(i), "0") { @Override public void resolve() { @@ -347,8 +346,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone { if(AllZone.GameAction.isCardInZone(crd, graveZone) && AllZone.GameAction.isCardInPlay(creat) && creat.isCreature() && creat.getNetAttack() == 1 && creat.getNetDefense() == 1) { - graveZone.remove(crd); - playZone.add(crd); + AllZone.GameAction.moveToPlay(crd); crd.equipCard(creat); } @@ -359,8 +357,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone { if(AllZone.GameAction.isCardInZone(crd, graveZone) && AllZone.GameAction.isCardInPlay(creat) && creat.isCreature() && creat.getNetAttack() == 1 && creat.getNetDefense() == 1) { - graveZone.remove(crd); - playZone.add(crd); + AllZone.GameAction.moveToPlay(crd); crd.equipCard(creat); } diff --git a/src/forge/SpellAbility_Requirements.java b/src/forge/SpellAbility_Requirements.java index 195a54d48f5..a1a5196fa41 100644 --- a/src/forge/SpellAbility_Requirements.java +++ b/src/forge/SpellAbility_Requirements.java @@ -48,8 +48,8 @@ public class SpellAbility_Requirements { // cancel ability during target choosing Card c = ability.getSourceCard(); if (bCasting && !c.isCopiedSpell()){ // and not a copy - // add back to hand - AllZone.GameAction.moveToHand(c); + // add back to where it came from + AllZone.GameAction.moveTo(fromZone, c); } select.resetTargets(); @@ -78,8 +78,8 @@ public class SpellAbility_Requirements { else if (payment.isCanceled()){ Card c = ability.getSourceCard(); if (bCasting && !c.isCopiedSpell()){ // and not a copy - // add back to hand - AllZone.GameAction.moveToHand(c); + // add back to Previous Zone + AllZone.GameAction.moveTo(fromZone, c); } if (select != null)