Renamed attachCard => attachCardByMindsDesire because it's the only way the field is uses. Hope someone will refactor the whole spell.

This commit is contained in:
Maxmtg
2011-09-20 15:31:21 +00:00
parent f451e59add
commit 71f00b3c8d
5 changed files with 24 additions and 23 deletions

View File

@@ -49,7 +49,7 @@ public class Card extends GameEntity implements Comparable<Card> {
//Hidden keywords won't be displayed on the card
private ArrayList<String> hiddenExtrinsicKeyword = new ArrayList<String>();
private ArrayList<String> prevIntrinsicKeyword = new ArrayList<String>();
private ArrayList<Card> attached = new ArrayList<Card>();
private ArrayList<Card> attachedByMindsDesire = new ArrayList<Card>();
//which equipment cards are equipping this card?
private ArrayList<Card> equippedBy = new ArrayList<Card>();
//equipping size will always be 0 or 1
@@ -3174,9 +3174,9 @@ public class Card extends GameEntity implements Comparable<Card> {
*
* @return an array of {@link forge.Card} objects.
*/
public final Card[] getAttachedCards() {
Card[] c = new Card[attached.size()];
attached.toArray(c);
public final Card[] getAttachedCardsByMindsDesire() {
Card[] c = new Card[attachedByMindsDesire.size()];
attachedByMindsDesire.toArray(c);
return c;
}
@@ -3185,8 +3185,8 @@ public class Card extends GameEntity implements Comparable<Card> {
*
* @return a boolean.
*/
public final boolean hasAttachedCards() {
return getAttachedCards().length != 0;
public final boolean hasAttachedCardsByMindsDesire() {
return getAttachedCardsByMindsDesire().length != 0;
}
/**
@@ -3194,8 +3194,8 @@ public class Card extends GameEntity implements Comparable<Card> {
*
* @param c a {@link forge.Card} object.
*/
public final void attachCard(final Card c) {
attached.add(c);
public final void attachCardByMindsDesire(final Card c) {
attachedByMindsDesire.add(c);
this.updateObservers();
}
@@ -3204,8 +3204,8 @@ public class Card extends GameEntity implements Comparable<Card> {
*
* @param c a {@link forge.Card} object.
*/
public final void unattachCard(final Card c) {
attached.remove(c);
public final void unattachCardByMindDesire(final Card c) {
attachedByMindsDesire.remove(c);
this.updateObservers();
}

View File

@@ -32,6 +32,7 @@ import forge.properties.NewConstants.LANG.GameAction.GAMEACTION_TEXT;
import forge.quest.gui.main.QuestChallenge;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -1530,12 +1531,12 @@ public class GameAction {
* @param c a {@link forge.Card} object.
* @return a boolean.
*/
public final boolean isAttachee(final Card c) {
public final boolean isAttacheeByMindsDesire(final Card c) {
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
for (int i = 0; i < list.size(); i++) {
CardList check = new CardList(list.getCard(i).getAttachedCards());
if (check.contains(c)) {
Card [] cc = list.getCard(i).getAttachedCardsByMindsDesire();
if (Arrays.binarySearch(cc, c) >= 0) {
return true;
}
}

View File

@@ -277,7 +277,7 @@ public final class GuiDisplayUtil implements NewConstants {
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().isAttachee(c[i])
&& !AllZone.getGameAction().isAttacheeByMindsDesire(c[i])
|| (c[i].getName().startsWith("Mox") && !c[i].getName().equals("Mox Diamond")))
{
a.add(c[i]);

View File

@@ -267,10 +267,10 @@ public class CardFactory_Sorceries {
Player player = card.getController();
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
PlayerZone RFG = player.getZone(Constant.Zone.Exile);
Card[] Attached = card.getAttachedCards();
Card[] Attached = card.getAttachedCardsByMindsDesire();
RFG.remove(Attached[0]);
play.add(Attached[0]);
card.unattachCard(Attached[0]);
card.unattachCardByMindDesire(Attached[0]);
}//resolve()
};//SpellAbility
@@ -282,7 +282,7 @@ public class CardFactory_Sorceries {
Card c = null;
Player player = card.getController();
if (player.isHuman()) {
Card[] Attached = getSourceCard().getAttachedCards();
Card[] Attached = getSourceCard().getAttachedCardsByMindsDesire();
Card[] Choices = new Card[Attached.length];
boolean SystemsGo = true;
if (AllZone.getStack().size() > 0) {
@@ -334,17 +334,17 @@ public class CardFactory_Sorceries {
}
// Clear Attached List
for (int i = 0; i < Attached.length; i++) {
card.unattachCard(Attached[i]);
card.unattachCardByMindDesire(Attached[i]);
}
// Re-add
for (int i = 0; i < ReAttach.length; i++) {
if (ReAttach[i] != null) card.attachCard(ReAttach[i]);
if (ReAttach[i] != null) card.attachCardByMindsDesire(ReAttach[i]);
}
target.addSpellAbility(PlayCreature);
AllZone.getStack().add(PlayCreature);
} else {
AllZone.getGameAction().playCardNoCost(c);
card.unattachCard(c);
card.unattachCardByMindDesire(c);
}
} else
JOptionPane.showMessageDialog(null, "Player cancelled or there is no more cards available on Mind's Desire.", "", JOptionPane.INFORMATION_MESSAGE);
@@ -382,7 +382,7 @@ public class CardFactory_Sorceries {
c = libList.get(0);
PlayerZone RFG = player.getZone(Constant.Zone.Exile);
AllZone.getGameAction().moveTo(RFG, c);
Minds_D.attachCard(c);
Minds_D.attachCardByMindsDesire(c);
}
final Card Minds = card;
// AllZone.getGameAction().exile(Minds);

View File

@@ -337,9 +337,9 @@ public class CardDetailPanel extends JPanel implements CardContainer {
area.append("This card can't be cast.");
}
if (card.hasAttachedCards()) {
if (card.hasAttachedCardsByMindsDesire()) {
if (area.length() != 0) area.append("\n");
Card[] cards = card.getAttachedCards();
Card[] cards = card.getAttachedCardsByMindsDesire();
area.append("=Attached: ");
for (Card c : cards) {
area.append(c.getName());