From a08a71c5531f5588cf30d74b14f6f1245dca64a8 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 23:55:59 +0000 Subject: [PATCH] - Convert Overwhelming Intellect to AF_Counter --- res/cardsfolder/overwhelming_intellect.txt | 5 ++- .../card/abilityFactory/AbilityFactory.java | 16 +++++++- .../cardFactory/CardFactory_Instants.java | 39 ------------------- 3 files changed, 18 insertions(+), 42 deletions(-) diff --git a/res/cardsfolder/overwhelming_intellect.txt b/res/cardsfolder/overwhelming_intellect.txt index 9a30e1294ad..765451f3b3c 100644 --- a/res/cardsfolder/overwhelming_intellect.txt +++ b/res/cardsfolder/overwhelming_intellect.txt @@ -1,7 +1,10 @@ Name:Overwhelming Intellect ManaCost:4 U U Types:Instant -Text:Counter target creature spell. Draw cards equal to that spell's converted mana cost. +Text:no text +A:SP$ Counter | Cost$ 4 U U | TargetType$ Spell | TgtPrompt$ Select target Creature spell | ValidTgts$ Creature | SubAbility$ SVar=DBDraw | SpellDescription$ Counter target creature spell. Draw cards equal to that spell's converted mana cost. +SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ X +SVar:X:Targeted$CardManaCost SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/overwhelming_intellect.jpg SetInfo:SOK|Uncommon|http://magiccards.info/scans/en/sok/51.jpg diff --git a/src/forge/card/abilityFactory/AbilityFactory.java b/src/forge/card/abilityFactory/AbilityFactory.java index 091df949522..4c3b88c9f51 100644 --- a/src/forge/card/abilityFactory/AbilityFactory.java +++ b/src/forge/card/abilityFactory/AbilityFactory.java @@ -878,8 +878,20 @@ public class AbilityFactory { } } else { - //TODO - this may needs edits to handle SpellAbility defineds? - list = new CardList(findParentsTargetedCard(ability).getTarget().getTargetCards().toArray()); + SpellAbility parent = findParentsTargetedCard(ability); + + ArrayList all = parent.getTarget().getTargets(); + if(!all.isEmpty() && all.get(0) instanceof SpellAbility) { + list = new CardList(); + ArrayList sas = parent.getTarget().getTargetSAs(); + for(SpellAbility sa : sas) { + list.add(sa.getSourceCard()); + } + } + else { + SpellAbility saTargeting = findParentsTargetedCard(ability); + list = new CardList(saTargeting.getTarget().getTargetCards().toArray()); + } } } else if (calcX[0].startsWith("Triggered")) { diff --git a/src/forge/card/cardFactory/CardFactory_Instants.java b/src/forge/card/cardFactory/CardFactory_Instants.java index 483e0bf3ed3..ff2754350de 100644 --- a/src/forge/card/cardFactory/CardFactory_Instants.java +++ b/src/forge/card/cardFactory/CardFactory_Instants.java @@ -860,45 +860,6 @@ public class CardFactory_Instants { card.setSVar("PlayMain1", "TRUE"); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Overwhelming Intellect")) { - SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = -8825219868732813877L; - - @Override - public void resolve() { - SpellAbility sa = AllZone.Stack.pop(); - AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); - - int convertedManaCost = CardUtil.getConvertedManaCost(sa.getSourceCard().getManaCost()); - for(int i = 0; i < convertedManaCost; i++) { - card.getController().drawCard(); - } - - } - - @Override - public boolean canPlay() { - if(AllZone.Stack.size() == 0) return false; - - //see if spell is on stack and that opponent played it - Player opponent = card.getController().getOpponent(); - SpellAbility sa = AllZone.Stack.peek(); - return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) - && sa.getSourceCard().getType().contains("Creature") - && CardFactoryUtil.isCounterable(sa.getSourceCard()); - - - } - }; - - // Do not remove SpellAbilities created by AbilityFactory or Keywords. - card.clearFirstSpellAbility(); - card.addSpellAbility(spell); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if(cardName.equals("Banishing Knack")) { SpellAbility spell = new Spell(card) {