From e044b89fa8bfd9187dc1ce610dadb9100c22252f Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:41:00 +0000 Subject: [PATCH] - Echoing Truth, Smother, Celestial Purge and Unsummon should be cascadable, and usable by Isochron Scepter. - Repulse, Strangling Soot, Ichor Slick, Regrowth and Temporal Spring should be cascadable. - Fixed Giant Strength (the code for it never existed). --- src/forge/CardFactory.java | 94 ++++++++++++++++++++++++++++---- src/forge/CardFactory_Auras.java | 88 ++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 12 deletions(-) diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 038351df7c5..8323bafa916 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -8470,7 +8470,14 @@ public class CardFactory implements NewConstants { public void selectCard(Card card, PlayerZone zone) { if(!card.isLand() && zone.is(Constant.Zone.Play) && CardFactoryUtil.canTarget(spell, card)) { spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + if (this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -8533,7 +8540,15 @@ public class CardFactory implements NewConstants { else if(card.isCreature() && zone.is(Constant.Zone.Play)) { spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -8595,7 +8610,14 @@ public class CardFactory implements NewConstants { else if(card.isCreature() && zone.is(Constant.Zone.Play)) { spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -9564,7 +9586,14 @@ public class CardFactory implements NewConstants { if(card.isCreature() && zone.is(Constant.Zone.Play) && CardUtil.getConvertedManaCost(card.getManaCost()) <= 3) { spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -9695,8 +9724,15 @@ public class CardFactory implements NewConstants { AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); } if(card.isCreature() && zone.is(Constant.Zone.Play) && card.getNetDefense() <= 3) { - spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + spell.setTargetCard(card); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -9771,7 +9807,14 @@ public class CardFactory implements NewConstants { AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); } else if(card.isCreature() && zone.is(Constant.Zone.Play)) { spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -9890,8 +9933,14 @@ public class CardFactory implements NewConstants { else { spell.setStackDescription("Return " + o + " to its owner's hand"); spell.setTargetCard((Card) o); - - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } }//showMessage() }; @@ -10709,7 +10758,14 @@ public class CardFactory implements NewConstants { AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); } else if(zone.is(Constant.Zone.Play)) { spell.setTargetCard(c); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -14521,7 +14577,14 @@ public class CardFactory implements NewConstants { && (CardUtil.getColors(crd).contains(Constant.Color.Black) || CardUtil.getColors(crd).contains( Constant.Color.Red))) { spell.setTargetCard(crd); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//Input @@ -16558,7 +16621,14 @@ public class CardFactory implements NewConstants { public void selectCard(Card c, PlayerZone zone) { if(zone.is(Constant.Zone.Play) && c.isCreature() && (c.getNetAttack() > 3)) { spell.setTargetCard(c); - stopSetNext(new Input_PayManaCost(spell)); + if(this.isFree()) + { + this.setFree(false); + AllZone.Stack.add(spell); + stop(); + } + else + stopSetNext(new Input_PayManaCost(spell)); } } };//input diff --git a/src/forge/CardFactory_Auras.java b/src/forge/CardFactory_Auras.java index d57cdb490c4..aea9a2bb90e 100644 --- a/src/forge/CardFactory_Auras.java +++ b/src/forge/CardFactory_Auras.java @@ -1782,6 +1782,94 @@ class CardFactory_Auras { spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Giant Strength")) { + final SpellAbility spell = new Spell(card) { + + private static final long serialVersionUID = -5737672424075567628L; + + @Override + public boolean canPlayAI() { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for(int i = 0; i < list.size(); i++) { + if(CardFactoryUtil.canTarget(card, list.get(i))) { + setTargetCard(list.get(i)); + return true; + } + } + return false; + }//canPlayAI() + + @Override + public void resolve() { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) { + card.enchantCard(c); + } + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + Command onEnchant = new Command() { + + private static final long serialVersionUID = -5842396926996677438L; + + public void execute() { + if(card.isEnchanting()) { + Card crd = card.getEnchanting().get(0); + crd.addSemiPermanentAttackBoost(2); + crd.addSemiPermanentDefenseBoost(2); + } + }//execute() + };//Command + + + Command onUnEnchant = new Command() { + + private static final long serialVersionUID = -1936034468811893757L; + + public void execute() { + if(card.isEnchanting()) { + Card crd = card.getEnchanting().get(0); + crd.addSemiPermanentAttackBoost(-2); + crd.addSemiPermanentDefenseBoost(-2); + } + + }//execute() + };//Command + + Command onLeavesPlay = new Command() { + + private static final long serialVersionUID = -2519887209491512000L; + + public void execute() { + if(card.isEnchanting()) { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if(cardName.equals("Paralyzing Grasp")) { final SpellAbility spell = new Spell(card) {