From bfc1363cdb384d8cbddc7a25136b7c22f9f8564e Mon Sep 17 00:00:00 2001 From: Sol Date: Tue, 7 Feb 2012 01:55:37 +0000 Subject: [PATCH] Removing all references to Mind's Desire --- src/main/java/forge/Card.java | 54 +---- src/main/java/forge/GameAction.java | 22 -- src/main/java/forge/GuiDisplayUtil.java | 3 +- .../cardfactory/CardFactorySorceries.java | 192 ------------------ .../java/forge/gui/game/CardDetailPanel.java | 13 -- 5 files changed, 2 insertions(+), 282 deletions(-) diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index e9cca3ee8be..948acc0bdf4 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -335,7 +335,7 @@ public class Card extends GameEntity implements Comparable { // Hidden keywords won't be displayed on the card private final ArrayList hiddenExtrinsicKeyword = new ArrayList(); private ArrayList prevIntrinsicKeyword = new ArrayList(); - private final ArrayList attachedByMindsDesire = new ArrayList(); + // which equipment cards are equipping this card? private ArrayList equippedBy = new ArrayList(); // equipping size will always be 0 or 1 @@ -4285,58 +4285,6 @@ public class Card extends GameEntity implements Comparable { gameEntity.removeEnchantedBy(this); } } - - // array size might equal 0, will NEVER be null - /** - *

- * getAttachedCards. - *

- * - * @return an array of {@link forge.Card} objects. - */ - public final Card[] getAttachedCardsByMindsDesire() { - final Card[] c = new Card[this.attachedByMindsDesire.size()]; - this.attachedByMindsDesire.toArray(c); - return c; - } - - /** - *

- * hasAttachedCards. - *

- * - * @return a boolean. - */ - public final boolean hasAttachedCardsByMindsDesire() { - return this.getAttachedCardsByMindsDesire().length != 0; - } - - /** - *

- * attachCard. - *

- * - * @param c - * a {@link forge.Card} object. - */ - public final void attachCardByMindsDesire(final Card c) { - this.attachedByMindsDesire.add(c); - this.updateObservers(); - } - - /** - *

- * unattachCard. - *

- * - * @param c - * a {@link forge.Card} object. - */ - public final void unattachCardByMindDesire(final Card c) { - this.attachedByMindsDesire.remove(c); - this.updateObservers(); - } - /** *

* Setter for the field type. diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java index 04c658f1a53..af1f2bf552f 100644 --- a/src/main/java/forge/GameAction.java +++ b/src/main/java/forge/GameAction.java @@ -18,7 +18,6 @@ package forge; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; @@ -1832,27 +1831,6 @@ public class GameAction { // local enchantments are always attached to something // if Card is "Equipment", returns true if attached to something - /** - *

- * isAttachee. - *

- * - * @param c - * a {@link forge.Card} object. - * @return a boolean. - */ - public final boolean isAttacheeByMindsDesire(final Card c) { - final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield); - - for (int i = 0; i < list.size(); i++) { - final Card[] cc = list.getCard(i).getAttachedCardsByMindsDesire(); - if (Arrays.binarySearch(cc, c) >= 0) { - return true; - } - } - - return false; - } // isAttached(Card c) /** *

diff --git a/src/main/java/forge/GuiDisplayUtil.java b/src/main/java/forge/GuiDisplayUtil.java index e1cbc029dbe..1f43f75271b 100644 --- a/src/main/java/forge/GuiDisplayUtil.java +++ b/src/main/java/forge/GuiDisplayUtil.java @@ -287,8 +287,7 @@ public final class GuiDisplayUtil { final ArrayList a = new ArrayList(); for (int i = 0; i < c.length; i++) { if (((!(c[i].isCreature() || c[i].isEnchantment() || c[i].isArtifact() || c[i].isPlaneswalker()) || (c[i] - .isLand() && c[i].isArtifact() && !c[i].isCreature() && !c[i].isEnchantment())) && !AllZone - .getGameAction().isAttacheeByMindsDesire(c[i])) + .isLand() && c[i].isArtifact() && !c[i].isCreature() && !c[i].isEnchantment()))) || (c[i].getName().startsWith("Mox") && !c[i].getName().equals("Mox Diamond"))) { a.add(c[i]); } diff --git a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java index 36a709596fe..5909e073540 100644 --- a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java +++ b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java @@ -246,198 +246,6 @@ public class CardFactorySorceries { card.setSVar("PlayMain1", "TRUE"); } // *************** END ************ END ************************** - // *************** START *********** START ************************** - /*else if (cardName.equals("Mind's Desire")) { - final Spell playCreature = new Spell(card) { - private static final long serialVersionUID = 53838791023456795L; - - @Override - public void resolve() { - final Player player = card.getController(); - final PlayerZone play = player.getZone(Constant.Zone.Battlefield); - final PlayerZone rfg = player.getZone(Constant.Zone.Exile); - final Card[] attached = card.getAttachedCardsByMindsDesire(); - rfg.remove(attached[0]); - play.add(attached[0]); - card.unattachCardByMindDesire(attached[0]); - } // resolve() - }; // SpellAbility - - final Ability freeCast = new Ability(card, "0") { - - @Override - public void resolve() { - Card target = null; - Card c = null; - final Player player = card.getController(); - if (player.isHuman()) { - final Card[] attached = this.getSourceCard().getAttachedCardsByMindsDesire(); - final Card[] choices = new Card[attached.length]; - boolean systemsGo = true; - if (AllZone.getStack().size() > 0) { - final CardList config = new CardList(); - for (final Card element : attached) { - if (element.isInstant() || element.hasKeyword("Flash")) { - config.add(element); - } - } - for (int i = 0; i < config.size(); i++) { - final Card crd = config.get(i); - choices[i] = crd; - } - if (config.size() == 0) { - systemsGo = false; - } - } else { - for (int i = 0; i < attached.length; i++) { - choices[i] = attached[i]; - } - } - Object check = null; - if (systemsGo) { - check = GuiUtils.getChoiceOptional("Select Card to play for free", choices); - if (check != null) { - target = ((Card) check); - } - if (target != null) { - c = AllZone.getCardFactory().copyCard(target); - } - - if (c != null) { - if (c.isLand()) { - if (player.canPlayLand()) { - player.playLand(c); - } else { - JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", - "", JOptionPane.INFORMATION_MESSAGE); - } - } else if (c.isPermanent() && c.isAura()) { - c.removeIntrinsicKeyword("Flash"); // Stops - // the - // player - // from - // re-casting - // the - // flash - // spell. - - final StringBuilder sb = new StringBuilder(); - sb.append(c.getName()).append(" - Copied from Mind's Desire"); - playCreature.setStackDescription(sb.toString()); - - final Card[] reAttach = new Card[attached.length]; - reAttach[0] = c; - int reAttachCount = 0; - for (final Card element : attached) { - if (element != target) { - reAttachCount = reAttachCount + 1; - reAttach[reAttachCount] = element; - } - } - // Clear Attached List - for (final Card element : attached) { - card.unattachCardByMindDesire(element); - } - // Re-add - for (final Card element : reAttach) { - if (element != null) { - card.attachCardByMindsDesire(element); - } - } - target.addSpellAbility(playCreature); - AllZone.getStack().add(playCreature); - } else { - AllZone.getGameAction().playCardNoCost(c); - card.unattachCardByMindDesire(c); - } - } else { - final StringBuilder sb = new StringBuilder(); - sb.append("Player cancelled or there is no more "); - sb.append("cards available on Mind's Desire."); - JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE); - } - } else { - final StringBuilder sb = new StringBuilder(); - sb.append("You can only play an instant at this point in time, "); - sb.append("but none are attached to Mind's Desire."); - JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE); - } - } - } - - @Override - public boolean canPlayAI() { - return false; - } - - }; - freeCast.setStackDescription("Mind's Desire - play card without paying its mana cost."); - - final Command intoPlay = new Command() { - private static final long serialVersionUID = 920148510259054021L; - - @Override - public void execute() { - final Player player = AllZone.getPhaseHandler().getPlayerTurn(); - final PlayerZone play = player.getZone(Constant.Zone.Battlefield); - Card mindsD = card; - if (player.isHuman()) { - card.getController().shuffle(); - } - CardList mindsList = player.getCardsIn(Zone.Battlefield); - mindsList = mindsList.getName("Mind's Desire"); - mindsList.remove(card); - if (mindsList.size() > 0) { - play.remove(card); - mindsD = mindsList.get(0); - } else { - final StringBuilder sb = new StringBuilder(); - sb.append("Click Mind's Desire to see the available cards "); - sb.append("to play without paying its mana cost."); - JOptionPane.showMessageDialog(null, sb.toString(), "", JOptionPane.INFORMATION_MESSAGE); - } - final CardList libList = player.getCardsIn(Zone.Library); - Card c = null; - if (libList.size() > 0) { - c = libList.get(0); - final PlayerZone rfg = player.getZone(Constant.Zone.Exile); - AllZone.getGameAction().moveTo(rfg, c); - mindsD.attachCardByMindsDesire(c); - } - final Card minds = card; - // AllZone.getGameAction().exile(Minds); - minds.setImmutable(true); - final Command untilEOT = new Command() { - private static final long serialVersionUID = -28032591440730370L; - - @Override - public void execute() { - final Player player = AllZone.getPhaseHandler().getPlayerTurn(); - final PlayerZone play = player.getZone(Constant.Zone.Battlefield); - play.remove(minds); - } - }; - AllZone.getEndOfTurn().addUntil(untilEOT); - } - - }; - final SpellAbility spell = new SpellPermanent(card) { - private static final long serialVersionUID = -2940969025405788931L; - - @Override - public boolean canPlayAI() { - return false; - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - card.addSpellAbility(spell); - card.addSpellAbility(freeCast); - spell.setDescription(""); - }*/ - // *************** END ************ END ************************** - // *************** START *********** START ************************** else if (cardName.equals("Brilliant Ultimatum")) { final SpellAbility spell = new Spell(card) { diff --git a/src/main/java/forge/gui/game/CardDetailPanel.java b/src/main/java/forge/gui/game/CardDetailPanel.java index 6cb062f8837..07b89b36683 100644 --- a/src/main/java/forge/gui/game/CardDetailPanel.java +++ b/src/main/java/forge/gui/game/CardDetailPanel.java @@ -452,19 +452,6 @@ public class CardDetailPanel extends JPanel implements CardContainer { area.append("Must block an attacker"); } - if (card.hasAttachedCardsByMindsDesire()) { - if (area.length() != 0) { - area.append("\n"); - } - final Card[] cards = card.getAttachedCardsByMindsDesire(); - area.append("=Attached: "); - for (final Card c : cards) { - area.append(c.getName()); - area.append(" "); - } - area.append("="); - } - this.cdArea.setText(area.toString()); }