From 02b5984039099238aadfc6988eed91d7746471a6 Mon Sep 17 00:00:00 2001 From: Sol Date: Sun, 20 Jan 2013 19:21:54 +0000 Subject: [PATCH] - Fixing issue with Mana Abilities and Undoable timing - Convert Undiscovered Paradise to script --- res/cardsfolder/u/undiscovered_paradise.txt | 5 ++-- src/main/java/forge/Card.java | 24 ------------------- src/main/java/forge/GameActionUtil.java | 14 +++++++---- .../card/spellability/AbilityManaPart.java | 7 ------ src/main/java/forge/game/phase/Untap.java | 7 +++--- 5 files changed, 16 insertions(+), 41 deletions(-) diff --git a/res/cardsfolder/u/undiscovered_paradise.txt b/res/cardsfolder/u/undiscovered_paradise.txt index bc76c347e42..574d3803552 100644 --- a/res/cardsfolder/u/undiscovered_paradise.txt +++ b/res/cardsfolder/u/undiscovered_paradise.txt @@ -1,8 +1,9 @@ Name:Undiscovered Paradise ManaCost:no cost Types:Land -Text:Whenever you tap CARDNAME for mana, return it to it's owner's hand during the controller's next untap phase. -A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color to your mana pool +Text:no text +A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color to your mana pool | SubAbility$ DBReturn +SVar:DBReturn:DB$ Pump | Defined$ Self | KW$ HIDDEN During your next untap step, as you untap your permanents, return CARDNAME to its owner's hand. | Permanent$ True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/undiscovered_paradise.jpg SetInfo:VIS|Rare|http://magiccards.info/scans/en/vi/167.jpg diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 504db5ab87d..aa964ab83b5 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -150,7 +150,6 @@ public class Card extends GameEntity implements Comparable { private boolean evoked = false; private boolean levelUp = false; - private boolean bounceAtUntap = false; private boolean unearth = false; private boolean unearthed; @@ -1202,29 +1201,6 @@ public class Card extends GameEntity implements Comparable { return this.hasKeyword("At the beginning of the end step, sacrifice CARDNAME."); } - /** - *

- * Getter for the field bounceAtUntap. - *

- * - * @return a boolean. - */ - public final boolean getBounceAtUntap() { - return this.bounceAtUntap; - } - - /** - *

- * Setter for the field bounceAtUntap. - *

- * - * @param bounce - * a boolean. - */ - public final void setBounceAtUntap(final boolean bounce) { - this.bounceAtUntap = bounce; - } - /** *

* hasFirstStrike. diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 4c118ee739f..9f6b62e9239 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -1783,12 +1783,18 @@ public final class GameActionUtil { amount += bonus; } - try { - if ((sa.getParam("Amount") != null) && (amount != Integer.parseInt(sa.getParam("Amount")))) { + if (sa.getSubAbility() != null) { + // Mark SAs with subAbilities as undoable. These are generally things like damage, and other stuff + // that's hard to track and remove + sa.setUndoable(false); + } else { + try { + if ((sa.getParam("Amount") != null) && (amount != Integer.parseInt(sa.getParam("Amount")))) { + sa.setUndoable(false); + } + } catch (final NumberFormatException n) { sa.setUndoable(false); } - } catch (final NumberFormatException n) { - sa.setUndoable(false); } final StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/forge/card/spellability/AbilityManaPart.java b/src/main/java/forge/card/spellability/AbilityManaPart.java index 4cc436d81fb..ec7e2ace1db 100644 --- a/src/main/java/forge/card/spellability/AbilityManaPart.java +++ b/src/main/java/forge/card/spellability/AbilityManaPart.java @@ -126,13 +126,6 @@ public class AbilityManaPart implements java.io.Serializable { // add the mana produced to the mana pool manaPool.addManaToFloating(this.lastProduced); - // TODO all of the following would be better as trigger events - // "tapped for mana" - if (source.getName().equals("Undiscovered Paradise")) { - // Probably best to conver this to an Extrinsic Ability - source.setBounceAtUntap(true); - } - // Run triggers final HashMap runParams = new HashMap(); diff --git a/src/main/java/forge/game/phase/Untap.java b/src/main/java/forge/game/phase/Untap.java index 5a9171ab126..8052d85121f 100644 --- a/src/main/java/forge/game/phase/Untap.java +++ b/src/main/java/forge/game/phase/Untap.java @@ -114,10 +114,9 @@ public class Untap extends Phase { List list = new ArrayList(player.getCardsIn(ZoneType.Battlefield)); - for (final Card c : list) { - if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise")) { - Singletons.getModel().getGame().getAction().moveToHand(c); - } + List bounceList = CardLists.getKeyword(list, "During your next untap step, as you untap your permanents, return CARDNAME to its owner's hand."); + for (final Card c : bounceList) { + Singletons.getModel().getGame().getAction().moveToHand(c); } list = CardLists.filter(list, new Predicate() {