diff --git a/res/cardsfolder/obsidian_fireheart.txt b/res/cardsfolder/obsidian_fireheart.txt index b97d7d2d672..3eef51a536a 100644 --- a/res/cardsfolder/obsidian_fireheart.txt +++ b/res/cardsfolder/obsidian_fireheart.txt @@ -3,6 +3,7 @@ ManaCost:1 R R R Types:Creature Elemental Text:no text PT:4/4 +A:AB$ PutCounter | Cost$ 1 R R | IsCurse$ True | ValidTgts$ Land.countersEQ0BLAZE | TgtPrompt$ Select target Land without a Blaze Counter | CounterType$ BLAZE | CounterNum$ 1 | SpellDescription$ Put a blaze counter on target land without a blaze counter on it. For as long as that land has a blaze counter on it, it has "At the beginning of your upkeep, this land deals 1 damage to you." (The land continues to burn after Obsidian Fireheart has left the battlefield.) SVar:Rarity:Mythic SVar:Picture:http://www.wizards.com/global/images/magic/general/obsidian_fireheart.jpg SetInfo:ZEN|Mythic|http://magiccards.info/scans/en/zen/140.jpg diff --git a/src/forge/card/cardFactory/CardFactoryUtil.java b/src/forge/card/cardFactory/CardFactoryUtil.java index 9e39429462b..1669a5b320d 100644 --- a/src/forge/card/cardFactory/CardFactoryUtil.java +++ b/src/forge/card/cardFactory/CardFactoryUtil.java @@ -2334,64 +2334,6 @@ public class CardFactoryUtil { }//input_discardRecall() //****************copied from input_targetType***************** - //cardType is like "Creature", "Land", "Artifact", "Goblin", "Legendary", ";"-delimited - //cardType can also be "All", which will allow any permanent to be selected - public static Input input_targetType(final SpellAbility spell, final String cardTypeList) { - Input target = new Input() { - private static final long serialVersionUID = 6443658187985259709L; - public void showMessage() { - StringTokenizer st = new StringTokenizer(cardTypeList, ";"); - if(cardTypeList.equals("All")) { - AllZone.Display.showMessage(spell.getSourceCard()+" - Select target permanent"); - } - else { - StringBuffer toDisplay = new StringBuffer(); - toDisplay.append(spell.getSourceCard()+" - Select target "); - while( st.hasMoreTokens() ) { - toDisplay.append(st.nextToken()); - if( st.hasMoreTokens() ) { - toDisplay.append(" or "); - } - } - AllZone.Display.showMessage( toDisplay.toString() ); - } - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) { - boolean foundCardType = false; - StringTokenizer st = new StringTokenizer(cardTypeList, ";"); - if( cardTypeList.equals("All") ) { - foundCardType = true; - } else { - while( st.hasMoreTokens() ) { - if( card.getType().contains( st.nextToken() )) { - foundCardType = true; - } - } - } - if(!canTarget(spell, card)) { - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - - else if( foundCardType && zone.is(Constant.Zone.Battlefield)) { - spell.setTargetCard(card); - if(spell.getManaCost().equals("0") || this.isFree())//for "sacrifice this card" abilities - { - this.setFree(false); - AllZone.Stack.add(spell, spell.getSourceCard().getManaCost().contains("X")); - stop(); - } - else - stopSetNext(new Input_PayManaCost(spell)); - } - } - }; - return target; - }//input_targetType() - //***************end copy****************** - - public static Input input_targetCreature(final SpellAbility spell) { return input_targetCreature(spell, Command.Blank); } diff --git a/src/forge/card/cardFactory/CardFactory_Creatures.java b/src/forge/card/cardFactory/CardFactory_Creatures.java index e5ba0803f56..6ac1cc1721b 100644 --- a/src/forge/card/cardFactory/CardFactory_Creatures.java +++ b/src/forge/card/cardFactory/CardFactory_Creatures.java @@ -1655,47 +1655,7 @@ public class CardFactory_Creatures { card.addSpellAbility(ability); ability.setDescription(abCost+"Destroy target land. If that land was nonbasic, untap Helldozer."); }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Obsidian Fireheart")) { - final Ability ability = new Ability(card, "1 R R") { - @Override - public void resolve() { - Card c = getTargetCard(); - - if(AllZoneUtil.isCardInPlay(c) && c.isLand() && (c.getCounters(Counters.BLAZE) == 0)) c.addCounter( - Counters.BLAZE, 1); - - } - - @Override - public boolean canPlayAI() { - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); - CardList land = new CardList(play.getCards()); - land = land.filter(new CardListFilter() { - public boolean addCard(Card c) { - return c.isLand() && c.getCounters(Counters.BLAZE) < 1; - } - }); - - if(land.size() > 0) setTargetCard(land.get(0)); - - return land.size() > 0; - } - - }; - - StringBuilder sb = new StringBuilder(); - sb.append("1 R R: Put a blaze counter on target land without a blaze counter on it. "); - sb.append("For as long as that land has a blaze counter on it, it has \"At the beginning of your upkeep, "); - sb.append("this land deals 1 damage to you.\" (The land continues to burn after Obsidian Fireheart has left the battlefield.)"); - ability.setDescription(sb.toString()); - - ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Land")); - card.addSpellAbility(ability); - }// *************** END ************ END ************************** - + //*************** START *********** START ************************** else if(cardName.equals("Wild Mongrel")) { @@ -2084,33 +2044,36 @@ public class CardFactory_Creatures { //*************** START *********** START ************************** else if(cardName.equals("Memnarch")) { //has 2 non-tap abilities that affect itself - final SpellAbility ability1 = new Ability(card, "1 U U") { - @Override - public void resolve() { - if(AllZoneUtil.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) { - Card crd = getTargetCard(); - ArrayList types = crd.getType(); - crd.setType(new ArrayList()); //clear - getTargetCard().addType("Artifact"); //make sure artifact is at the beginning - for(String type:types) - crd.addType(type); - - } + Cost cost = new Cost("1 U U", cardName, true); + final Target target = new Target(card, "Select a permanent", "Permanent".split(",")); + + final SpellAbility ability1 = new Ability_Activated(card, cost, target) { + private static final long serialVersionUID = -887237000483591242L; + + @Override + public void resolve(){ + Card crd = target.getTargetCards().get(0); + + ArrayList types = crd.getType(); + crd.setType(new ArrayList()); //clear + getTargetCard().addType("Artifact"); //make sure artifact is at the beginning + for(String type:types) + crd.addType(type); + }//resolve() @Override public boolean canPlayAI() { CardList list = getCreature(); - return list.size() != 0; + + if (list.size() == 0) + return false; + + target.resetTargets(); + target.addTarget(CardFactoryUtil.AI_getBestCreature(getCreature())); + return true; } - @Override - public void chooseTargetAI() { - Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); - setTargetCard(target); - }//chooseTargetAI() - CardList getCreature() { CardList list = new CardList(AllZone.Human_Battlefield.getCards()); list = list.filter(new CardListFilter() { @@ -2124,7 +2087,6 @@ public class CardFactory_Creatures { card.addSpellAbility(ability1); ability1.setDescription("1 U U: Target permanent becomes an artifact in addition to its other types. (This effect doesn't end at end of turn.)"); - ability1.setBeforePayMana(CardFactoryUtil.input_targetType(ability1, "All")); }//*************** END ************ END ************************** diff --git a/src/forge/card/cardFactory/CardFactory_Sorceries.java b/src/forge/card/cardFactory/CardFactory_Sorceries.java index a0943497318..ea31cced4ec 100644 --- a/src/forge/card/cardFactory/CardFactory_Sorceries.java +++ b/src/forge/card/cardFactory/CardFactory_Sorceries.java @@ -459,60 +459,39 @@ public class CardFactory_Sorceries { //*************** START *********** START ************************** else if(cardName.equals("Roiling Terrain")) { - SpellAbility spell = new Spell(card) { - + //SpellAbility spell = new Spell(card) { + Cost cost = new Cost("2 R R", cardName, false); + final Target tgt = new Target(card, "Select a Land", "Land".split(",")); + + SpellAbility spell = new Spell(card, cost, tgt) { private static final long serialVersionUID = -65124658746L; @Override public void resolve() { - if(AllZoneUtil.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) { - AllZone.GameAction.destroy(getTargetCard()); - CardList Grave = new CardList(AllZone.getZone(Constant.Zone.Graveyard, getTargetCard().getController()).getCards()); - int Damage = (Grave.getType("Land")).size(); - getTargetCard().getController().addDamage(Damage, card); - } + Card c = tgt.getTargetCards().get(0); + + Player controller = c.getController(); + AllZone.GameAction.destroy(c); + + int damage = AllZoneUtil.getPlayerTypeInGraveyard(controller, "Land").size(); + + controller.addDamage(damage, card); } - @Override - public void chooseTargetAI() { - //target basic land that Human only has 1 or 2 in play - CardList land = new CardList(AllZone.Human_Battlefield.getCards()); - land = land.getType("Land"); - - Card target = null; - - String[] name = {"Forest", "Swamp", "Plains", "Mountain", "Island"}; - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 1) { - target = land.getName(name[i]).get(0); - break; - } - - //see if there are only 2 lands of the same type - if(target == null) { - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 2) { - target = land.getName(name[i]).get(0); - break; - } - }//if - if(target == null) { - land.shuffle(); - target = land.get(0); - } - setTargetCard(target); - }//chooseTargetAI() @Override public boolean canPlayAI() { CardList land = new CardList(AllZone.Human_Battlefield.getCards()); land = land.getType("Land"); - return land.size() != 0; + + if (land.size() != 0) + return false; + tgt.resetTargets(); + tgt.addTarget(CardFactoryUtil.AI_getBestLand(land)); + + return true; } };//SpellAbility - - spell.setBeforePayMana(CardFactoryUtil.input_targetType(spell, "Land")); - + // Do not remove SpellAbilities created by AbilityFactory or Keywords. card.clearFirstSpellAbility(); card.addSpellAbility(spell);