From 86517de8d5d60607caa6056fe91dcccf46c14a62 Mon Sep 17 00:00:00 2001 From: jendave Date: Tue, 25 Oct 2011 19:05:51 +0000 Subject: [PATCH] checkstyle --- src/main/java/forge/Card.java | 5379 +++++++++++++++++++++------------ 1 file changed, 3489 insertions(+), 1890 deletions(-) diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 945cb6ad742..4c3168d0c4b 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -1,6 +1,5 @@ package forge; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -27,11 +26,13 @@ import forge.card.trigger.Trigger; import forge.item.CardDb; /** - *

Card class.

- * - * Can now be used as keys in Tree data structures. The comparison is based + *

+ * Card class. + *

+ * + * Can now be used as keys in Tree data structures. The comparison is based * entirely on getUniqueNumber(). - * + * * @author Forge * @version $Id$ */ @@ -40,109 +41,153 @@ public class Card extends GameEntity implements Comparable { private int uniqueNumber = nextUniqueNumber++; private long value; - - private CardCharacteristics[] characteristics = new CardCharacteristics[] { new CardCharacteristics(), null }; + + private CardCharacteristics[] characteristics = new CardCharacteristics[] {new CardCharacteristics(), null}; private int currentCharacteristic = 0; private boolean isDoubleFaced = false; private boolean isFlip = false; - + private CardCharacteristics getCharacteristics() { return characteristics[currentCharacteristic]; } - - public void addAlternateState() { + + /** + * + * addAlternateState. + */ + public final void addAlternateState() { characteristics[1] = new CardCharacteristics(); } - - public void clearAlternateState() { - if(currentCharacteristic == 1) { + + /** + * + * clearAlternateState. + */ + public final void clearAlternateState() { + if (currentCharacteristic == 1) { changeState(); } characteristics[1] = null; } - - public void clearOtherState() { - characteristics[1-currentCharacteristic] = null; + + /** + * + * clearOtherState. + */ + public final void clearOtherState() { + characteristics[1 - currentCharacteristic] = null; } - + + /* (non-Javadoc) + * @see forge.GameEntity#getName() + */ @Override - public String getName() { + public final String getName() { return getCharacteristics().getName(); } - + + /* (non-Javadoc) + * @see forge.GameEntity#setName(java.lang.String) + */ @Override - public void setName(String name0) { + public final void setName(final String name0) { getCharacteristics().setName(name0); } - - public boolean isInAlternateState() { + + /** + * + * isInAlternateState. + * @return boolean + */ + public final boolean isInAlternateState() { return currentCharacteristic == 1; } - - public boolean hasAlternateState() { + + /** + * + * hasAlternateState. + * @return boolean + */ + public final boolean hasAlternateState() { return characteristics[1] != null; } - - public boolean changeState() { - if(characteristics[1-currentCharacteristic] != null) { + + /** + * + * changeState. + * @return boolean + */ + public final boolean changeState() { + if (characteristics[1 - currentCharacteristic] != null) { currentCharacteristic = 1 - currentCharacteristic; - + return true; } - + return false; } /** + * Checks if is double faced. + * * @return the isDoubleFaced */ - public boolean isDoubleFaced() { + public final boolean isDoubleFaced() { return isDoubleFaced; } /** + * Sets the double faced. + * * @param isDoubleFaced0 the isDoubleFaced to set */ - public void setDoubleFaced(boolean isDoubleFaced0) { - this.isDoubleFaced = isDoubleFaced0; // TODO: Add 0 to parameter's name. + public final void setDoubleFaced(final boolean isDoubleFaced0) { + this.isDoubleFaced = isDoubleFaced0; + // TODO Add 0 to parameter's name. } /** + * Checks if is flip. + * * @return the isFlip */ - public boolean isFlip() { + public final boolean isFlip() { return isFlip; } /** + * Sets the flip. + * * @param isFlip0 the isFlip to set */ - public void setFlip(boolean isFlip0) { - this.isFlip = isFlip0; // TODO: Add 0 to parameter's name. + public final void setFlip(final boolean isFlip0) { + this.isFlip = isFlip0; + // TODO Add 0 to parameter's name. } private Map counters = new TreeMap(); private Map triggeringObjects = new TreeMap(); private ArrayList staticAbilityStrings = new ArrayList(); private ArrayList extrinsicKeyword = new ArrayList(); - //Hidden keywords won't be displayed on the card + // Hidden keywords won't be displayed on the card private ArrayList hiddenExtrinsicKeyword = new ArrayList(); private ArrayList prevIntrinsicKeyword = new ArrayList(); private ArrayList attachedByMindsDesire = new ArrayList(); - //which equipment cards are equipping this card? + // which equipment cards are equipping this card? private ArrayList equippedBy = new ArrayList(); - //equipping size will always be 0 or 1 - //if this card is of the type equipment, what card is it currently equipping? + // equipping size will always be 0 or 1 + // if this card is of the type equipment, what card is it currently + // equipping? private ArrayList equipping = new ArrayList(); - //which auras enchanted this card? + // which auras enchanted this card? - //if this card is an Aura, what Entity is it enchanting? + // if this card is an Aura, what Entity is it enchanting? private GameEntity enchanting = null; private ArrayList prevType = new ArrayList(); private ArrayList choicesMade = new ArrayList(); private ArrayList targetsForChoices = new ArrayList(); - //changes by AF animate and continuous static effects + // changes by AF animate and continuous static effects private ArrayList changedCardTypes = new ArrayList(); private ArrayList changedCardKeywords = new ArrayList(); @@ -158,7 +203,7 @@ public class Card extends GameEntity implements Comparable { private boolean unCastable; private boolean drawnThisTurn = false; private boolean tapped; - private boolean sickness = true; //summoning sickness + private boolean sickness = true; // summoning sickness private boolean token = false; private boolean copiedToken = false; private boolean copiedSpell = false; @@ -189,16 +234,19 @@ public class Card extends GameEntity implements Comparable { private boolean madness = false; private boolean suspendCast = false; private boolean suspend = false; - + private boolean phasedOut = false; private boolean directlyPhasedOut = true; - //for Vanguard / Manapool / Emblems etc. + // for Vanguard / Manapool / Emblems etc. private boolean isImmutable = false; private long timestamp = -1; // permanents on the battlefield - private ArrayList newPT = new ArrayList(); // stack of set power/toughness + private ArrayList newPT = new ArrayList(); // stack + // of + // set + // power/toughness private int baseLoyalty = 0; private String baseAttackString = null; private String baseDefenseString = null; @@ -231,12 +279,12 @@ public class Card extends GameEntity implements Comparable { private Player owner = null; private ArrayList controllerObjects = new ArrayList(); private String imageName = ""; - //private String rarity = ""; + // private String rarity = ""; private String text = ""; private String echoCost = ""; private String madnessCost = ""; private String chosenType = ""; - //private String chosenColor = ""; + // private String chosenColor = ""; private ArrayList chosenColor = new ArrayList(); private String namedCard = ""; private int chosenNumber; @@ -258,26 +306,29 @@ public class Card extends GameEntity implements Comparable { private ArrayList changeControllerCommandList = new ArrayList(); private static String[] storableSVars = {"ChosenX"}; - + private ArrayList hauntedBy = new ArrayList(); private Card haunting = null; /** * * TODO Write javadoc for this method. + * * @return a String array */ - public static String[] getStorableSVars() { return storableSVars; } + public static String[] getStorableSVars() { + return storableSVars; + } - //hacky code below, used to limit the number of times an ability - //can be used per turn like Vampire Bats - //should be put in SpellAbility, but it is put here for convienance - //this is make public just to make things easy - //this code presumes that each card only has one ability that can be - //used a limited number of times per turn - //CardFactory.SSP_canPlay(Card) uses these variables + // hacky code below, used to limit the number of times an ability + // can be used per turn like Vampire Bats + // should be put in SpellAbility, but it is put here for conveniance + // this is make public just to make things easy + // this code presumes that each card only has one ability that can be + // used a limited number of times per turn + // CardFactory.SSP_canPlay(Card) uses these variables - //Only used with Replicate + // Only used with Replicate private int abilityUsed; /** @@ -291,7 +342,9 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param c a Card object + * + * @param c + * a Card object */ public final void addDevoured(final Card c) { devouredCards.add(c); @@ -308,6 +361,7 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. + * * @return a CardList object */ public final CardList getDevoured() { @@ -315,17 +369,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

addRemembered.

- * - * @param o a {@link java.lang.Object} object. + *

+ * addRemembered. + *

+ * + * @param o + * a {@link java.lang.Object} object. */ public final void addRemembered(final Object o) { rememberedObjects.add(o); } /** - *

getRemembered.

- * + *

+ * getRemembered. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getRemembered() { @@ -333,33 +392,43 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearRemembered.

+ *

+ * clearRemembered. + *

*/ public final void clearRemembered() { rememberedObjects.clear(); } /** - *

addImprinted.

- * - * @param c a {@link forge.Card} object. + *

+ * addImprinted. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void addImprinted(final Card c) { imprintedCards.add(c); } /** - *

addImprinted.

- * - * @param list a {@link java.util.ArrayList} object. + *

+ * addImprinted. + *

+ * + * @param list + * a {@link java.util.ArrayList} object. */ public final void addImprinted(final ArrayList list) { imprintedCards.addAll(list); } /** - *

getImprinted.

- * + *

+ * getImprinted. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getImprinted() { @@ -367,16 +436,21 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearImprinted.

+ *

+ * clearImprinted. + *

*/ public final void clearImprinted() { imprintedCards.clear(); } /** - *

Setter for the field championedCard.

- * - * @param c a {@link forge.Card} object. + *

+ * Setter for the field championedCard. + *

+ * + * @param c + * a {@link forge.Card} object. * @since 1.0.15 */ public final void setChampionedCard(final Card c) { @@ -384,8 +458,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field championedCard.

- * + *

+ * Getter for the field championedCard. + *

+ * * @return a {@link forge.Card} object. * @since 1.0.15 */ @@ -394,9 +470,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addTrigger.

- * - * @param t a {@link forge.card.trigger.Trigger} object. + *

+ * addTrigger. + *

+ * + * @param t + * a {@link forge.card.trigger.Trigger} object. * @return a {@link forge.card.trigger.Trigger} object. */ public final Trigger addTrigger(final Trigger t) { @@ -405,25 +484,36 @@ public class Card extends GameEntity implements Comparable { getCharacteristics().getTriggers().add(newtrig); return newtrig; } - + + /** + * + * moveTrigger. + * @param t a Trigger + */ public final void moveTrigger(final Trigger t) { t.setHostCard(this); - if(!getCharacteristics().getTriggers().contains(t)) + if (!getCharacteristics().getTriggers().contains(t)) { getCharacteristics().getTriggers().add(t); + } } /** - *

removeTrigger.

- * - * @param t a {@link forge.card.trigger.Trigger} object. + *

+ * removeTrigger. + *

+ * + * @param t + * a {@link forge.card.trigger.Trigger} object. */ public final void removeTrigger(final Trigger t) { getCharacteristics().getTriggers().remove(t); } /** - *

Getter for the field triggers.

- * + *

+ * Getter for the field triggers. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getTriggers() { @@ -431,15 +521,18 @@ public class Card extends GameEntity implements Comparable { } /** - *

getNamedTrigger.

- * - * @param name a {@link java.lang.String} object. + *

+ * getNamedTrigger. + *

+ * + * @param name + * a {@link java.lang.String} object. * @return a {@link forge.card.trigger.Trigger} object. */ public final Trigger getNamedTrigger(final String name) { for (Trigger t : getCharacteristics().getTriggers()) { if (t.getName() != null && t.getName().equals(name)) { - return t; + return t; } } @@ -447,9 +540,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field triggers.

- * - * @param trigs a {@link java.util.ArrayList} object. + *

+ * Setter for the field triggers. + *

+ * + * @param trigs + * a {@link java.util.ArrayList} object. */ public final void setTriggers(final ArrayList trigs) { ArrayList copyList = new ArrayList(); @@ -458,21 +554,26 @@ public class Card extends GameEntity implements Comparable { newtrig.setHostCard(this); copyList.add(newtrig); } - + getCharacteristics().setTriggers(copyList); } /** - *

clearTriggersNew.

+ *

+ * clearTriggersNew. + *

*/ public final void clearTriggersNew() { getCharacteristics().getTriggers().clear(); } /** - *

getTriggeringObject.

- * - * @param typeIn a {@link java.lang.String} object. + *

+ * getTriggeringObject. + *

+ * + * @param typeIn + * a {@link java.lang.String} object. * @return a {@link java.lang.Object} object. */ public final Object getTriggeringObject(final String typeIn) { @@ -480,17 +581,20 @@ public class Card extends GameEntity implements Comparable { } /** - field abilityUsed. - * - * @param i a int. - */ + * field abilityUsed. + * + * @param i + * a int. + */ public final void setAbilityUsed(final int i) { abilityUsed = i; } /** - *

Getter for the field abilityUsed.

- * + *

+ * Getter for the field abilityUsed. + *

+ * * @return a int. */ public final int getAbilityUsed() { @@ -498,8 +602,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field sunburstValue.

- * + *

+ * Getter for the field sunburstValue. + *

+ * * @return a int. */ public final int getSunburstValue() { @@ -507,17 +613,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field colorsPaid.

- * - * @param s a String + *

+ * Setter for the field colorsPaid. + *

+ * + * @param s + * a String */ public final void setColorsPaid(final String s) { colorsPaid = s; } /** - *

Getter for the field colorsPaid.

- * + *

+ * Getter for the field colorsPaid. + *

+ * * @return a String. */ public final String getColorsPaid() { @@ -525,35 +636,46 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field sunburstValue.

- * - * @param valueIn a int. + *

+ * Setter for the field sunburstValue. + *

+ * + * @param valueIn + * a int. */ public final void setSunburstValue(final int valueIn) { sunburstValue = valueIn; } /** - *

addXManaCostPaid.

- * - * @param n a int. + *

+ * addXManaCostPaid. + *

+ * + * @param n + * a int. */ public final void addXManaCostPaid(final int n) { xManaCostPaid += n; } /** - *

Setter for the field xManaCostPaid.

- * - * @param n a int. + *

+ * Setter for the field xManaCostPaid. + *

+ * + * @param n + * a int. */ public final void setXManaCostPaid(final int n) { xManaCostPaid = n; } /** - *

Getter for the field xManaCostPaid.

- * + *

+ * Getter for the field xManaCostPaid. + *

+ * * @return a int. */ public final int getXManaCostPaid() { @@ -561,39 +683,50 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field xLifePaid.

- * - * @param n a int. + *

+ * Setter for the field xLifePaid. + *

+ * + * @param n + * a int. */ public final void setXLifePaid(final int n) { xLifePaid = n; } /** - *

Getter for the field xLifePaid.

- * + *

+ * Getter for the field xLifePaid. + *

+ * * @return a int. */ public final int getXLifePaid() { return xLifePaid; } - //used to see if an attacking creature with a triggering attack ability triggered this phase: + // used to see if an attacking creature with a triggering attack ability + // triggered this phase: /** - *

Setter for the field creatureAttackedThisCombat.

- * - * @param b a boolean. + *

+ * Setter for the field creatureAttackedThisCombat. + *

+ * + * @param b + * a boolean. */ public final void setCreatureAttackedThisCombat(final boolean b) { creatureAttackedThisCombat = b; - if (true == b) { + if (b) { setCreatureAttackedThisTurn(true); } } /** - *

Getter for the field creatureAttackedThisCombat.

- * + *

+ * Getter for the field creatureAttackedThisCombat. + *

+ * * @return a boolean. */ public final boolean getCreatureAttackedThisCombat() { @@ -601,17 +734,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field creatureAttackedThisTurn.

- * - * @param b a boolean. + *

+ * Setter for the field creatureAttackedThisTurn. + *

+ * + * @param b + * a boolean. */ public final void setCreatureAttackedThisTurn(final boolean b) { creatureAttackedThisTurn = b; } /** - *

Getter for the field creatureAttackedThisTurn.

- * + *

+ * Getter for the field creatureAttackedThisTurn. + *

+ * * @return a boolean. */ public final boolean getCreatureAttackedThisTurn() { @@ -619,17 +757,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field creatureBlockedThisCombat.

- * - * @param b a boolean. + *

+ * Setter for the field creatureBlockedThisCombat. + *

+ * + * @param b + * a boolean. */ public final void setCreatureBlockedThisCombat(final boolean b) { creatureBlockedThisCombat = b; } /** - *

Getter for the field creatureBlockedThisCombat.

- * + *

+ * Getter for the field creatureBlockedThisCombat. + *

+ * * @return a boolean. */ public final boolean getCreatureBlockedThisCombat() { @@ -637,17 +780,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field creatureGotBlockedThisCombat.

- * - * @param b a boolean. + *

+ * Setter for the field creatureGotBlockedThisCombat. + *

+ * + * @param b + * a boolean. */ public final void setCreatureGotBlockedThisCombat(final boolean b) { creatureGotBlockedThisCombat = b; } /** - *

Getter for the field creatureGotBlockedThisCombat.

- * + *

+ * Getter for the field creatureGotBlockedThisCombat. + *

+ * * @return a boolean. */ public final boolean getCreatureGotBlockedThisCombat() { @@ -655,8 +803,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

canAnyPlayerActivate.

- * + *

+ * canAnyPlayerActivate. + *

+ * * @return a boolean. */ public final boolean canAnyPlayerActivate() { @@ -669,17 +819,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field dealtDmgToHumanThisTurn.

- * - * @param b a boolean. + *

+ * Setter for the field dealtDmgToHumanThisTurn. + *

+ * + * @param b + * a boolean. */ public final void setDealtDmgToHumanThisTurn(final boolean b) { dealtDmgToHumanThisTurn = b; } /** - *

Getter for the field dealtDmgToHumanThisTurn.

- * + *

+ * Getter for the field dealtDmgToHumanThisTurn. + *

+ * * @return a boolean. */ public final boolean getDealtDmgToHumanThisTurn() { @@ -687,17 +842,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field dealtDmgToComputerThisTurn.

- * - * @param b a boolean. + *

+ * Setter for the field dealtDmgToComputerThisTurn. + *

+ * + * @param b + * a boolean. */ public final void setDealtDmgToComputerThisTurn(final boolean b) { dealtDmgToComputerThisTurn = b; } /** - *

Getter for the field dealtDmgToComputerThisTurn.

- * + *

+ * Getter for the field dealtDmgToComputerThisTurn. + *

+ * * @return a boolean. */ public final boolean getDealtDmgToComputerThisTurn() { @@ -705,58 +865,66 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field sirenAttackOrDestroy.

- * - * @param b a boolean. + *

+ * Setter for the field sirenAttackOrDestroy. + *

+ * + * @param b + * a boolean. */ public final void setSirenAttackOrDestroy(final boolean b) { sirenAttackOrDestroy = b; } /** - *

Getter for the field sirenAttackOrDestroy.

- * + *

+ * Getter for the field sirenAttackOrDestroy. + *

+ * * @return a boolean. */ public final boolean getSirenAttackOrDestroy() { return sirenAttackOrDestroy; } - + /** - * a Card that this Card must block if able in an upcoming combat. - * This is cleared at the end of each turn. + * a Card that this Card must block if able in an upcoming combat. This is + * cleared at the end of each turn. * - * @param o Card to block + * @param c + * Card to block * * @since 1.1.6 */ - public void addMustBlockCard(Card c) { + public final void addMustBlockCard(final Card c) { mustBlockCards.add(c); } - + /** - * get the Card that this Card must block this combat + * get the Card that this Card must block this combat. * * @return the Cards to block (if able) * * @since 1.1.6 */ - public ArrayList getMustBlockCards() { + public final ArrayList getMustBlockCards() { return mustBlockCards; } - + /** - * clear the list of Cards that this Card must block this combat + * clear the list of Cards that this Card must block this combat. * * @since 1.1.6 */ - public void clearMustBlockCards() { + public final void clearMustBlockCards() { mustBlockCards.clear(); } /** - *

Getter for the field clones.

- * + *

+ * Getter for the field clones. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getClones() { @@ -764,9 +932,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field clones.

- * - * @param c a {@link java.util.ArrayList} object. + *

+ * Setter for the field clones. + *

+ * + * @param c + * a {@link java.util.ArrayList} object. */ public final void setClones(final ArrayList c) { clones.clear(); @@ -774,33 +945,43 @@ public class Card extends GameEntity implements Comparable { } /** - *

addClone.

- * - * @param c a {@link forge.Card} object. + *

+ * addClone. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void addClone(final Card c) { clones.add(c); } /** - *

addClones.

- * - * @param c a {@link java.util.ArrayList} object. + *

+ * addClones. + *

+ * + * @param c + * a {@link java.util.ArrayList} object. */ public final void addClones(final ArrayList c) { clones.addAll(c); } /** - *

clearClones.

+ *

+ * clearClones. + *

*/ public final void clearClones() { clones.clear(); } /** - *

Getter for the field cloneOrigin.

- * + *

+ * Getter for the field cloneOrigin. + *

+ * * @return a {@link forge.Card} object. */ public final Card getCloneOrigin() { @@ -808,17 +989,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field cloneOrigin.

- * - * @param name a {@link forge.Card} object. + *

+ * Setter for the field cloneOrigin. + *

+ * + * @param name + * a {@link forge.Card} object. */ public final void setCloneOrigin(final Card name) { cloneOrigin = name; } /** - *

Getter for the field cloneLeavesPlayCommand.

- * + *

+ * Getter for the field cloneLeavesPlayCommand. + *

+ * * @return a {@link forge.Command} object. */ public final Command getCloneLeavesPlayCommand() { @@ -826,17 +1012,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field cloneLeavesPlayCommand.

- * - * @param com a {@link forge.Command} object. + *

+ * Setter for the field cloneLeavesPlayCommand. + *

+ * + * @param com + * a {@link forge.Command} object. */ public final void setCloneLeavesPlayCommand(final Command com) { cloneLeavesPlayCommand = com; } /** - *

Getter for the field currentlyCloningCard.

- * + *

+ * Getter for the field currentlyCloningCard. + *

+ * * @return a {@link forge.Card} object. */ public final Card getCurrentlyCloningCard() { @@ -844,17 +1035,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field currentlyCloningCard.

- * - * @param c a {@link forge.Card} object. + *

+ * Setter for the field currentlyCloningCard. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void setCurrentlyCloningCard(final Card c) { currentlyCloningCard = c; } /** - *

Getter for the field sacrificeAtEOT.

- * + *

+ * Getter for the field sacrificeAtEOT. + *

+ * * @return a boolean. */ public final boolean getSacrificeAtEOT() { @@ -862,8 +1058,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field bounceAtUntap.

- * + *

+ * Getter for the field bounceAtUntap. + *

+ * * @return a boolean. */ public final boolean getBounceAtUntap() { @@ -871,17 +1069,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field bounceAtUntap.

- * - * @param bounce a boolean. + *

+ * Setter for the field bounceAtUntap. + *

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

Getter for the field finishedEnteringBF.

- * + *

+ * Getter for the field finishedEnteringBF. + *

+ * * @return a boolean. */ public final boolean getFinishedEnteringBF() { @@ -889,17 +1092,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field finishedEnteringBF.

- * - * @param b a boolean. + *

+ * Setter for the field finishedEnteringBF. + *

+ * + * @param b + * a boolean. */ public final void setFinishedEnteringBF(final boolean b) { this.finishedEnteringBF = b; } /** - *

hasFirstStrike.

- * + *

+ * hasFirstStrike. + *

+ * * @return a boolean. */ public final boolean hasFirstStrike() { @@ -907,8 +1115,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

hasDoubleStrike.

- * + *

+ * hasDoubleStrike. + *

+ * * @return a boolean. */ public final boolean hasDoubleStrike() { @@ -916,20 +1126,26 @@ public class Card extends GameEntity implements Comparable { } /** - *

hasSecondStrike.

- * + *

+ * hasSecondStrike. + *

+ * * @return a boolean. */ public final boolean hasSecondStrike() { return hasDoubleStrike() || !hasFirstStrike(); } - //for costs (like Planeswalker abilities) Doubling Season gets ignored. + // for costs (like Planeswalker abilities) Doubling Season gets ignored. /** - *

addCounterFromNonEffect.

- * - * @param counterName a {@link forge.Counters} object. - * @param n a int. + *

+ * addCounterFromNonEffect. + *

+ * + * @param counterName + * a {@link forge.Counters} object. + * @param n + * a int. */ public final void addCounterFromNonEffect(final Counters counterName, final int n) { if (this.hasKeyword("CARDNAME can't have counters placed on it.")) { @@ -972,27 +1188,30 @@ public class Card extends GameEntity implements Comparable { } } - ///////////////// + // /////////////// // // Not sure if we want to fire triggers on addCounterFromNonEffect // I don't think so since reverting cost payments uses this. /* - //Run triggers - HashMap runParams = new HashMap(); - runParams.put("Card", this); - runParams.put("CounterType", counterName); - AllZone.getTriggerHandler().runTrigger("CounterAdded", runParams); - */ + * //Run triggers HashMap runParams = new + * HashMap(); runParams.put("Card", this); + * runParams.put("CounterType", counterName); + * AllZone.getTriggerHandler().runTrigger("CounterAdded", runParams); + */ this.updateObservers(); } /** - *

addCounter.

- * - * @param counterName a {@link forge.Counters} object. - * @param n a int. + *

+ * addCounter. + *

+ * + * @param counterName + * a {@link forge.Counters} object. + * @param n + * a int. */ public final void addCounter(final Counters counterName, final int n) { if (this.hasKeyword("CARDNAME can't have counters placed on it.")) { @@ -1009,7 +1228,7 @@ public class Card extends GameEntity implements Comparable { counters.put(counterName, Integer.valueOf(multiplier * n)); } - //Run triggers + // Run triggers Map runParams = new TreeMap(); runParams.put("Card", this); runParams.put("CounterType", counterName); @@ -1050,10 +1269,14 @@ public class Card extends GameEntity implements Comparable { } /** - *

subtractCounter.

- * - * @param counterName a {@link forge.Counters} object. - * @param n a int. + *

+ * subtractCounter. + *

+ * + * @param counterName + * a {@link forge.Counters} object. + * @param n + * a int. */ public final void subtractCounter(final Counters counterName, final int n) { if (counters.containsKey(counterName)) { @@ -1088,9 +1311,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field counters.

- * - * @param counterName a {@link forge.Counters} object. + *

+ * Getter for the field counters. + *

+ * + * @param counterName + * a {@link forge.Counters} object. * @return a int. */ public final int getCounters(final Counters counterName) { @@ -1101,10 +1327,12 @@ public class Card extends GameEntity implements Comparable { } } - //get all counters from a card + // get all counters from a card /** - *

Getter for the field counters.

- * + *

+ * Getter for the field counters. + *

+ * * @return a Map object. * @since 1.0.15 */ @@ -1113,28 +1341,40 @@ public class Card extends GameEntity implements Comparable { } /** - *

hasCounters.

- * + *

+ * hasCounters. + *

+ * * @return a boolean. */ public final boolean hasCounters() { return counters.size() > 0; } - + + /** + * + * getNumberOfCounters. + * @return int + */ public final int getNumberOfCounters() { int number = 0; - for(Integer i : counters.values()) { + for (Integer i : counters.values()) { number += i.intValue(); } return number; } /** - *

setCounter.

- * - * @param counterName a {@link forge.Counters} object. - * @param n a int. - * @param bSetValue a boolean. + *

+ * setCounter. + *

+ * + * @param counterName + * a {@link forge.Counters} object. + * @param n + * a int. + * @param bSetValue + * a boolean. */ public final void setCounter(final Counters counterName, final int n, final boolean bSetValue) { if (this.hasKeyword("CARDNAME can't have counters placed on it.")) { @@ -1143,11 +1383,11 @@ public class Card extends GameEntity implements Comparable { if (this.hasKeyword("CARDNAME can't have -1/-1 counters placed on it.") && counterName.equals(Counters.M1M1)) { return; } - // sometimes you just need to set the value without being affected by DoublingSeason + // sometimes you just need to set the value without being affected by + // DoublingSeason if (bSetValue) { counters.put(counterName, Integer.valueOf(n)); - } - else { + } else { int num = getCounters(counterName); // if counters on card is less than the setting value, addCounters if (num < n) { @@ -1159,21 +1399,26 @@ public class Card extends GameEntity implements Comparable { this.updateObservers(); } - //get all counters from a card + // get all counters from a card /** - *

Setter for the field counters.

- * - * @param allCounters a Map object. + *

+ * Setter for the field counters. + *

+ * + * @param allCounters + * a Map object. * @since 1.0.15 */ public final void setCounters(final Map allCounters) { counters = allCounters; } - //get all counters from a card + // get all counters from a card /** - *

clearCounters.

- * + *

+ * clearCounters. + *

+ * * @since 1.0.15 */ public final void clearCounters() { @@ -1181,8 +1426,9 @@ public class Card extends GameEntity implements Comparable { } /** - * hasLevelUp() - checks to see if a creature has the "Level up" ability introduced in Rise of the Eldrazi. - * + * hasLevelUp() - checks to see if a creature has the "Level up" ability + * introduced in Rise of the Eldrazi. + * * @return true if this creature can "Level up", false otherwise */ public final boolean hasLevelUp() { @@ -1190,18 +1436,24 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field levelUp.

- * - * @param b a boolean. + *

+ * Setter for the field levelUp. + *

+ * + * @param b + * a boolean. */ public final void setLevelUp(final boolean b) { levelUp = b; } /** - *

getSVar.

- * - * @param var a {@link java.lang.String} object. + *

+ * getSVar. + *

+ * + * @param var + * a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public final String getSVar(final String var) { @@ -1213,10 +1465,14 @@ public class Card extends GameEntity implements Comparable { } /** - *

setSVar.

- * - * @param var a {@link java.lang.String} object. - * @param str a {@link java.lang.String} object. + *

+ * setSVar. + *

+ * + * @param var + * a {@link java.lang.String} object. + * @param str + * a {@link java.lang.String} object. */ public final void setSVar(final String var, final String str) { if (getCharacteristics().getsVars().containsKey(var)) { @@ -1227,8 +1483,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getSVars.

- * + *

+ * getSVars. + *

+ * * @return a Map object. */ public final Map getSVars() { @@ -1236,17 +1494,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setSVars.

- * - * @param newSVars a Map object. + *

+ * setSVars. + *

+ * + * @param newSVars + * a Map object. */ public final void setSVars(final Map newSVars) { getCharacteristics().setsVars(newSVars); } /** - *

sumAllCounters.

- * + *

+ * sumAllCounters. + *

+ * * @return a int. */ public final int sumAllCounters() { @@ -1261,8 +1524,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getNetPTCounters.

- * + *

+ * getNetPTCounters. + *

+ * * @return a int. */ public final int getNetPTCounters() { @@ -1270,8 +1535,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field turnInZone.

- * + *

+ * Getter for the field turnInZone. + *

+ * * @return a int. */ public final int getTurnInZone() { @@ -1279,26 +1546,34 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field turnInZone.

- * - * @param turn a int. + *

+ * Setter for the field turnInZone. + *

+ * + * @param turn + * a int. */ public final void setTurnInZone(final int turn) { turnInZone = turn; } /** - *

Setter for the field echoCost.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field echoCost. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setEchoCost(final String s) { echoCost = s; } /** - *

Getter for the field echoCost.

- * + *

+ * Getter for the field echoCost. + *

+ * * @return a {@link java.lang.String} object. */ public final String getEchoCost() { @@ -1306,17 +1581,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field manaCost.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field manaCost. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setManaCost(final String s) { getCharacteristics().setManaCost(s); } /** - *

Getter for the field manaCost.

- * + *

+ * Getter for the field manaCost. + *

+ * * @return a {@link java.lang.String} object. */ public final String getManaCost() { @@ -1324,9 +1604,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addColor.

- * - * @param s a {@link java.lang.String} object. + *

+ * addColor. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void addColor(String s) { if (s.equals("")) { @@ -1336,12 +1619,18 @@ public class Card extends GameEntity implements Comparable { } /** - *

addColor.

- * - * @param s a {@link java.lang.String} object. - * @param c a {@link forge.Card} object. - * @param addToColors a boolean. - * @param bIncrease a boolean. + *

+ * addColor. + *

+ * + * @param s + * a {@link java.lang.String} object. + * @param c + * a {@link forge.Card} object. + * @param addToColors + * a boolean. + * @param bIncrease + * a boolean. * @return a long. */ public final long addColor(final String s, final Card c, final boolean addToColors, final boolean bIncrease) { @@ -1353,12 +1642,18 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeColor.

- * - * @param s a {@link java.lang.String} object. - * @param c a {@link forge.Card} object. - * @param addTo a boolean. - * @param timestampIn a long. + *

+ * removeColor. + *

+ * + * @param s + * a {@link java.lang.String} object. + * @param c + * a {@link forge.Card} object. + * @param addTo + * a boolean. + * @param timestampIn + * a long. */ public final void removeColor(final String s, final Card c, final boolean addTo, final long timestampIn) { Card_Color removeCol = null; @@ -1374,8 +1669,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

determineColor.

- * + *

+ * determineColor. + *

+ * * @return a {@link forge.Card_Color} object. */ public final Card_Color determineColor() { @@ -1390,17 +1687,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setColor.

- * - * @param colors a {@link java.util.ArrayList} object. + *

+ * setColor. + *

+ * + * @param colors + * a {@link java.util.ArrayList} object. */ public final void setColor(final ArrayList colors) { getCharacteristics().setCardColor(colors); } /** - *

getColor.

- * + *

+ * getColor. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getColor() { @@ -1410,14 +1712,18 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param globalChanges an ArrayList + * + * @param globalChanges + * an ArrayList * @return a Card_Color */ final Card_Color determineColor(final ArrayList globalChanges) { Card_Color colors = new Card_Color(this); int i = getCharacteristics().getCardColor().size() - 1; int j = -1; - if (globalChanges != null) { j = globalChanges.size() - 1; } + if (globalChanges != null) { + j = globalChanges.size() - 1; + } // if both have changes, see which one is most recent while (i >= 0 && j >= 0) { Card_Color cc = null; @@ -1463,17 +1769,21 @@ public class Card extends GameEntity implements Comparable { } /** - *

getCMC.

- * + *

+ * getCMC. + *

+ * * @return a int. */ public final int getCMC() { return CardUtil.getConvertedManaCost(getCharacteristics().getManaCost()); } - + /** - *

Getter for the field chosenPlayer.

- * + *

+ * Getter for the field chosenPlayer. + *

+ * * @return a Player * @since 1.1.6 */ @@ -1482,18 +1792,23 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field chosenNumber.

- * - * @param s an int + *

+ * Setter for the field chosenNumber. + *

+ * + * @param p + * an int * @since 1.1.6 */ public final void setChosenPlayer(final Player p) { chosenPlayer = p; } - + /** - *

Getter for the field chosenNumber.

- * + *

+ * Getter for the field chosenNumber. + *

+ * * @return an int */ public final int getChosenNumber() { @@ -1501,18 +1816,23 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field chosenNumber.

- * - * @param s an int + *

+ * Setter for the field chosenNumber. + *

+ * + * @param i + * an int */ public final void setChosenNumber(final int i) { chosenNumber = i; } - //used for cards like Belbe's Portal, Conspiracy, Cover of Darkness, etc. + // used for cards like Belbe's Portal, Conspiracy, Cover of Darkness, etc. /** - *

Getter for the field chosenType.

- * + *

+ * Getter for the field chosenType. + *

+ * * @return a {@link java.lang.String} object. */ public final String getChosenType() { @@ -1520,17 +1840,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field chosenType.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field chosenType. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setChosenType(final String s) { chosenType = s; } /** - *

Getter for the field chosenColor.

- * + *

+ * Getter for the field chosenColor. + *

+ * * @return an ArrayList object. */ public final ArrayList getChosenColor() { @@ -1538,18 +1863,23 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field chosenColor.

- * - * @param s an ArrayList object. + *

+ * Setter for the field chosenColor. + *

+ * + * @param s + * an ArrayList object. */ public final void setChosenColor(final ArrayList s) { chosenColor = s; } - //used for cards like Meddling Mage... + // used for cards like Meddling Mage... /** - *

Getter for the field namedCard.

- * + *

+ * Getter for the field namedCard. + *

+ * * @return a {@link java.lang.String} object. */ public final String getNamedCard() { @@ -1557,26 +1887,34 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field namedCard.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field namedCard. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setNamedCard(final String s) { namedCard = s; } /** - *

Setter for the field drawnThisTurn.

- * - * @param b a boolean. + *

+ * Setter for the field drawnThisTurn. + *

+ * + * @param b + * a boolean. */ public final void setDrawnThisTurn(final boolean b) { drawnThisTurn = b; } /** - *

Getter for the field drawnThisTurn.

- * + *

+ * Getter for the field drawnThisTurn. + *

+ * * @return a boolean. */ public final boolean getDrawnThisTurn() { @@ -1587,7 +1925,7 @@ public class Card extends GameEntity implements Comparable { * get a list of Cards this card has gained control of. *

* used primarily with AbilityFactory_GainControl - * + * * @return a list of cards this card has gained control of */ public final ArrayList getGainControlTargets() { @@ -1598,10 +1936,11 @@ public class Card extends GameEntity implements Comparable { * add a Card to the list of Cards this card has gained control of. *

* used primarily with AbilityFactory_GainControl - * - * @param c a {@link forge.Card} object. + * + * @param c + * a {@link forge.Card} object. */ - public final void addGainControlTarget(Card c) { + public final void addGainControlTarget(final Card c) { gainControlTargets.add(c); } @@ -1615,11 +1954,12 @@ public class Card extends GameEntity implements Comparable { } /** - * get the commands to be executed to lose control of Cards this - * card has gained control of. + * get the commands to be executed to lose control of Cards this card has + * gained control of. *

- * used primarily with AbilityFactory_GainControl (Old Man of the Sea specifically) - * + * used primarily with AbilityFactory_GainControl (Old Man of the Sea + * specifically) + * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getGainControlReleaseCommands() { @@ -1627,27 +1967,33 @@ public class Card extends GameEntity implements Comparable { } /** - * set a command to be executed to lose control of Cards this - * card has gained control of. + * set a command to be executed to lose control of Cards this card has + * gained control of. *

- * used primarily with AbilityFactory_GainControl (Old Man of the Sea specifically) - * - * @param c the Command to be executed + * used primarily with AbilityFactory_GainControl (Old Man of the Sea + * specifically) + * + * @param c + * the Command to be executed */ public final void addGainControlReleaseCommand(final Command c) { gainControlReleaseCommands.add(c); } /** - *

clearGainControlReleaseCommands.

+ *

+ * clearGainControlReleaseCommands. + *

*/ public final void clearGainControlReleaseCommands() { gainControlReleaseCommands.clear(); } /** - *

getSpellText.

- * + *

+ * getSpellText. + *

+ * * @return a {@link java.lang.String} object. */ public final String getSpellText() { @@ -1655,9 +2001,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field text.

- * - * @param t a {@link java.lang.String} object. + *

+ * Setter for the field text. + *

+ * + * @param t + * a {@link java.lang.String} object. */ public final void setText(final String t) { text = t; @@ -1665,8 +2014,10 @@ public class Card extends GameEntity implements Comparable { // get the text that should be displayed /** - *

Getter for the field text.

- * + *

+ * Getter for the field text. + *

+ * * @return a {@link java.lang.String} object. */ public String getText() { @@ -1681,10 +2032,13 @@ public class Card extends GameEntity implements Comparable { return sb.toString(); } - // get the text that does not belong to a cards abilities (and is not really there rules-wise) + // get the text that does not belong to a cards abilities (and is not really + // there rules-wise) /** - *

getNonAbilityText.

- * + *

+ * getNonAbilityText. + *

+ * * @return a {@link java.lang.String} object. */ public final String getNonAbilityText() { @@ -1698,9 +2052,12 @@ public class Card extends GameEntity implements Comparable { // convert a keyword list to the String that should be displayed ingame /** - *

keywordsToText.

- * - * @param keyword a {@link java.util.ArrayList} object. + *

+ * keywordsToText. + *

+ * + * @param keyword + * a {@link java.util.ArrayList} object. * @return a {@link java.lang.String} object. */ public final String keywordsToText(final ArrayList keyword) { @@ -1710,14 +2067,11 @@ public class Card extends GameEntity implements Comparable { for (int i = 0; i < keyword.size(); i++) { if (!keyword.get(i).toString().contains("CostChange") - && - !keyword.get(i).toString().contains("Permanents don't untap during their controllers' untap steps") - && - !keyword.get(i).toString().contains("PreventAllDamageBy") - && - !keyword.get(i).toString().contains("CantBlock") - && - !keyword.get(i).toString().contains("CantBeBlockedBy")) + && !keyword.get(i).toString() + .contains("Permanents don't untap during their controllers' untap steps") + && !keyword.get(i).toString().contains("PreventAllDamageBy") + && !keyword.get(i).toString().contains("CantBlock") + && !keyword.get(i).toString().contains("CantBeBlockedBy")) { if (keyword.get(i).toString().contains("StaticEffect")) { String[] k = keyword.get(i).split(":"); @@ -1738,7 +2092,8 @@ public class Card extends GameEntity implements Comparable { || keyword.get(i).startsWith("Echo") || keyword.get(i).startsWith("Fading") || keyword.get(i).startsWith("Ripple") || keyword.get(i).startsWith("Unearth") || keyword.get(i).startsWith("Vanishing") || keyword.get(i).startsWith("Madness") - || keyword.get(i).startsWith("Devour")) { + || keyword.get(i).startsWith("Devour")) + { String k = keyword.get(i); k = k.replace(":", " "); sbLong.append(k).append("\r\n"); @@ -1753,17 +2108,17 @@ public class Card extends GameEntity implements Comparable { kk[1] = kk[1].toLowerCase(); } sbLong.append("Champion a"); - if (kk[1].toLowerCase().startsWith("a") - || kk[1].toLowerCase().startsWith("e") - || kk[1].toLowerCase().startsWith("i") - || kk[1].toLowerCase().startsWith("o") - || kk[1].toLowerCase().startsWith("u")) { + if (kk[1].toLowerCase().startsWith("a") || kk[1].toLowerCase().startsWith("e") + || kk[1].toLowerCase().startsWith("i") || kk[1].toLowerCase().startsWith("o") + || kk[1].toLowerCase().startsWith("u")) + { sbLong.append("n"); } sbLong.append(" ").append(types); sbLong.append(" (When this enters the battlefield, sacrifice it unless you exile another "); sbLong.append(types); - sbLong.append(" you control. When this leaves the battlefield, that card returns to the battlefield.)\r\n"); + sbLong.append(" you control. When this leaves the battlefield, "); + sbLong.append("that card returns to the battlefield.)\r\n"); } else if (keyword.get(i).endsWith(".") && !keyword.get(i).startsWith("Haunt")) { sbLong.append(keyword.get(i).toString()).append("\r\n"); } else if (keyword.get(i).contains("At the beginning of your upkeep, ") @@ -1775,7 +2130,8 @@ public class Card extends GameEntity implements Comparable { } else if (keyword.get(i).contains("Bloodthirst")) { String k = keyword.get(i); String[] kk = k.split(" "); - sbLong.append(keyword.get(i)).append(" (If an opponent was dealt damage this turn, this creature enters the battlefield with "); + sbLong.append(keyword.get(i)).append( + " (If an opponent was dealt damage this turn, this creature enters the battlefield with "); sbLong.append(kk[1]).append(" +1/+1 counter"); if (kk[1].equals("X")) { sbLong.append("s on it, where X is the damage dealt to your opponents this turn.)"); @@ -1791,20 +2147,21 @@ public class Card extends GameEntity implements Comparable { sbLong.append(keyword.get(i)); sbLong.append(" (This enters the battlefield with "); sbLong.append(numCounters); - sbLong.append(" +1/+1 counters on it. When it's put into a graveyard, you may put its +1/+1 counters on target artifact creature.)"); + sbLong.append(" +1/+1 counters on it. When it's put into a graveyard, "); + sbLong.append("you may put its +1/+1 counters on target artifact creature.)"); } else if (keyword.get(i).startsWith("Provoke")) { sbLong.append(keyword.get(i)); - sbLong.append(" (When this attacks, you may have target creature defending player controls untap and block it if able.)"); + sbLong.append(" (When this attacks, you may have target creature "); + sbLong.append("defending player controls untap and block it if able.)"); } else if (keyword.get(i).startsWith("MayEffectFromOpeningHand")) { continue; } else if (keyword.get(i).contains("Haunt")) { sb.append("\r\nHaunt ("); - if(isCreature()) { + if (isCreature()) { sb.append("When this creature dies, exile it haunting target creature."); - } - else - { - sb.append("When this spell card is put into a graveyard after resolving, exile it haunting target creature."); + } else { + sb.append("When this spell card is put into a graveyard after resolving, "); + sb.append("exile it haunting target creature."); } sb.append(")"); continue; @@ -1827,10 +2184,12 @@ public class Card extends GameEntity implements Comparable { return sb.toString(); } - //get the text of the abilities of a card + // get the text of the abilities of a card /** - *

getAbilityText.

- * + *

+ * getAbilityText. + *

+ * * @return a {@link java.lang.String} object. */ public String getAbilityText() { @@ -1841,7 +2200,6 @@ public class Card extends GameEntity implements Comparable { // Give spellText line breaks for easier reading sb.append(s.replaceAll("\\\\r\\\\n", "\r\n")); - // NOTE: if (sb.toString().contains(" (NOTE: ")) { sb.insert(sb.indexOf("(NOTE: "), "\r\n"); @@ -1868,8 +2226,8 @@ public class Card extends GameEntity implements Comparable { // static abilities for (StaticAbility stAb : getCharacteristics().getStaticAbilities()) { - String stAbD = stAb.toString(); - if (!stAbD.equals("")) { + String stAbD = stAb.toString(); + if (!stAbD.equals("")) { sb.append(stAbD + "\r\n"); } } @@ -1888,8 +2246,8 @@ public class Card extends GameEntity implements Comparable { // Changeling + CARDNAME can't be countered. + Cascade + Multikicker for (int i = 0; i < kw.size(); i++) { - if ((kw.get(i).contains("CARDNAME can't be countered.") - && !sb.toString().contains("CARDNAME can't be countered.")) + if ((kw.get(i).contains("CARDNAME can't be countered.") && !sb.toString().contains( + "CARDNAME can't be countered.")) || (kw.get(i).contains("Cascade") && !sb.toString().contains("Cascade")) || (kw.get(i).contains("Multikicker") && !sb.toString().contains("Multikicker"))) { @@ -1909,7 +2267,7 @@ public class Card extends GameEntity implements Comparable { sb.append(")\r\n"); } - //Replicate + // Replicate for (String keyw : kw) { if (keyw.contains("Replicate") && !sb.toString().contains("you paid its replicate cost.")) { if (sb.toString().endsWith("\r\n\r\n")) { @@ -1923,31 +2281,31 @@ public class Card extends GameEntity implements Comparable { sb.append(")\r\n"); } } - - for(String keyw : kw) { - if(keyw.startsWith("Haunt")) { + + for (String keyw : kw) { + if (keyw.startsWith("Haunt")) { if (sb.toString().endsWith("\r\n\r\n")) { sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); } sb.append("Haunt ("); - if(isCreature()) { + if (isCreature()) { sb.append("When this creature dies, exile it haunting target creature."); - } - else { - sb.append("When this spell card is put into a graveyard after resolving, exile it haunting target creature."); + } else { + sb.append("When this spell card is put into a graveyard after resolving, "); + sb.append("exile it haunting target creature."); } sb.append(")\r\n"); } } - - if(haunting != null) { + + if (haunting != null) { sb.append("Haunting: ").append(haunting); sb.append("\r\n"); } - + while (sb.toString().endsWith("\r\n")) { sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); - } + } return sb.toString().replaceAll("CARDNAME", getName()); } @@ -1963,11 +2321,10 @@ public class Card extends GameEntity implements Comparable { sb.append("\r\n"); /* - * if(isAura()) { - // Give spellText line breaks for easier reading - sb.append(getSpellText().replaceAll("\\\\r\\\\n", "\r\n")).append("\r\n"); - } - */ + * if(isAura()) { // Give spellText line breaks for easier reading + * sb.append(getSpellText().replaceAll("\\\\r\\\\n", + * "\r\n")).append("\r\n"); } + */ // Triggered abilities for (Trigger trig : getCharacteristics().getTriggers()) { @@ -1978,7 +2335,7 @@ public class Card extends GameEntity implements Comparable { // static abilities for (StaticAbility stAb : getCharacteristics().getStaticAbilities()) { - sb.append(stAb.toString() + "\r\n"); + sb.append(stAb.toString() + "\r\n"); } ArrayList addedManaStrings = new ArrayList(); @@ -2011,11 +2368,13 @@ public class Card extends GameEntity implements Comparable { } else if (!sAbility.endsWith(getName())) { sb.append(sAbility); sb.append("\r\n"); - // The test above appears to prevent the card name from showing and therefore - //it no longer needs to be deleted from the stringbuilder - //if (sb.toString().endsWith("CARDNAME")) - // sb.replace(sb.toString().lastIndexOf("CARDNAME"), - // sb.toString().lastIndexOf("CARDNAME") + name.length() - 1, ""); + // The test above appears to prevent the card name from showing + // and therefore + // it no longer needs to be deleted from the stringbuilder + // if (sb.toString().endsWith("CARDNAME")) + // sb.replace(sb.toString().lastIndexOf("CARDNAME"), + // sb.toString().lastIndexOf("CARDNAME") + name.length() - 1, + // ""); } } @@ -2038,7 +2397,7 @@ public class Card extends GameEntity implements Comparable { sb.replace(start, start + 4, "\r\n"); } - //Remembered cards + // Remembered cards if (rememberedObjects.size() > 0) { sb.append("\r\nRemembered: \r\n"); for (Object o : rememberedObjects) { @@ -2054,36 +2413,34 @@ public class Card extends GameEntity implements Comparable { sb.append("\r\n"); } } - - if(hauntedBy.size() != 0) { + + if (hauntedBy.size() != 0) { sb.append("Haunted by: "); - for(Card c : hauntedBy) { + for (Card c : hauntedBy) { sb.append(c).append(","); } - sb.deleteCharAt(sb.length()-1); + sb.deleteCharAt(sb.length() - 1); sb.append("\r\n"); } - - if(haunting != null) { + + if (haunting != null) { sb.append("Haunting: ").append(haunting); sb.append("\r\n"); } /* - sb.append("\r\nOwner: ").append(owner).append("\r\n"); - sb.append("Controller(s):"); - for(Object o : controllerObjects) - { - sb.append(o); - } - sb.append("\r\n"); - */ + * sb.append("\r\nOwner: ").append(owner).append("\r\n"); + * sb.append("Controller(s):"); for(Object o : controllerObjects) { + * sb.append(o); } sb.append("\r\n"); + */ return sb.toString().replaceAll("CARDNAME", getName()).trim(); - } //getText() + } // getText() /** - *

Getter for the field manaAbility.

- * + *

+ * Getter for the field manaAbility. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getManaAbility() { @@ -2092,15 +2449,17 @@ public class Card extends GameEntity implements Comparable { // Returns basic mana abilities plus "reflected mana" abilities /** - *

getAIPlayableMana.

- * + *

+ * getAIPlayableMana. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getAIPlayableMana() { ArrayList res = new ArrayList(); for (Ability_Mana am : getManaAbility()) { - //if a mana ability has a mana cost the AI will miscalculate + // if a mana ability has a mana cost the AI will miscalculate Cost cost = am.getPayCosts(); if (!cost.hasNoManaCost()) { continue; @@ -2118,33 +2477,40 @@ public class Card extends GameEntity implements Comparable { } /** - *

getBasicMana.

- * + *

+ * getBasicMana. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getBasicMana() { ArrayList res = new ArrayList(); - for (Ability_Mana am : getManaAbility()) + for (Ability_Mana am : getManaAbility()) { if (am.isBasic() && !res.contains(am)) { res.add(am); } + } return res; } /** - *

clearFirstSpellAbility.

+ *

+ * clearFirstSpellAbility. + *

*/ public final void clearFirstSpell() { - for(int i = 0; i < getCharacteristics().getSpellAbility().size(); i++) { - if (getCharacteristics().getSpellAbility().get(i).isSpell()) { - getCharacteristics().getSpellAbility().remove(i); - return; - } - } + for (int i = 0; i < getCharacteristics().getSpellAbility().size(); i++) { + if (getCharacteristics().getSpellAbility().get(i).isSpell()) { + getCharacteristics().getSpellAbility().remove(i); + return; + } + } } /** - *

clearAllButFirstSpellAbility.

+ *

+ * clearAllButFirstSpellAbility. + *

*/ public final void clearAllButFirstSpellAbility() { if (!getCharacteristics().getSpellAbility().isEmpty()) { @@ -2156,8 +2522,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getAllButFirstSpellAbility.

- * + *

+ * getAllButFirstSpellAbility. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getAllButFirstSpellAbility() { @@ -2173,7 +2541,9 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearSpellAbility.

+ *

+ * clearSpellAbility. + *

*/ public final void clearSpellAbility() { getCharacteristics().getSpellAbility().clear(); @@ -2181,8 +2551,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getSpellPermanent.

- * + *

+ * getSpellPermanent. + *

+ * * @return a {@link forge.card.spellability.Spell_Permanent} object. */ public final Spell_Permanent getSpellPermanent() { @@ -2195,24 +2567,30 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearSpellKeepManaAbility.

+ *

+ * clearSpellKeepManaAbility. + *

*/ public final void clearSpellKeepManaAbility() { getCharacteristics().getSpellAbility().clear(); } /** - *

clearManaAbility.

+ *

+ * clearManaAbility. + *

*/ public final void clearManaAbility() { getCharacteristics().getManaAbility().clear(); } - /** - *

addFirstSpellAbility.

- * - * @param a a {@link forge.card.spellability.SpellAbility} object. + *

+ * addFirstSpellAbility. + *

+ * + * @param a + * a {@link forge.card.spellability.SpellAbility} object. */ public final void addFirstSpellAbility(final SpellAbility a) { a.setSourceCard(this); @@ -2224,9 +2602,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addSpellAbility.

- * - * @param a a {@link forge.card.spellability.SpellAbility} object. + *

+ * addSpellAbility. + *

+ * + * @param a + * a {@link forge.card.spellability.SpellAbility} object. */ public final void addSpellAbility(final SpellAbility a) { a.setSourceCard(this); @@ -2238,26 +2619,30 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeSpellAbility.

- * - * @param a a {@link forge.card.spellability.SpellAbility} object. + *

+ * removeSpellAbility. + *

+ * + * @param a + * a {@link forge.card.spellability.SpellAbility} object. */ public final void removeSpellAbility(final SpellAbility a) { if (a instanceof Ability_Mana) { - //if (a.isExtrinsic()) //never remove intrinsic mana abilities, is this the way to go?? + // if (a.isExtrinsic()) //never remove intrinsic mana abilities, is + // this the way to go?? getCharacteristics().getManaAbility().remove(a); - } - else { + } else { getCharacteristics().getSpellAbility().remove(a); } } - /** - *

removeAllExtrinsicManaAbilities.

+ *

+ * removeAllExtrinsicManaAbilities. + *

*/ public final void removeAllExtrinsicManaAbilities() { - //temp ArrayList, otherwise ConcurrentModificationExceptions occur: + // temp ArrayList, otherwise ConcurrentModificationExceptions occur: ArrayList saList = new ArrayList(); for (SpellAbility var : getCharacteristics().getManaAbility()) { @@ -2271,24 +2656,30 @@ public class Card extends GameEntity implements Comparable { } /** - *

getIntrinsicManaAbilitiesDescriptions.

- * + *

+ * getIntrinsicManaAbilitiesDescriptions. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getIntrinsicManaAbilitiesDescriptions() { + public final ArrayList getIntrinsicManaAbilitiesDescriptions() { ArrayList list = new ArrayList(); for (SpellAbility var : getCharacteristics().getManaAbility()) { - if (var.isIntrinsic()) list.add(var.toString()); + if (var.isIntrinsic()) { + list.add(var.toString()); + } } return list; } /** - *

Getter for the field spellAbility.

- * + *

+ * Getter for the field spellAbility. + *

+ * * @return an array of {@link forge.card.spellability.SpellAbility} objects. */ - public SpellAbility[] getSpellAbility() { + public final SpellAbility[] getSpellAbility() { ArrayList res = new ArrayList(getCharacteristics().getSpellAbility()); res.addAll(getManaAbility()); SpellAbility[] s = new SpellAbility[res.size()]; @@ -2297,198 +2688,253 @@ public class Card extends GameEntity implements Comparable { } /** - *

getSpellAbilities.

- * + *

+ * getSpellAbilities. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getSpellAbilities() { + public final ArrayList getSpellAbilities() { ArrayList res = new ArrayList(getCharacteristics().getSpellAbility()); res.addAll(getManaAbility()); return res; } - - public ArrayList getAllSpellAbilities() { + + /** + * + * getAllSpellAbilities. + * @return ArrayList + */ + public final ArrayList getAllSpellAbilities() { ArrayList res = new ArrayList(getSpellAbilities()); - if(hasAlternateState()) { + if (hasAlternateState()) { changeState(); res.addAll(getSpellAbilities()); changeState(); } - + return res; } /** - *

getSpells.

- * + *

+ * getSpells. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getSpells() { + public final ArrayList getSpells() { ArrayList s = new ArrayList(getCharacteristics().getSpellAbility()); ArrayList res = new ArrayList(); for (SpellAbility sa : s) { - if (sa.isSpell()) res.add(sa); + if (sa.isSpell()) { + res.add(sa); + } } return res; } /** - *

getBasicSpells.

- * + *

+ * getBasicSpells. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getBasicSpells() { + public final ArrayList getBasicSpells() { ArrayList s = new ArrayList(getCharacteristics().getSpellAbility()); ArrayList res = new ArrayList(); for (SpellAbility sa : s) { - if (sa.isSpell() && !sa.isFlashBackAbility() && !sa.isBuyBackAbility()) res.add(sa); + if (sa.isSpell() && !sa.isFlashBackAbility() && !sa.isBuyBackAbility()) { + res.add(sa); + } } return res; } /** - *

getAdditionalCostSpells.

- * + *

+ * getAdditionalCostSpells. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getAdditionalCostSpells() { + public final ArrayList getAdditionalCostSpells() { ArrayList s = new ArrayList(getCharacteristics().getSpellAbility()); ArrayList res = new ArrayList(); for (SpellAbility sa : s) { - if (sa.isSpell() && !sa.getAdditionalManaCost().equals("")) res.add(sa); + if (sa.isSpell() && !sa.getAdditionalManaCost().equals("")) { + res.add(sa); + } } return res; } - //shield = regeneration + // shield = regeneration /** - *

setShield.

- * - * @param n a int. + *

+ * setShield. + *

+ * + * @param n + * a int. */ - public void setShield(int n) { + public final void setShield(final int n) { nShield = n; } /** - *

getShield.

- * + *

+ * getShield. + *

+ * * @return a int. */ - public int getShield() { + public final int getShield() { return nShield; } /** - *

addShield.

+ *

+ * addShield. + *

*/ - public void addShield() { + public final void addShield() { nShield++; } /** - *

subtractShield.

+ *

+ * subtractShield. + *

*/ - public void subtractShield() { + public final void subtractShield() { nShield--; } /** - *

resetShield.

+ *

+ * resetShield. + *

*/ - public void resetShield() { + public final void resetShield() { nShield = 0; } /** - *

canBeShielded.

- * + *

+ * canBeShielded. + *

+ * * @return a boolean. */ - public boolean canBeShielded() { + public final boolean canBeShielded() { return !hasKeyword("CARDNAME can't be regenerated."); } - //is this "Card" supposed to be a token? + // is this "Card" supposed to be a token? /** - *

Setter for the field token.

- * - * @param b a boolean. + *

+ * Setter for the field token. + *

+ * + * @param b + * a boolean. */ - public void setToken(boolean b) { + public final void setToken(final boolean b) { token = b; } /** - *

isToken.

- * + *

+ * isToken. + *

+ * * @return a boolean. */ - public boolean isToken() { + public final boolean isToken() { return token; } /** - *

Setter for the field copiedToken.

- * - * @param b a boolean. + *

+ * Setter for the field copiedToken. + *

+ * + * @param b + * a boolean. */ - public void setCopiedToken(boolean b) { + public final void setCopiedToken(final boolean b) { copiedToken = b; } /** - *

isCopiedToken.

- * + *

+ * isCopiedToken. + *

+ * * @return a boolean. */ - public boolean isCopiedToken() { + public final boolean isCopiedToken() { return copiedToken; } /** - *

Setter for the field copiedSpell.

- * - * @param b a boolean. + *

+ * Setter for the field copiedSpell. + *

+ * + * @param b + * a boolean. */ - public void setCopiedSpell(boolean b) { + public final void setCopiedSpell(final boolean b) { copiedSpell = b; } /** - *

isCopiedSpell.

- * + *

+ * isCopiedSpell. + *

+ * * @return a boolean. */ - public boolean isCopiedSpell() { + public final boolean isCopiedSpell() { return copiedSpell; } /** - *

addSpellChoice.

- * - * @param string a {@link java.lang.String} object. + *

+ * addSpellChoice. + *

+ * + * @param string + * a {@link java.lang.String} object. */ - public void addSpellChoice(String string) { + public final void addSpellChoice(final String string) { choicesMade.add(string); } /** - *

getChoices.

- * + *

+ * getChoices. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getChoices() { + public final ArrayList getChoices() { return choicesMade; } /** - *

getChoice.

- * - * @param i a int. + *

+ * getChoice. + *

+ * + * @param i + * a int. * @return a {@link java.lang.String} object. */ public final String getChoice(final int i) { @@ -2496,17 +2942,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setSpellChoiceTarget.

- * - * @param string a {@link java.lang.String} object. + *

+ * setSpellChoiceTarget. + *

+ * + * @param string + * a {@link java.lang.String} object. */ public final void setSpellChoiceTarget(final String string) { targetsForChoices.add(string); } /** - *

getChoiceTargets.

- * + *

+ * getChoiceTargets. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getChoiceTargets() { @@ -2514,9 +2965,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

getChoiceTarget.

- * - * @param i a int. + *

+ * getChoiceTarget. + *

+ * + * @param i + * a int. * @return a {@link java.lang.String} object. */ public final String getChoiceTarget(final int i) { @@ -2524,17 +2978,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setSpellWithChoices.

- * - * @param b a boolean. + *

+ * setSpellWithChoices. + *

+ * + * @param b + * a boolean. */ public final void setSpellWithChoices(final boolean b) { spellWithChoices = b; } /** - *

hasChoices.

- * + *

+ * hasChoices. + *

+ * * @return a boolean. */ public final boolean hasChoices() { @@ -2542,17 +3001,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setCopiesSpells.

- * - * @param b a boolean. + *

+ * setCopiesSpells. + *

+ * + * @param b + * a boolean. */ public final void setCopiesSpells(final boolean b) { spellCopyingCard = b; } /** - *

copiesSpells.

- * + *

+ * copiesSpells. + *

+ * * @return a boolean. */ public final boolean copiesSpells() { @@ -2560,17 +3024,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setIsFaceDown.

- * - * @param b a boolean. + *

+ * setIsFaceDown. + *

+ * + * @param b + * a boolean. */ public final void setIsFaceDown(final boolean b) { faceDown = b; } /** - *

isFaceDown.

- * + *

+ * isFaceDown. + *

+ * * @return a boolean. */ public final boolean isFaceDown() { @@ -2578,15 +3047,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setCanMorph.

- * @param b a boolean. + *

+ * setCanMorph. + *

+ * + * @param b + * a boolean. */ public final void setCanMorph(final boolean b) { canMorph = b; } /** - *

getCanMorph.

+ *

+ * getCanMorph. + *

+ * * @return a boolean. */ public final boolean getCanMorph() { @@ -2594,29 +3070,40 @@ public class Card extends GameEntity implements Comparable { } /** - *

addTrigger.

- * - * @param c a {@link forge.Command} object. - * @param typeIn a {@link forge.ZCTrigger} object. + *

+ * addTrigger. + *

+ * + * @param c + * a {@link forge.Command} object. + * @param typeIn + * a {@link forge.ZCTrigger} object. */ public final void addTrigger(final Command c, final ZCTrigger typeIn) { zcTriggers.add(new Ability_Triggered(this, c, typeIn)); } /** - *

removeTrigger.

- * - * @param c a {@link forge.Command} object. - * @param typeIn a {@link forge.ZCTrigger} object. + *

+ * removeTrigger. + *

+ * + * @param c + * a {@link forge.Command} object. + * @param typeIn + * a {@link forge.ZCTrigger} object. */ public final void removeTrigger(final Command c, final ZCTrigger typeIn) { zcTriggers.remove(new Ability_Triggered(this, c, typeIn)); } /** - *

executeTrigger.

- * - * @param type a {@link forge.ZCTrigger} object. + *

+ * executeTrigger. + *

+ * + * @param type + * a {@link forge.ZCTrigger} object. */ public final void executeTrigger(final ZCTrigger type) { for (Ability_Triggered t : zcTriggers) { @@ -2627,107 +3114,141 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearTriggers.

+ *

+ * clearTriggers. + *

*/ public final void clearTriggers() { zcTriggers.clear(); } /** - *

addComesIntoPlayCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addComesIntoPlayCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addComesIntoPlayCommand(final Command c) { addTrigger(c, ZCTrigger.ENTERFIELD); } /** - *

removeComesIntoPlayCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * removeComesIntoPlayCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void removeComesIntoPlayCommand(final Command c) { removeTrigger(c, ZCTrigger.ENTERFIELD); } /** - *

comesIntoPlay.

+ *

+ * comesIntoPlay. + *

*/ public final void comesIntoPlay() { executeTrigger(ZCTrigger.ENTERFIELD); } /** - *

addDestroyCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addDestroyCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addDestroyCommand(final Command c) { addTrigger(c, ZCTrigger.DESTROY); } /** - *

removeDestroyCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * removeDestroyCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void removeDestroyCommand(final Command c) { removeTrigger(c, ZCTrigger.DESTROY); } /** - *

destroy.

+ *

+ * destroy. + *

*/ public final void destroy() { executeTrigger(ZCTrigger.DESTROY); } /** - *

addLeavesPlayCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addLeavesPlayCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addLeavesPlayCommand(final Command c) { addTrigger(c, ZCTrigger.LEAVEFIELD); } /** - *

removeLeavesPlayCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * removeLeavesPlayCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void removeLeavesPlayCommand(final Command c) { removeTrigger(c, ZCTrigger.LEAVEFIELD); } /** - *

leavesPlay.

+ *

+ * leavesPlay. + *

*/ public final void leavesPlay() { executeTrigger(ZCTrigger.LEAVEFIELD); } /** - *

addEquipCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addEquipCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addEquipCommand(final Command c) { equipCommandList.add(c); } /** - *

removeEquipCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * removeEquipCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void removeEquipCommand(final Command c) { equipCommandList.remove(c); } /** - *

equip.

+ *

+ * equip. + *

*/ public final void equip() { for (Command var : equipCommandList) { @@ -2736,25 +3257,33 @@ public class Card extends GameEntity implements Comparable { } /** - *

addUnEquipCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addUnEquipCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addUnEquipCommand(final Command c) { unEquipCommandList.add(c); } /** - *

removeUnEquipCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * removeUnEquipCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void removeUnEquipCommand(final Command c) { unEquipCommandList.remove(c); } /** - *

unEquip.

+ *

+ * unEquip. + *

*/ public final void unEquip() { for (Command var : unEquipCommandList) { @@ -2763,23 +3292,30 @@ public class Card extends GameEntity implements Comparable { } /** - *

addEnchantCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addEnchantCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addEnchantCommand(final Command c) { enchantCommandList.add(c); } /** - *

clearEnchantCommand.

+ *

+ * clearEnchantCommand. + *

*/ public final void clearEnchantCommand() { enchantCommandList.clear(); } /** - *

enchant.

+ *

+ * enchant. + *

*/ public final void enchant() { for (Command var : enchantCommandList) { @@ -2788,76 +3324,110 @@ public class Card extends GameEntity implements Comparable { } /** - *

addUnEnchantCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addUnEnchantCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ public final void addUnEnchantCommand(final Command c) { unEnchantCommandList.add(c); } /** - *

clearUnEnchantCommand.

+ *

+ * clearUnEnchantCommand. + *

*/ public final void clearUnEnchantCommand() { unEnchantCommandList.clear(); } /** - *

unEnchant.

+ *

+ * unEnchant. + *

*/ public final void unEnchant() { - for (Command var : unEnchantCommandList) + for (Command var : unEnchantCommandList) { var.execute(); + } } /** - *

addUntapCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addUntapCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ - public final void addUntapCommand(Command c) { + public final void addUntapCommand(final Command c) { untapCommandList.add(c); } /** - *

addChangeControllerCommand.

- * - * @param c a {@link forge.Command} object. + *

+ * addChangeControllerCommand. + *

+ * + * @param c + * a {@link forge.Command} object. */ - public final void addChangeControllerCommand(Command c) { + public final void addChangeControllerCommand(final Command c) { changeControllerCommandList.add(c); } /** - *

Setter for the field sickness.

- * - * @param b a boolean. + *

+ * Setter for the field sickness. + *

+ * + * @param b + * a boolean. */ public final void setSickness(final boolean b) { sickness = b; } /** - *

hasSickness.

- * + *

+ * hasSickness. + *

+ * * @return a boolean. */ - public final boolean hasSickness() { return !hasKeyword("Haste") && sickness; } - public final boolean isSick() { return !hasKeyword("Haste") && sickness && isCreature(); } - + public final boolean hasSickness() { + return !hasKeyword("Haste") && sickness; + } + /** - *

Setter for the field imageName.

- * - * @param s a {@link java.lang.String} object. + * + * isSick. + * @return boolean + */ + public final boolean isSick() { + return !hasKeyword("Haste") && sickness && isCreature(); + } + + /** + *

+ * Setter for the field imageName. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setImageName(final String s) { imageName = s; } /** - *

Getter for the field imageName.

- * + *

+ * Getter for the field imageName. + *

+ * * @return a {@link java.lang.String} object. */ public final String getImageName() { @@ -2868,8 +3438,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field owner.

- * + *

+ * Getter for the field owner. + *

+ * * @return a {@link forge.Player} object. */ public final Player getOwner() { @@ -2878,7 +3450,7 @@ public class Card extends GameEntity implements Comparable { /** * TODO write a javadoc for this method. - * + * * @return a {@link forge.Player} object. */ public final Player getController() { @@ -2888,8 +3460,7 @@ public class Card extends GameEntity implements Comparable { Object topController = controllerObjects.get(controllerObjects.size() - 1); if (topController instanceof Player) { return (Player) topController; - } - else { + } else { return ((Card) topController).getController(); } } @@ -2897,11 +3468,13 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param controllerObject an Object + * + * @param controllerObject + * an Object */ public final void addController(final Object controllerObject) { - Object prevController = controllerObjects.size() == 0 ? owner - : controllerObjects.get(controllerObjects.size() - 1); + Object prevController = controllerObjects.size() == 0 ? owner : controllerObjects + .get(controllerObjects.size() - 1); if (!controllerObject.equals(prevController)) { if (controllerObject instanceof Player) { for (int i = 0; i < controllerObjects.size(); i++) { @@ -2915,7 +3488,6 @@ public class Card extends GameEntity implements Comparable { AllZone.getGameAction().controllerChangeZoneCorrection(this); } - if (prevController != null) { for (Command c : changeControllerCommandList) { c.execute(); @@ -2929,7 +3501,9 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param controllerObject a Object + * + * @param controllerObject + * a Object */ public final void removeController(final Object controllerObject) { Object currentController = getController(); @@ -2957,6 +3531,7 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. + * * @return an ArrayList */ public final ArrayList getControllerObjects() { @@ -2966,16 +3541,21 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param in an Object + * + * @param in + * an Object */ public final void setControllerObjects(final ArrayList in) { controllerObjects = in; } /** - *

Setter for the field owner.

- * - * @param player a {@link forge.Player} object. + *

+ * Setter for the field owner. + *

+ * + * @param player + * a {@link forge.Player} object. */ public final void setOwner(final Player player) { owner = player; @@ -2983,23 +3563,24 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field controller.

+ *

+ * Setter for the field controller. + *

* - * @param player a {@link forge.Player} object. - */ /* - public void setController(Player player) { - boolean sameController = controller == null ? false : controller.isPlayer(player); - controller = player; - if (null != controller && !sameController) { - for (Command var : changeControllerCommandList) - var.execute(); - } - this.updateObservers(); - }*/ + * @return the equipped by + */ + /* + * public void setController(Player player) { boolean sameController = + * controller == null ? false : controller.isPlayer(player); controller = + * player; if (null != controller && !sameController) { for (Command var : + * changeControllerCommandList) var.execute(); } this.updateObservers(); } + */ /** - *

Getter for the field equippedBy.

- * + *

+ * Getter for the field equippedBy. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getEquippedBy() { @@ -3007,17 +3588,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field equippedBy.

- * - * @param list a {@link java.util.ArrayList} object. + *

+ * Setter for the field equippedBy. + *

+ * + * @param list + * a {@link java.util.ArrayList} object. */ public final void setEquippedBy(final ArrayList list) { equippedBy = list; } /** - *

Getter for the field equipping.

- * + *

+ * Getter for the field equipping. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getEquipping() { @@ -3025,8 +3611,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getEquippingCard.

- * + *

+ * getEquippingCard. + *

+ * * @return a {@link forge.Card} object. */ public final Card getEquippingCard() { @@ -3037,17 +3625,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field equipping.

- * - * @param list a {@link java.util.ArrayList} object. + *

+ * Setter for the field equipping. + *

+ * + * @param list + * a {@link java.util.ArrayList} object. */ public final void setEquipping(final ArrayList list) { equipping = list; } /** - *

isEquipped.

- * + *

+ * isEquipped. + *

+ * * @return a boolean. */ public final boolean isEquipped() { @@ -3055,8 +3648,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

isEquipping.

- * + *

+ * isEquipping. + *

+ * * @return a boolean. */ public final boolean isEquipping() { @@ -3064,9 +3659,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addEquippedBy.

- * - * @param c a {@link forge.Card} object. + *

+ * addEquippedBy. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void addEquippedBy(final Card c) { equippedBy.add(c); @@ -3074,9 +3672,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeEquippedBy.

- * - * @param c a {@link forge.Card} object. + *

+ * removeEquippedBy. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void removeEquippedBy(final Card c) { equippedBy.remove(c); @@ -3084,9 +3685,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addEquipping.

- * - * @param c a {@link forge.Card} object. + *

+ * addEquipping. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void addEquipping(final Card c) { equipping.add(c); @@ -3095,9 +3699,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeEquipping.

- * - * @param c a {@link forge.Card} object. + *

+ * removeEquipping. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void removeEquipping(final Card c) { equipping.remove(c); @@ -3105,29 +3712,35 @@ public class Card extends GameEntity implements Comparable { } /** - *

equipCard.

+ *

+ * equipCard. + *

* equipment.equipCard(cardToBeEquipped) - * - * @param c a {@link forge.Card} object. + * + * @param c + * a {@link forge.Card} object. */ - public void equipCard(Card c) { + public final void equipCard(final Card c) { addEquipping(c); c.addEquippedBy(this); this.equip(); } /** - *

unEquipCard.

- * - * @param c a {@link forge.Card} object. + *

+ * unEquipCard. + *

+ * + * @param c + * a {@link forge.Card} object. */ - public void unEquipCard(Card c) //equipment.unEquipCard(equippedCard); + public final void unEquipCard(final Card c) // equipment.unEquipCard(equippedCard); { this.unEquip(); equipping.remove(c); c.removeEquippedBy(this); - //Run triggers + // Run triggers Map runParams = new TreeMap(); runParams.put("Equipment", this); runParams.put("Card", c); @@ -3135,17 +3748,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

unEquipAllCards.

+ *

+ * unEquipAllCards. + *

*/ public final void unEquipAllCards() { - while (equippedBy.size() > 0) { // while there exists equipment, unequip the first one + while (equippedBy.size() > 0) { // while there exists equipment, unequip + // the first one equippedBy.get(0).unEquipCard(this); } } /** - *

Getter for the field enchanting.

- * + *

+ * Getter for the field enchanting. + *

+ * * @return a {@link forge.enchanting} object. */ public final GameEntity getEnchanting() { @@ -3153,59 +3771,72 @@ public class Card extends GameEntity implements Comparable { } /** - *

getEnchantingCard.

- * + *

+ * getEnchantingCard. + *

+ * * @return a {@link forge.Card} object. */ public final Card getEnchantingCard() { - if (enchanting != null && enchanting instanceof Card){ - return (Card)enchanting; - } - return null; - } - - /** - *

getEnchantingPlayer.

- * - * @return a {@link forge.Player} object. - */ - public final Player getEnchantingPlayer() { - if (enchanting != null && enchanting instanceof Player){ - return (Player)enchanting; + if (enchanting != null && enchanting instanceof Card) { + return (Card) enchanting; } return null; } /** - *

Setter for the field enchanting.

- * - * @param list a {@link java.util.ArrayList} object. + *

+ * getEnchantingPlayer. + *

+ * + * @return a {@link forge.Player} object. */ - public final void setEnchanting(GameEntity e) { + public final Player getEnchantingPlayer() { + if (enchanting != null && enchanting instanceof Player) { + return (Player) enchanting; + } + return null; + } + + /** + *

+ * Setter for the field enchanting. + *

+ * + * @param e + * a GameEntity object. + */ + public final void setEnchanting(final GameEntity e) { enchanting = e; } /** - *

isEnchanting.

- * + *

+ * isEnchanting. + *

+ * * @return a boolean. */ public final boolean isEnchanting() { return enchanting != null; } - + /** - *

isEnchanting.

- * + *

+ * isEnchanting. + *

+ * * @return a boolean. */ public final boolean isEnchantingCard() { return getEnchantingCard() != null; } - + /** - *

isEnchanting.

- * + *

+ * isEnchanting. + *

+ * * @return a boolean. */ public final boolean isEnchantingPlayer() { @@ -3214,9 +3845,11 @@ public class Card extends GameEntity implements Comparable { /** * checks to see if this card is enchanted by an aura with a given name. - * - * @param cardName the name of the aura - * @return true if this card is enchanted by an aura with the given name, false otherwise + * + * @param cardName + * the name of the aura + * @return true if this card is enchanted by an aura with the given name, + * false otherwise */ public final boolean isEnchantedBy(final String cardName) { ArrayList allAuras = this.getEnchantedBy(); @@ -3229,9 +3862,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

addEnchanting.

- * - * @param e a {@link forge.GameEntity} object. + *

+ * addEnchanting. + *

+ * + * @param e + * a {@link forge.GameEntity} object. */ public final void addEnchanting(final GameEntity e) { enchanting = e; @@ -3240,21 +3876,27 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeEnchanting.

- * - * @param e a {@link forge.GameEntity} object. + *

+ * removeEnchanting. + *

+ * + * @param e + * a {@link forge.GameEntity} object. */ public final void removeEnchanting(final GameEntity e) { - if (enchanting.equals(e)){ + if (enchanting.equals(e)) { enchanting = null; this.updateObservers(); } } /** - *

enchant

- * - * @param entity a {@link forge.GameEntity} object. + *

+ * enchant. + *

+ * + * @param entity + * a {@link forge.GameEntity} object. */ public final void enchantEntity(final GameEntity entity) { addEnchanting(entity); @@ -3263,22 +3905,27 @@ public class Card extends GameEntity implements Comparable { } /** - *

unEnchant.

- * - * @param gameEntity a {@link forge.GameEntity} object. + *

+ * unEnchant. + *

+ * + * @param gameEntity + * a {@link forge.GameEntity} object. */ public final void unEnchantEntity(final GameEntity gameEntity) { - if (enchanting != null && enchanting.equals(gameEntity)){ + if (enchanting != null && enchanting.equals(gameEntity)) { this.unEnchant(); enchanting = null; gameEntity.removeEnchantedBy(this); } } - //array size might equal 0, will NEVER be null + // array size might equal 0, will NEVER be null /** - *

getAttachedCards.

- * + *

+ * getAttachedCards. + *

+ * * @return an array of {@link forge.Card} objects. */ public final Card[] getAttachedCardsByMindsDesire() { @@ -3288,8 +3935,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

hasAttachedCards.

- * + *

+ * hasAttachedCards. + *

+ * * @return a boolean. */ public final boolean hasAttachedCardsByMindsDesire() { @@ -3297,9 +3946,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

attachCard.

- * - * @param c a {@link forge.Card} object. + *

+ * attachCard. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void attachCardByMindsDesire(final Card c) { attachedByMindsDesire.add(c); @@ -3307,9 +3959,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

unattachCard.

- * - * @param c a {@link forge.Card} object. + *

+ * unattachCard. + *

+ * + * @param c + * a {@link forge.Card} object. */ public final void unattachCardByMindDesire(final Card c) { attachedByMindsDesire.remove(c); @@ -3317,126 +3972,179 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field type.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * Setter for the field type. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ public final void setType(final ArrayList a) { getCharacteristics().setType(new ArrayList(a)); } /** - *

addType.

- * - * @param a a {@link java.lang.String} object. + *

+ * addType. + *

+ * + * @param a + * a {@link java.lang.String} object. */ public final void addType(final String a) { getCharacteristics().getType().add(a); } /** - *

removeType.

- * - * @param a a {@link java.lang.String} object. + *

+ * removeType. + *

+ * + * @param a + * a {@link java.lang.String} object. */ public final void removeType(final String a) { getCharacteristics().getType().remove(a); } /** - *

Getter for the field type.

- * + *

+ * Getter for the field type. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getType() { - // see if type changes are in effect - if (!changedCardTypes.isEmpty()) { + // see if type changes are in effect + if (!changedCardTypes.isEmpty()) { - ArrayList newType = new ArrayList(getCharacteristics().getType()); - ArrayList types = changedCardTypes; - Collections.sort(types); // sorts types by timeStamp + ArrayList newType = new ArrayList(getCharacteristics().getType()); + ArrayList types = changedCardTypes; + Collections.sort(types); // sorts types by timeStamp - for (Card_Type ct : types) { - ArrayList removeTypes = new ArrayList(); - if (ct.getRemoveType() != null) { - removeTypes.addAll(ct.getRemoveType()); - } - //remove old types - for (int i = 0; i < newType.size(); i++) { - String t = newType.get(i); - if (ct.isRemoveSuperTypes() && CardUtil.isASuperType(t)) { + for (Card_Type ct : types) { + ArrayList removeTypes = new ArrayList(); + if (ct.getRemoveType() != null) { + removeTypes.addAll(ct.getRemoveType()); + } + // remove old types + for (int i = 0; i < newType.size(); i++) { + String t = newType.get(i); + if (ct.isRemoveSuperTypes() && CardUtil.isASuperType(t)) { removeTypes.add(t); } - if (ct.isRemoveCardTypes() && CardUtil.isACardType(t)) { + if (ct.isRemoveCardTypes() && CardUtil.isACardType(t)) { removeTypes.add(t); } - if (ct.isRemoveSubTypes() && CardUtil.isASubType(t)) { + if (ct.isRemoveSubTypes() && CardUtil.isASubType(t)) { removeTypes.add(t); } - if (ct.isRemoveCreatureTypes() && (CardUtil.isACreatureType(t) - || t.equals("AllCreatureTypes"))) - { - removeTypes.add(t); - } - } - newType.removeAll(removeTypes); - //add new types - if (ct.getType() != null) { - newType.addAll(ct.getType()); - } + if (ct.isRemoveCreatureTypes() && (CardUtil.isACreatureType(t) || t.equals("AllCreatureTypes"))) { + removeTypes.add(t); + } + } + newType.removeAll(removeTypes); + // add new types + if (ct.getType() != null) { + newType.addAll(ct.getType()); + } - } - - return newType; - } - - //nothing changed - return new ArrayList(getCharacteristics().getType()); - } - - public void setChangedCardTypes(ArrayList types) { - changedCardTypes = types; - } - - public ArrayList getChangedCardTypes() { - return changedCardTypes; - } - - public void addChangedCardTypes(ArrayList types, ArrayList removeTypes, boolean removeSuperTypes, - boolean removeCardTypes, boolean removeSubTypes, boolean removeCreatureTypes, long timestamp) { - - changedCardTypes.add(new Card_Type(types, removeTypes, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes, - timestamp)); - } - - public void addChangedCardTypes(String[] types, final String[] removeTypes, boolean removeSuperTypes, boolean removeCardTypes, - boolean removeSubTypes, boolean removeCreatureTypes, long timestamp) { - ArrayList typeList = null; - ArrayList removeTypeList = null; - if(types != null) { - typeList = new ArrayList(Arrays.asList(types)); - } - - if(removeTypes != null) { - removeTypeList = new ArrayList(Arrays.asList(removeTypes)); - } - - addChangedCardTypes(typeList, removeTypeList, removeSuperTypes, removeCardTypes, removeSubTypes, removeCreatureTypes, timestamp); - } - - public void removeChangedCardTypes(long timestamp) { - for (int i = 0; i < changedCardTypes.size(); i++) { - Card_Type cardT = changedCardTypes.get(i); - if (cardT.getTimestamp() == timestamp) { - changedCardTypes.remove(cardT); } - } + + return newType; + } + + // nothing changed + return new ArrayList(getCharacteristics().getType()); } /** - *

clearAllTypes.

- * + * + * TODO Write javadoc for this method. + * @param types a ArrayList + */ + public final void setChangedCardTypes(final ArrayList types) { + changedCardTypes = types; + } + + /** + * + * TODO Write javadoc for this method. + * @return ArrayList + */ + public final ArrayList getChangedCardTypes() { + return changedCardTypes; + } + + /** + * + * TODO Write javadoc for this method. + * @param types ArrayList + * @param removeTypes ArrayList + * @param removeSuperTypes boolean + * @param removeCardTypes boolean + * @param removeSubTypes boolean + * @param removeCreatureTypes boolean + * @param timestamp long + */ + public final void addChangedCardTypes(final ArrayList types, + final ArrayList removeTypes, final boolean removeSuperTypes, + final boolean removeCardTypes, final boolean removeSubTypes, + final boolean removeCreatureTypes, long timestamp) { + + changedCardTypes.add(new Card_Type(types, removeTypes, removeSuperTypes, removeCardTypes, removeSubTypes, + removeCreatureTypes, timestamp)); + } + + /** + * + * TODO Write javadoc for this method. + * @param types String[] + * @param removeTypes String[] + * @param removeSuperTypes boolean + * @param removeCardTypes boolean + * @param removeSubTypes boolean + * @param removeCreatureTypes boolean + * @param timestamp long + */ + public final void addChangedCardTypes(final String[] types, + final String[] removeTypes, final boolean removeSuperTypes, + final boolean removeCardTypes, final boolean removeSubTypes, + final boolean removeCreatureTypes, long timestamp) { + ArrayList typeList = null; + ArrayList removeTypeList = null; + if (types != null) { + typeList = new ArrayList(Arrays.asList(types)); + } + + if (removeTypes != null) { + removeTypeList = new ArrayList(Arrays.asList(removeTypes)); + } + + addChangedCardTypes(typeList, removeTypeList, removeSuperTypes, removeCardTypes, removeSubTypes, + removeCreatureTypes, timestamp); + } + + /** + * + * TODO Write javadoc for this method. + * @param timestamp long + */ + public final void removeChangedCardTypes(long timestamp) { + for (int i = 0; i < changedCardTypes.size(); i++) { + Card_Type cardT = changedCardTypes.get(i); + if (cardT.getTimestamp() == timestamp) { + changedCardTypes.remove(cardT); + } + } + } + + /** + *

+ * clearAllTypes. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList clearAllTypes() { @@ -3447,65 +4155,83 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field prevType.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * Setter for the field prevType. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ public final void setPrevType(final ArrayList a) { prevType = new ArrayList(a); } /** - *

addPrevType.

- * - * @param a a {@link java.lang.String} object. + *

+ * addPrevType. + *

+ * + * @param a + * a {@link java.lang.String} object. */ public final void addPrevType(final String a) { prevType.add(a); } /** - *

removePrevType.

- * - * @param a a {@link java.lang.String} object. + *

+ * removePrevType. + *

+ * + * @param a + * a {@link java.lang.String} object. */ public final void removePrevType(final String a) { prevType.remove(a); } /** - *

Getter for the field prevType.

- * + *

+ * Getter for the field prevType. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getPrevType() { return new ArrayList(prevType); } - //values that are printed on card + // values that are printed on card /** - *

Getter for the field baseLoyalty.

- * + *

+ * Getter for the field baseLoyalty. + *

+ * * @return a int. */ public final int getBaseLoyalty() { return baseLoyalty; } - //values that are printed on card + // values that are printed on card /** - *

Setter for the field baseLoyalty.

- * - * @param n a int. + *

+ * Setter for the field baseLoyalty. + *

+ * + * @param n + * a int. */ public final void setBaseLoyalty(final int n) { baseLoyalty = n; } - //values that are printed on card + // values that are printed on card /** - *

Getter for the field baseAttack.

- * + *

+ * Getter for the field baseAttack. + *

+ * * @return a int. */ public final int getBaseAttack() { @@ -3513,37 +4239,47 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field baseDefense.

- * + *

+ * Getter for the field baseDefense. + *

+ * * @return a int. */ public final int getBaseDefense() { return getCharacteristics().getBaseDefense(); } - //values that are printed on card + // values that are printed on card /** - *

Setter for the field baseAttack.

- * - * @param n a int. + *

+ * Setter for the field baseAttack. + *

+ * + * @param n + * a int. */ public final void setBaseAttack(final int n) { getCharacteristics().setBaseAttack(n); } /** - *

Setter for the field baseDefense.

- * - * @param n a int. + *

+ * Setter for the field baseDefense. + *

+ * + * @param n + * a int. */ public final void setBaseDefense(final int n) { getCharacteristics().setBaseDefense(n); } - //values that are printed on card + // values that are printed on card /** - *

Getter for the field baseAttackString.

- * + *

+ * Getter for the field baseAttackString. + *

+ * * @return a {@link java.lang.String} object. */ public final String getBaseAttackString() { @@ -3551,113 +4287,174 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field baseDefenseString.

- * + *

+ * Getter for the field baseDefenseString. + *

+ * * @return a {@link java.lang.String} object. */ public final String getBaseDefenseString() { return (null == baseDefenseString) ? "" + getBaseDefense() : baseDefenseString; } - //values that are printed on card + // values that are printed on card /** - *

Setter for the field baseAttackString.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field baseAttackString. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void setBaseAttackString(final String s) { baseAttackString = s; } /** - *

Setter for the field baseDefenseString.

- * - * @param s a {@link java.lang.String} object. + *

+ * Setter for the field baseDefenseString. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public final void setBaseDefenseString(String s) { + public final void setBaseDefenseString(final String s) { baseDefenseString = s; } - - public void setNewPT(final ArrayList pt) { + + /** + * + * TODO Write javadoc for this method. + * @param pt ArrayList + */ + public final void setNewPT(final ArrayList pt) { newPT = pt; } - - public ArrayList getNewPT() { + + /** + * + * TODO Write javadoc for this method. + * @return ArrayList + */ + public final ArrayList getNewPT() { return newPT; } - - public int getSetPower() { - if (newPT.isEmpty()) - return -1; - - CardPowerToughness latestPT = getLatestPT(); - - return latestPT.getPower(); + + /** + * + * TODO Write javadoc for this method. + * @return int + */ + public final int getSetPower() { + if (newPT.isEmpty()) { + return -1; + } + + CardPowerToughness latestPT = getLatestPT(); + + return latestPT.getPower(); } - - public int getSetToughness() { - if (newPT.isEmpty()) - return -1; - - CardPowerToughness latestPT = getLatestPT(); - - return latestPT.getToughness(); + + /** + * + * TODO Write javadoc for this method. + * @return int + */ + public final int getSetToughness() { + if (newPT.isEmpty()) { + return -1; + } + + CardPowerToughness latestPT = getLatestPT(); + + return latestPT.getToughness(); } - - public CardPowerToughness getLatestPT() { - CardPowerToughness latestPT = new CardPowerToughness(-1,-1,0); - long max = 0; - - for (CardPowerToughness pt : newPT) { - if (pt.getTimestamp() >= max) { - max = pt.getTimestamp(); - latestPT = pt; - } - } - - return latestPT; + + /** + * + * TODO Write javadoc for this method. + * @return CardPowerToughness + */ + public final CardPowerToughness getLatestPT() { + CardPowerToughness latestPT = new CardPowerToughness(-1, -1, 0); + long max = 0; + + for (CardPowerToughness pt : newPT) { + if (pt.getTimestamp() >= max) { + max = pt.getTimestamp(); + latestPT = pt; + } + } + + return latestPT; } - - public void addNewPT(int power, int toughness, long timestamp) { - newPT.add(new CardPowerToughness(power, toughness, timestamp)); + + /** + * + * TODO Write javadoc for this method. + * @param power int + * @param toughness int + * @param timestamp int + */ + public final void addNewPT(final int power, final int toughness, long timestamp) { + newPT.add(new CardPowerToughness(power, toughness, timestamp)); } - - public void removeNewPT(long timestamp) { - for (int i = 0; i < newPT.size(); i++) { - CardPowerToughness cardPT = newPT.get(i); - if (cardPT.getTimestamp() == timestamp) - newPT.remove(cardPT); - } + + /** + * + * TODO Write javadoc for this method. + * @param timestamp long + */ + public final void removeNewPT(long timestamp) { + for (int i = 0; i < newPT.size(); i++) { + CardPowerToughness cardPT = newPT.get(i); + if (cardPT.getTimestamp() == timestamp) { + newPT.remove(cardPT); + } + } } - - public int getCurrentPower() { - int total = getBaseAttack(); + + /** + * + * TODO Write javadoc for this method. + * @return int + */ + public final int getCurrentPower() { + int total = getBaseAttack(); int setPower = getSetPower(); - if(setPower != -1) - total = setPower; - + if (setPower != -1) { + total = setPower; + } + return total; } /** - *

getUnswitchedAttack.

- * + *

+ * getUnswitchedAttack. + *

+ * * @return a int. */ public final int getUnswitchedAttack() { int total = getCurrentPower(); - total += getTempAttackBoost() + getSemiPermanentAttackBoost() - + getCounters(Counters.P1P1) + getCounters(Counters.P1P2) - + getCounters(Counters.P1P0) - getCounters(Counters.M1M1) + total += getTempAttackBoost() + + getSemiPermanentAttackBoost() + + getCounters(Counters.P1P1) + + getCounters(Counters.P1P2) + + getCounters(Counters.P1P0) + - getCounters(Counters.M1M1) + (2 * getCounters(Counters.P2P2) - (2 * getCounters(Counters.M2M1)) - - (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0)); + - (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0)); return total; } /** - *

getNetAttack.

- * + *

+ * getNetAttack. + *

+ * * @return a int. */ public final int getNetAttack() { @@ -3671,10 +4468,11 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. + * * @return an int */ public final int getCurrentToughness() { - int total = getBaseDefense(); + int total = getBaseDefense(); int setToughness = getSetToughness(); if (setToughness != -1) { @@ -3685,25 +4483,27 @@ public class Card extends GameEntity implements Comparable { } /** - *

getUnswitchedDefense.

- * + *

+ * getUnswitchedDefense. + *

+ * * @return a int. */ public final int getUnswitchedDefense() { int total = getCurrentToughness(); - total += getTempDefenseBoost() + getSemiPermanentDefenseBoost() - + getCounters(Counters.P1P1) + (2 * getCounters(Counters.P1P2)) - - getCounters(Counters.M1M1) + getCounters(Counters.P0P1) - - (2 * getCounters(Counters.M0M2)) - + (2 * getCounters(Counters.P2P2)) - getCounters(Counters.M0M1) + total += getTempDefenseBoost() + getSemiPermanentDefenseBoost() + getCounters(Counters.P1P1) + + (2 * getCounters(Counters.P1P2)) - getCounters(Counters.M1M1) + getCounters(Counters.P0P1) + - (2 * getCounters(Counters.M0M2)) + (2 * getCounters(Counters.P2P2)) - getCounters(Counters.M0M1) - getCounters(Counters.M2M1) - (2 * getCounters(Counters.M2M2)); return total; } /** - *

getNetDefense.

- * + *

+ * getNetDefense. + *

+ * * @return a int. */ public final int getNetDefense() { @@ -3714,17 +4514,19 @@ public class Card extends GameEntity implements Comparable { } } - //How much combat damage does the card deal + // How much combat damage does the card deal /** - *

getNetCombatDamage.

- * + *

+ * getNetCombatDamage. + *

+ * * @return a int. */ public final int getNetCombatDamage() { if (hasKeyword("CARDNAME assigns no combat damage")) { return 0; } - + if (AllZoneUtil.isCardInPlay("Doran, the Siege Tower")) { return getNetDefense(); } @@ -3732,17 +4534,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field randomPicture.

- * - * @param n a int. + *

+ * Setter for the field randomPicture. + *

+ * + * @param n + * a int. */ public final void setRandomPicture(final int n) { randomPicture = n; } /** - *

Getter for the field randomPicture.

- * + *

+ * Getter for the field randomPicture. + *

+ * * @return a int. */ public final int getRandomPicture() { @@ -3750,26 +4557,34 @@ public class Card extends GameEntity implements Comparable { } /** - *

addMultiKickerMagnitude.

- * - * @param n a int. + *

+ * addMultiKickerMagnitude. + *

+ * + * @param n + * a int. */ public final void addMultiKickerMagnitude(final int n) { multiKickerMagnitude += n; } /** - *

Setter for the field multiKickerMagnitude.

- * - * @param n a int. + *

+ * Setter for the field multiKickerMagnitude. + *

+ * + * @param n + * a int. */ public final void setMultiKickerMagnitude(final int n) { multiKickerMagnitude = n; } /** - *

Getter for the field multiKickerMagnitude.

- * + *

+ * Getter for the field multiKickerMagnitude. + *

+ * * @return a int. */ public final int getMultiKickerMagnitude() { @@ -3777,36 +4592,46 @@ public class Card extends GameEntity implements Comparable { } /** - *

addReplicateMagnitude.

- * - * @param n a int. + *

+ * addReplicateMagnitude. + *

+ * + * @param n + * a int. */ public final void addReplicateMagnitude(final int n) { replicateMagnitude += n; } /** - *

Setter for the field replicateMagnitude.

- * - * @param n a int. + *

+ * Setter for the field replicateMagnitude. + *

+ * + * @param n + * a int. */ public final void setReplicateMagnitude(final int n) { replicateMagnitude = n; } /** - *

Getter for the field replicateMagnitude.

- * + *

+ * Getter for the field replicateMagnitude. + *

+ * * @return a int. */ public final int getReplicateMagnitude() { return replicateMagnitude; } - //for cards like Giant Growth, etc. + // for cards like Giant Growth, etc. /** - *

Getter for the field tempAttackBoost.

- * + *

+ * Getter for the field tempAttackBoost. + *

+ * * @return a int. */ public final int getTempAttackBoost() { @@ -3814,8 +4639,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field tempDefenseBoost.

- * + *

+ * Getter for the field tempDefenseBoost. + *

+ * * @return a int. */ public final int getTempDefenseBoost() { @@ -3823,45 +4650,59 @@ public class Card extends GameEntity implements Comparable { } /** - *

addTempAttackBoost.

- * - * @param n a int. + *

+ * addTempAttackBoost. + *

+ * + * @param n + * a int. */ public final void addTempAttackBoost(final int n) { tempAttackBoost += n; } /** - *

addTempDefenseBoost.

- * - * @param n a int. + *

+ * addTempDefenseBoost. + *

+ * + * @param n + * a int. */ public final void addTempDefenseBoost(final int n) { tempDefenseBoost += n; } /** - *

Setter for the field tempAttackBoost.

- * - * @param n a int. + *

+ * Setter for the field tempAttackBoost. + *

+ * + * @param n + * a int. */ public final void setTempAttackBoost(final int n) { tempAttackBoost = n; } /** - *

Setter for the field tempDefenseBoost.

- * - * @param n a int. + *

+ * Setter for the field tempDefenseBoost. + *

+ * + * @param n + * a int. */ public final void setTempDefenseBoost(final int n) { tempDefenseBoost = n; } - //for cards like Glorious Anthem, etc. + // for cards like Glorious Anthem, etc. /** - *

Getter for the field semiPermanentAttackBoost.

- * + *

+ * Getter for the field semiPermanentAttackBoost. + *

+ * * @return a int. */ public final int getSemiPermanentAttackBoost() { @@ -3869,8 +4710,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field semiPermanentDefenseBoost.

- * + *

+ * Getter for the field semiPermanentDefenseBoost. + *

+ * * @return a int. */ public final int getSemiPermanentDefenseBoost() { @@ -3878,44 +4721,58 @@ public class Card extends GameEntity implements Comparable { } /** - *

addSemiPermanentAttackBoost.

- * - * @param n a int. + *

+ * addSemiPermanentAttackBoost. + *

+ * + * @param n + * a int. */ public final void addSemiPermanentAttackBoost(final int n) { semiPermanentAttackBoost += n; } /** - *

addSemiPermanentDefenseBoost.

- * - * @param n a int. + *

+ * addSemiPermanentDefenseBoost. + *

+ * + * @param n + * a int. */ public final void addSemiPermanentDefenseBoost(final int n) { semiPermanentDefenseBoost += n; } /** - *

Setter for the field semiPermanentAttackBoost.

- * - * @param n a int. + *

+ * Setter for the field semiPermanentAttackBoost. + *

+ * + * @param n + * a int. */ public final void setSemiPermanentAttackBoost(final int n) { semiPermanentAttackBoost = n; } /** - *

Setter for the field semiPermanentDefenseBoost.

- * - * @param n a int. + *

+ * Setter for the field semiPermanentDefenseBoost. + *

+ * + * @param n + * a int. */ public final void setSemiPermanentDefenseBoost(final int n) { semiPermanentDefenseBoost = n; } /** - *

isUntapped.

- * + *

+ * isUntapped. + *

+ * * @return a boolean. */ public final boolean isUntapped() { @@ -3923,8 +4780,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

isTapped.

- * + *

+ * isTapped. + *

+ * * @return a boolean. */ public final boolean isTapped() { @@ -3932,9 +4791,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field tapped.

- * - * @param b a boolean. + *

+ * Setter for the field tapped. + *

+ * + * @param b + * a boolean. */ public final void setTapped(final boolean b) { tapped = b; @@ -3942,11 +4804,13 @@ public class Card extends GameEntity implements Comparable { } /** - *

tap.

+ *

+ * tap. + *

*/ public final void tap() { if (isUntapped()) { - //Run triggers + // Run triggers Map runParams = new TreeMap(); runParams.put("Card", this); AllZone.getTriggerHandler().runTrigger("Taps", runParams); @@ -3955,11 +4819,13 @@ public class Card extends GameEntity implements Comparable { } /** - *

untap.

+ *

+ * untap. + *

*/ public final void untap() { if (isTapped()) { - //Run triggers + // Run triggers Map runParams = new TreeMap(); runParams.put("Card", this); AllZone.getTriggerHandler().runTrigger("Untaps", runParams); @@ -3974,29 +4840,36 @@ public class Card extends GameEntity implements Comparable { } /** - *

isUnCastable.

- * + *

+ * isUnCastable. + *

+ * * @return a boolean. */ public final boolean isUnCastable() { - + return unCastable; } /** - *

Setter for the field unCastable.

- * - * @param b a boolean. + *

+ * Setter for the field unCastable. + *

+ * + * @param b + * a boolean. */ public final void setUnCastable(final boolean b) { unCastable = b; updateObservers(); } - //keywords are like flying, fear, first strike, etc... + // keywords are like flying, fear, first strike, etc... /** - *

getKeyword.

- * + *

+ * getKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getKeyword() { @@ -4007,7 +4880,13 @@ public class Card extends GameEntity implements Comparable { return keywords; } - public int getKeywordAmount(final String keyword) { + /** + * Gets the keyword amount. + * + * @param keyword the keyword + * @return the keyword amount + */ + public final int getKeywordAmount(final String keyword) { int res = 0; for (String k : getKeyword()) { if (k.equals(keyword)) { @@ -4017,36 +4896,69 @@ public class Card extends GameEntity implements Comparable { return res; } - - public void setChangedCardKeywords(ArrayList kw) { + + /** + * Sets the changed card keywords. + * + * @param kw the new changed card keywords + */ + public final void setChangedCardKeywords(final ArrayList kw) { changedCardKeywords = kw; } - - public ArrayList getChangedCardKeywords() { + + /** + * Gets the changed card keywords. + * + * @return the changed card keywords + */ + public final ArrayList getChangedCardKeywords() { return changedCardKeywords; } - - public void addChangedCardKeywords(ArrayList keywords, ArrayList removeKeywords, boolean removeAllKeywords, - long timestamp) { - + + /** + * Adds the changed card keywords. + * + * @param keywords the keywords + * @param removeKeywords the remove keywords + * @param removeAllKeywords the remove all keywords + * @param timestamp the timestamp + */ + public final void addChangedCardKeywords(final ArrayList keywords, final ArrayList removeKeywords, + final boolean removeAllKeywords, long timestamp) { + changedCardKeywords.add(new Card_Keywords(keywords, removeKeywords, removeAllKeywords, timestamp)); } - - public void addChangedCardKeywords(String[] keywords, String[] removeKeywords, boolean removeAllKeywords, long timestamp) { + + /** + * Adds the changed card keywords. + * + * @param keywords the keywords + * @param removeKeywords the remove keywords + * @param removeAllKeywords the remove all keywords + * @param timestamp the timestamp + */ + public final void addChangedCardKeywords(final String[] keywords, + final String[] removeKeywords, final boolean removeAllKeywords, + long timestamp) { ArrayList keywordsList = null; ArrayList removeKeywordsList = null; - if(keywords != null) { + if (keywords != null) { keywordsList = new ArrayList(Arrays.asList(keywords)); } - if(removeKeywords != null) { + if (removeKeywords != null) { removeKeywordsList = new ArrayList(Arrays.asList(removeKeywords)); } - + addChangedCardKeywords(keywordsList, removeKeywordsList, removeAllKeywords, timestamp); } - - public void removeChangedCardKeywords(long timestamp) { + + /** + * Removes the changed card keywords. + * + * @param timestamp the timestamp + */ + public final void removeChangedCardKeywords(long timestamp) { for (int i = 0; i < changedCardKeywords.size(); i++) { Card_Keywords cardK = changedCardKeywords.get(i); if (cardK.getTimestamp() == timestamp) { @@ -4057,8 +4969,10 @@ public class Card extends GameEntity implements Comparable { // Hidden keywords will be left out /** - *

getUnhiddenKeyword.

- * + *

+ * getUnhiddenKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getUnhiddenKeyword() { @@ -4070,11 +4984,11 @@ public class Card extends GameEntity implements Comparable { if (!changedCardKeywords.isEmpty()) { ArrayList newKeywords = changedCardKeywords; - Collections.sort(newKeywords); // sorts newKeywords by timeStamp + Collections.sort(newKeywords); // sorts newKeywords by timeStamp for (Card_Keywords ck : newKeywords) { - - if(ck.isRemoveAllKeywords()) { + + if (ck.isRemoveAllKeywords()) { keywords.clear(); } else if (ck.getRemoveKeywords() != null) { keywords.removeAll(ck.getRemoveKeywords()); @@ -4091,8 +5005,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getIntrinsicAbilities.

- * + *

+ * getIntrinsicAbilities. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getIntrinsicAbilities() { @@ -4100,8 +5016,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field intrinsicKeyword.

- * + *

+ * Getter for the field intrinsicKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getIntrinsicKeyword() { @@ -4109,84 +5027,112 @@ public class Card extends GameEntity implements Comparable { } /** - *

clearIntrinsicKeyword.

+ *

+ * clearIntrinsicKeyword. + *

*/ public final void clearIntrinsicKeyword() { getCharacteristics().getIntrinsicKeyword().clear(); } /** - *

Setter for the field intrinsicKeyword.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * Setter for the field intrinsicKeyword. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ public final void setIntrinsicKeyword(final ArrayList a) { getCharacteristics().setIntrinsicKeyword(new ArrayList(a)); } /** - *

clearAllKeywords.

+ *

+ * clearAllKeywords. + *

*/ public final void clearAllKeywords() { getCharacteristics().getIntrinsicKeyword().clear(); extrinsicKeyword.clear(); - hiddenExtrinsicKeyword.clear(); //Hidden keywords won't be displayed on the card + hiddenExtrinsicKeyword.clear(); // Hidden keywords won't be displayed on + // the card } /** - *

setIntrinsicAbilities.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * setIntrinsicAbilities. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ public final void setIntrinsicAbilities(final ArrayList a) { getCharacteristics().setIntrinsicAbility(new ArrayList(a)); } /** - *

addIntrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addIntrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public final void addIntrinsicKeyword(final String s) { if (s.trim().length() != 0) { getCharacteristics().getIntrinsicKeyword().add(s); - //intrinsicKeyword.add((getName().trim().length()== 0 ? s :s.replaceAll(getName(), "CARDNAME"))); + // intrinsicKeyword.add((getName().trim().length()== 0 ? s + // :s.replaceAll(getName(), "CARDNAME"))); } } /** - *

addIntrinsicAbility.

- * - * @param s a {@link java.lang.String} object. + *

+ * addIntrinsicAbility. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void addIntrinsicAbility(String s) { - if (s.trim().length() != 0) + public final void addIntrinsicAbility(final String s) { + if (s.trim().length() != 0) { getCharacteristics().getIntrinsicAbility().add(s); - } - - /** - *

addNonStackingIntrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. - */ - public final void addNonStackingIntrinsicKeyword(String s) { - if (!getIntrinsicKeyword().contains(s) && s.trim().length() != 0) { - getCharacteristics().getIntrinsicKeyword().add((getName().trim().length() == 0 ? s : s.replaceAll(getName(), "CARDNAME"))); } } /** - *

removeIntrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addNonStackingIntrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public final void removeIntrinsicKeyword(String s) { + public final void addNonStackingIntrinsicKeyword(final String s) { + if (!getIntrinsicKeyword().contains(s) && s.trim().length() != 0) { + getCharacteristics().getIntrinsicKeyword().add( + (getName().trim().length() == 0 ? s : s.replaceAll(getName(), "CARDNAME"))); + } + } + + /** + *

+ * removeIntrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. + */ + public final void removeIntrinsicKeyword(final String s) { getCharacteristics().getIntrinsicKeyword().remove(s); } /** - *

getIntrinsicKeywordSize.

- * + *

+ * getIntrinsicKeywordSize. + *

+ * * @return a int. */ public final int getIntrinsicKeywordSize() { @@ -4194,8 +5140,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field extrinsicKeyword.

- * + *

+ * Getter for the field extrinsicKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ public ArrayList getExtrinsicKeyword() { @@ -4203,37 +5151,46 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field extrinsicKeyword.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * Setter for the field extrinsicKeyword. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ - public void setExtrinsicKeyword(final ArrayList a) { + public final void setExtrinsicKeyword(final ArrayList a) { extrinsicKeyword = new ArrayList(a); } /** - *

addExtrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addExtrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public void addExtrinsicKeyword(final String s) { - //if(!hasKeyword(s)){ + // if(!hasKeyword(s)){ if (s.startsWith("HIDDEN")) { addHiddenExtrinsicKeyword(s); - } - else { + } else { extrinsicKeyword.add(s); - //extrinsicKeyword.add((getName().trim().length()==0 ? s :s.replaceAll(getName(), "CARDNAME"))); - //} + // extrinsicKeyword.add((getName().trim().length()==0 ? s + // :s.replaceAll(getName(), "CARDNAME"))); + // } } } /** - *

addStackingExtrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addStackingExtrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void addStackingExtrinsicKeyword(final String s) { + public final void addStackingExtrinsicKeyword(final String s) { if (s.startsWith("HIDDEN")) { addHiddenExtrinsicKeyword(s); } else { @@ -4242,9 +5199,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

removeExtrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * removeExtrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ public void removeExtrinsicKeyword(final String s) { if (s.startsWith("HIDDEN")) { @@ -4255,8 +5215,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getExtrinsicKeywordSize.

- * + *

+ * getExtrinsicKeywordSize. + *

+ * * @return a int. */ public int getExtrinsicKeywordSize() { @@ -4264,59 +5226,74 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field prevIntrinsicKeyword.

- * + *

+ * Getter for the field prevIntrinsicKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getPrevIntrinsicKeyword() { + public final ArrayList getPrevIntrinsicKeyword() { return new ArrayList(prevIntrinsicKeyword); } /** - *

Setter for the field prevIntrinsicKeyword.

- * - * @param a a {@link java.util.ArrayList} object. + *

+ * Setter for the field prevIntrinsicKeyword. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ - public void setPrevIntrinsicKeyword(ArrayList a) { + public final void setPrevIntrinsicKeyword(final ArrayList a) { prevIntrinsicKeyword = new ArrayList(a); this.updateObservers(); } /** - *

addPrevIntrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addPrevIntrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void addPrevIntrinsicKeyword(String s) { + public final void addPrevIntrinsicKeyword(final String s) { prevIntrinsicKeyword.add(s); } /** - *

removePrevIntrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * removePrevIntrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void removePrevIntrinsicKeyword(String s) { + public final void removePrevIntrinsicKeyword(final String s) { prevIntrinsicKeyword.remove(s); this.updateObservers(); } /** - *

getPrevIntrinsicKeywordSize.

- * + *

+ * getPrevIntrinsicKeywordSize. + *

+ * * @return a int. */ - public int getPrevIntrinsicKeywordSize() { + public final int getPrevIntrinsicKeywordSize() { return prevIntrinsicKeyword.size(); } // Hidden Keywords will be returned without the indicator HIDDEN /** - *

getHiddenExtrinsicKeyword.

- * + *

+ * getHiddenExtrinsicKeyword. + *

+ * * @return a {@link java.util.ArrayList} object. */ - public ArrayList getHiddenExtrinsicKeyword() { + public final ArrayList getHiddenExtrinsicKeyword() { ArrayList keywords = new ArrayList(); for (int i = 0; i < hiddenExtrinsicKeyword.size(); i++) { String keyword = hiddenExtrinsicKeyword.get(i); @@ -4326,269 +5303,348 @@ public class Card extends GameEntity implements Comparable { } /** - *

addHiddenExtrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * addHiddenExtrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void addHiddenExtrinsicKeyword(String s) { + public final void addHiddenExtrinsicKeyword(final String s) { hiddenExtrinsicKeyword.add(s); } /** - *

removeHiddenExtrinsicKeyword.

- * - * @param s a {@link java.lang.String} object. + *

+ * removeHiddenExtrinsicKeyword. + *

+ * + * @param s + * a {@link java.lang.String} object. */ - public void removeHiddenExtrinsicKeyword(String s) { + public final void removeHiddenExtrinsicKeyword(final String s) { hiddenExtrinsicKeyword.remove(s); - //this.updateObservers(); - } - - /** - *

setStaticAbilityStrings.

- * - * @param a a {@link java.util.ArrayList} object. - */ - public void setStaticAbilityStrings(ArrayList a) { - staticAbilityStrings = new ArrayList(a); - } - - public ArrayList getStaticAbilityStrings() { - return staticAbilityStrings; + // this.updateObservers(); } /** - *

addStaticAbilityStrings.

- * - * @param s a {@link java.lang.String} object. + *

+ * setStaticAbilityStrings. + *

+ * + * @param a + * a {@link java.util.ArrayList} object. */ - public void addStaticAbilityString(String s) { - if (s.trim().length() != 0) - staticAbilityStrings.add(s); + public final void setStaticAbilityStrings(final ArrayList a) { + staticAbilityStrings = new ArrayList(a); } - - public void setStaticAbilities(ArrayList a) { - getCharacteristics().setStaticAbilities(new ArrayList(a)); + + /** + * Gets the static ability strings. + * + * @return the static ability strings + */ + public final ArrayList getStaticAbilityStrings() { + return staticAbilityStrings; } - - public ArrayList getStaticAbilities() { - return new ArrayList(getCharacteristics().getStaticAbilities()); - } - - public void addStaticAbility(String s) { - + + /** + *

+ * addStaticAbilityStrings. + *

+ * + * @param s + * a {@link java.lang.String} object. + */ + public final void addStaticAbilityString(final String s) { if (s.trim().length() != 0) { - StaticAbility stAb = new StaticAbility(s,this); - getCharacteristics().getStaticAbilities().add(stAb); + staticAbilityStrings.add(s); } } /** - *

isPermanent.

+ * Sets the static abilities. * + * @param a the new static abilities + */ + public final void setStaticAbilities(final ArrayList a) { + getCharacteristics().setStaticAbilities(new ArrayList(a)); + } + + /** + * Gets the static abilities. + * + * @return the static abilities + */ + public final ArrayList getStaticAbilities() { + return new ArrayList(getCharacteristics().getStaticAbilities()); + } + + /** + * Adds the static ability. + * + * @param s the s + */ + public final void addStaticAbility(final String s) { + + if (s.trim().length() != 0) { + StaticAbility stAb = new StaticAbility(s, this); + getCharacteristics().getStaticAbilities().add(stAb); + } + } + + /** + *

+ * isPermanent. + *

+ * * @return a boolean. */ - public boolean isPermanent() { + public final boolean isPermanent() { return !(isInstant() || isSorcery() || isImmutable()); } /** - *

isSpell.

- * + *

+ * isSpell. + *

+ * * @return a boolean. */ - public boolean isSpell() { + public final boolean isSpell() { return (isInstant() || isSorcery() || (isAura() && !AllZoneUtil.getCardsIn(Zone.Battlefield).contains(this))); } /** - *

isCreature.

- * + *

+ * isCreature. + *

+ * * @return a boolean. */ - public boolean isCreature() { + public final boolean isCreature() { return typeContains("Creature"); } /** - *

isWall.

- * + *

+ * isWall. + *

+ * * @return a boolean. */ - public boolean isWall() { + public final boolean isWall() { return typeContains("Wall"); } /** - *

isBasicLand.

- * + *

+ * isBasicLand. + *

+ * * @return a boolean. */ - public boolean isBasicLand() { + public final boolean isBasicLand() { return typeContains("Basic"); } /** - *

isLand.

- * + *

+ * isLand. + *

+ * * @return a boolean. */ - public boolean isLand() { + public final boolean isLand() { return typeContains("Land"); } /** - *

isSorcery.

- * + *

+ * isSorcery. + *

+ * * @return a boolean. */ - public boolean isSorcery() { + public final boolean isSorcery() { return typeContains("Sorcery"); } /** - *

isInstant.

- * + *

+ * isInstant. + *

+ * * @return a boolean. */ - public boolean isInstant() { + public final boolean isInstant() { return typeContains("Instant"); } /** - *

isArtifact.

- * + *

+ * isArtifact. + *

+ * * @return a boolean. */ - public boolean isArtifact() { + public final boolean isArtifact() { return typeContains("Artifact"); } /** - *

isEquipment.

- * + *

+ * isEquipment. + *

+ * * @return a boolean. */ - public boolean isEquipment() { + public final boolean isEquipment() { return typeContains("Equipment"); } /** - *

isPlaneswalker.

- * + *

+ * isPlaneswalker. + *

+ * * @return a boolean. */ - public boolean isPlaneswalker() { + public final boolean isPlaneswalker() { return typeContains("Planeswalker"); } /** - *

isEmblem.

- * + *

+ * isEmblem. + *

+ * * @return a boolean. */ - public boolean isEmblem() { + public final boolean isEmblem() { return typeContains("Emblem"); } /** - *

isTribal.

- * + *

+ * isTribal. + *

+ * * @return a boolean. */ - public boolean isTribal() { + public final boolean isTribal() { return typeContains("Tribal"); } /** - *

isSnow.

- * + *

+ * isSnow. + *

+ * * @return a boolean. */ - public boolean isSnow() { + public final boolean isSnow() { return typeContains("Snow"); } - //global and local enchantments + // global and local enchantments /** - *

isEnchantment.

- * + *

+ * isEnchantment. + *

+ * * @return a boolean. */ - public boolean isEnchantment() { + public final boolean isEnchantment() { return typeContains("Enchantment"); } /** - *

isAura.

- * + *

+ * isAura. + *

+ * * @return a boolean. */ - public boolean isAura() { + public final boolean isAura() { return typeContains("Aura"); } /** - *

isGlobalEnchantment.

- * + *

+ * isGlobalEnchantment. + *

+ * * @return a boolean. */ - public boolean isGlobalEnchantment() { + public final boolean isGlobalEnchantment() { return typeContains("Enchantment") && (!isAura()); } - private boolean typeContains(String s) { + private boolean typeContains(final String s) { Iterator it = this.getType().iterator(); - while (it.hasNext()) - if (it.next().toString().startsWith(s)) return true; + while (it.hasNext()) { + if (it.next().toString().startsWith(s)) { + return true; + } + } return false; } /** - *

Setter for the field uniqueNumber.

- * - * @param n a int. + *

+ * Setter for the field uniqueNumber. + *

+ * + * @param n + * a int. */ - public void setUniqueNumber(int n) { + public final void setUniqueNumber(final int n) { uniqueNumber = n; this.updateObservers(); } /** - *

Getter for the field uniqueNumber.

- * + *

+ * Getter for the field uniqueNumber. + *

+ * * @return a int. */ - public int getUniqueNumber() { + public final int getUniqueNumber() { return uniqueNumber; } /** - *

Setter for the field value.

- * - * @param n a long. + *

+ * Setter for the field value. + *

+ * + * @param n + * a long. */ - public void setValue(long n) { + public final void setValue(final long n) { value = n; } /** - *

Getter for the field value.

- * + *

+ * Getter for the field value. + *

+ * * @return a long. */ - public long getValue() { + public final long getValue() { return value; } /** {@inheritDoc} */ @Override - public int compareTo(Card that) { + public final int compareTo(final Card that) { /* - * Return a negative integer of this < that, - * a positive integer if this > that, - * and zero otherwise. + * Return a negative integer of this < that, a positive integer if this + * > that, and zero otherwise. */ if (that == null) { @@ -4596,383 +5652,502 @@ public class Card extends GameEntity implements Comparable { * "Here we can arbitrarily decide that all non-null Cards are * `greater than' null Cards. It doesn't really matter what we * return in this case, as long as it is consistent. I rather think - * of null as being lowly." --Braids + * of null as being lowly." --Braids */ return +1; - } - else if (getUniqueNumber() > that.getUniqueNumber()) { + } else if (getUniqueNumber() > that.getUniqueNumber()) { return +1; - } - else if (getUniqueNumber() < that.getUniqueNumber()) { + } else if (getUniqueNumber() < that.getUniqueNumber()) { return -1; - } - else { + } else { return 0; } } /** {@inheritDoc} */ @Override - public boolean equals(Object o) { + public final boolean equals(final Object o) { if (o instanceof Card) { Card c = (Card) o; int a = getUniqueNumber(); int b = c.getUniqueNumber(); - return (a == b); + return (a == b); } return false; } /** {@inheritDoc} */ @Override - public int hashCode() { + public final int hashCode() { return getUniqueNumber(); } - + /** {@inheritDoc} */ @Override - public String toString() { + public final String toString() { return this.getName() + " (" + this.getUniqueNumber() + ")"; } /** - *

hasFlashback.

- * + *

+ * hasFlashback. + *

+ * * @return a boolean. */ - public boolean hasFlashback() { + public final boolean hasFlashback() { return flashback; } /** - *

Setter for the field flashback.

- * - * @param b a boolean. + *

+ * Setter for the field flashback. + *

+ * + * @param b + * a boolean. */ - public void setFlashback(boolean b) { + public final void setFlashback(final boolean b) { flashback = b; } /** - *

hasUnearth.

- * + *

+ * hasUnearth. + *

+ * * @return a boolean. */ - public boolean hasUnearth() { + public final boolean hasUnearth() { return unearth; } /** - *

Setter for the field unearth.

- * - * @param b a boolean. + *

+ * Setter for the field unearth. + *

+ * + * @param b + * a boolean. */ - public void setUnearth(boolean b) { + public final void setUnearth(final boolean b) { unearth = b; } /** - *

isUnearthed.

- * + *

+ * isUnearthed. + *

+ * * @return a boolean. */ - public boolean isUnearthed() { + public final boolean isUnearthed() { return unearthed; } /** - *

Setter for the field unearthed.

- * - * @param b a boolean. + *

+ * Setter for the field unearthed. + *

+ * + * @param b + * a boolean. */ - public void setUnearthed(boolean b) { + public final void setUnearthed(final boolean b) { unearthed = b; } /** - *

hasMadness.

- * + *

+ * hasMadness. + *

+ * * @return a boolean. */ - public boolean hasMadness() { + public final boolean hasMadness() { return madness; } /** - *

Setter for the field madness.

- * - * @param b a boolean. + *

+ * Setter for the field madness. + *

+ * + * @param b + * a boolean. */ - public void setMadness(boolean b) { + public final void setMadness(final boolean b) { madness = b; } /** - *

Getter for the field madnessCost.

- * + *

+ * Getter for the field madnessCost. + *

+ * * @return a {@link java.lang.String} object. */ - public String getMadnessCost() { + public final String getMadnessCost() { return madnessCost; } /** - *

Setter for the field madnessCost.

- * - * @param cost a {@link java.lang.String} object. + *

+ * Setter for the field madnessCost. + *

+ * + * @param cost + * a {@link java.lang.String} object. */ - public void setMadnessCost(String cost) { + public final void setMadnessCost(final String cost) { madnessCost = cost; } /** - *

hasSuspend.

- * + *

+ * hasSuspend. + *

+ * * @return a boolean. */ - public boolean hasSuspend() { + public final boolean hasSuspend() { return suspend; } /** - *

Setter for the field suspend.

- * - * @param b a boolean. + *

+ * Setter for the field suspend. + *

+ * + * @param b + * a boolean. */ - public void setSuspend(boolean b) { + public final void setSuspend(final boolean b) { suspend = b; } /** - *

wasSuspendCast.

- * + *

+ * wasSuspendCast. + *

+ * * @return a boolean. */ - public boolean wasSuspendCast() { + public final boolean wasSuspendCast() { return suspendCast; } /** - *

Setter for the field suspendCast.

- * - * @param b a boolean. + *

+ * Setter for the field suspendCast. + *

+ * + * @param b + * a boolean. */ - public void setSuspendCast(boolean b) { + public final void setSuspendCast(final boolean b) { suspendCast = b; } /** - *

Setter for the field kicked.

- * - * @param b a boolean. + *

+ * Setter for the field kicked. + *

+ * + * @param b + * a boolean. */ - public void setKicked(boolean b) { + public final void setKicked(final boolean b) { kicked = b; } /** - *

isKicked.

- * + *

+ * isKicked. + *

+ * * @return a boolean. */ - public boolean isKicked() { + public final boolean isKicked() { return kicked; } - public boolean isPhasedOut() { + /** + * Checks if is phased out. + * + * @return true, if is phased out + */ + public final boolean isPhasedOut() { return phasedOut; } - public void setPhasedOut(boolean phasedOut) { + /** + * Sets the phased out. + * + * @param phasedOut the new phased out + */ + public final void setPhasedOut(final boolean phasedOut) { this.phasedOut = phasedOut; } - - public void phase(){ + + /** + * Phase. + */ + public final void phase() { this.phase(true); } - - public void phase(boolean direct){ + + /** + * Phase. + * + * @param direct the direct + */ + public final void phase(final boolean direct) { boolean phasingIn = this.isPhasedOut(); - - if (!this.switchPhaseState()){ + + if (!this.switchPhaseState()) { // Switch Phase State returns False if the Permanent can't Phase Out return; } - - if (!phasingIn){ + + if (!phasingIn) { this.setDirectlyPhasedOut(direct); } - - for (Card eq : this.getEquippedBy()){ - if (eq.isPhasedOut() == phasingIn){ + + for (Card eq : this.getEquippedBy()) { + if (eq.isPhasedOut() == phasingIn) { eq.phase(false); } } - - for (Card aura : this.getEnchantedBy()){ - if (aura.isPhasedOut() == phasingIn){ + + for (Card aura : this.getEnchantedBy()) { + if (aura.isPhasedOut() == phasingIn) { aura.phase(false); } } } - - private boolean switchPhaseState(){ - if (!this.phasedOut && this.hasKeyword("CARDNAME can't phase out.")){ + + private boolean switchPhaseState() { + if (!this.phasedOut && this.hasKeyword("CARDNAME can't phase out.")) { return false; } - + this.phasedOut = !this.phasedOut; - if (this.phasedOut && isToken()){ - // 702.23k Phased-out tokens cease to exist as a state-based action. See rule 704.5d. - // 702.23d The phasing event doesn't actually cause a permanent to change zones or control, - // even though it's treated as though it's not on the battlefield and not under its controller's control while it's phased out. - // Zone-change triggers don't trigger when a permanent phases in or out. - - // Suppressed Exiling is as close as we can get to "ceasing to exist" + if (this.phasedOut && isToken()) { + // 702.23k Phased-out tokens cease to exist as a state-based action. + // See rule 704.5d. + // 702.23d The phasing event doesn't actually cause a permanent to + // change zones or control, + // even though it's treated as though it's not on the battlefield + // and not under its controller's control while it's phased out. + // Zone-change triggers don't trigger when a permanent phases in or + // out. + + // Suppressed Exiling is as close as we can get to + // "ceasing to exist" AllZone.getTriggerHandler().suppressMode("ChangesZone"); AllZone.getGameAction().exile(this); AllZone.getTriggerHandler().clearSuppression("ChangesZone"); } return true; } - - public boolean isDirectlyPhasedOut(){ + + /** + * Checks if is directly phased out. + * + * @return true, if is directly phased out + */ + public final boolean isDirectlyPhasedOut() { return this.directlyPhasedOut; } - - public void setDirectlyPhasedOut(boolean direct){ + + /** + * Sets the directly phased out. + * + * @param direct the new directly phased out + */ + public final void setDirectlyPhasedOut(final boolean direct) { this.directlyPhasedOut = direct; } /** - *

isReflectedLand.

- * + *

+ * isReflectedLand. + *

+ * * @return a boolean. */ - public boolean isReflectedLand() { - for(Ability_Mana am : getCharacteristics().getManaAbility()) - if (am.isReflectedMana()) - return true; - - return false; + public final boolean isReflectedLand() { + for (Ability_Mana am : getCharacteristics().getManaAbility()) { + if (am.isReflectedMana()) { + return true; + } + } + + return false; } /** - *

hasKeyword.

- * - * @param keyword a {@link java.lang.String} object. + *

+ * hasKeyword. + *

+ * + * @param keyword + * a {@link java.lang.String} object. * @return a boolean. */ - public boolean hasKeyword(String keyword) { + public final boolean hasKeyword(final String keyword) { return getKeyword().contains(keyword); } /** - *

hasStartOfKeyword.

- * - * @param keyword a {@link java.lang.String} object. + *

+ * hasStartOfKeyword. + *

+ * + * @param keyword + * a {@link java.lang.String} object. * @return a boolean. */ - public boolean hasStartOfKeyword(String keyword) { + public final boolean hasStartOfKeyword(final String keyword) { ArrayList a = getKeyword(); - for (int i = 0; i < a.size(); i++) - if (a.get(i).toString().startsWith(keyword)) return true; - return false; - } - - /** - *

hasStartOfKeyword.

- * - * @param keyword a {@link java.lang.String} object. - * @return a boolean. - */ - public boolean hasStartOfUnHiddenKeyword(String keyword) { - ArrayList a = this.getUnhiddenKeyword(); - for (int i = 0; i < a.size(); i++) - if (a.get(i).toString().startsWith(keyword)) return true; + for (int i = 0; i < a.size(); i++) { + if (a.get(i).toString().startsWith(keyword)) { + return true; + } + } return false; } /** - *

getKeywordPosition.

- * - * @param k a {@link java.lang.String} object. + *

+ * hasStartOfKeyword. + *

+ * + * @param keyword + * a {@link java.lang.String} object. + * @return a boolean. + */ + public final boolean hasStartOfUnHiddenKeyword(final String keyword) { + ArrayList a = this.getUnhiddenKeyword(); + for (int i = 0; i < a.size(); i++) { + if (a.get(i).toString().startsWith(keyword)) { + return true; + } + } + return false; + } + + /** + *

+ * getKeywordPosition. + *

+ * + * @param k + * a {@link java.lang.String} object. * @return a int. */ - public int getKeywordPosition(String k) { + public final int getKeywordPosition(final String k) { ArrayList a = getKeyword(); - for (int i = 0; i < a.size(); i++) - if (a.get(i).toString().startsWith(k)) return i; + for (int i = 0; i < a.size(); i++) { + if (a.get(i).toString().startsWith(k)) { + return i; + } + } return -1; } /** - *

keywordsContain.

- * - * @param keyword a {@link java.lang.String} object. + *

+ * keywordsContain. + *

+ * + * @param keyword + * a {@link java.lang.String} object. * @return a boolean. */ - public boolean keywordsContain(String keyword) { + public final boolean keywordsContain(final String keyword) { ArrayList a = getKeyword(); - for (int i = 0; i < a.size(); i++) - if (a.get(i).toString().contains(keyword)) return true; + for (int i = 0; i < a.size(); i++) { + if (a.get(i).toString().contains(keyword)) { + return true; + } + } return false; } - /** - *

hasAnyKeyword.

- * - * @param keywords an array of {@link java.lang.String} objects. + *

+ * hasAnyKeyword. + *

+ * + * @param keywords + * an array of {@link java.lang.String} objects. * @return a boolean. */ - public boolean hasAnyKeyword(String keywords[]) { - for (int i = 0; i < keywords.length; i++) - if (hasKeyword(keywords[i])) + public final boolean hasAnyKeyword(final String[] keywords) { + for (int i = 0; i < keywords.length; i++) { + if (hasKeyword(keywords[i])) { return true; + } + } return false; } /** - *

hasAnyKeyword.

- * - * @param keywords a {@link java.util.ArrayList} object. + *

+ * hasAnyKeyword. + *

+ * + * @param keywords + * a {@link java.util.ArrayList} object. * @return a boolean. */ - public boolean hasAnyKeyword(ArrayList keywords) { - for (int i = 0; i < keywords.size(); i++) - if (hasKeyword(keywords.get(i))) + public final boolean hasAnyKeyword(final ArrayList keywords) { + for (int i = 0; i < keywords.size(); i++) { + if (hasKeyword(keywords.get(i))) { return true; + } + } return false; } - //This counts the number of instances of a keyword a card has + // This counts the number of instances of a keyword a card has /** - *

getAmountOfKeyword.

- * - * @param k a {@link java.lang.String} object. + *

+ * getAmountOfKeyword. + *

+ * + * @param k + * a {@link java.lang.String} object. * @return a int. */ - public int getAmountOfKeyword(String k) { + public final int getAmountOfKeyword(final String k) { int count = 0; ArrayList keywords = getKeyword(); for (int j = 0; j < keywords.size(); j++) { - if (keywords.get(j).equals(k)) count++; + if (keywords.get(j).equals(k)) { + count++; + } } return count; } - // This is for keywords with a number like Bushido, Annihilator and Rampage. It returns the total. + // This is for keywords with a number like Bushido, Annihilator and Rampage. + // It returns the total. /** - *

getKeywordMagnitude.

- * - * @param k a {@link java.lang.String} object. + *

+ * getKeywordMagnitude. + *

+ * + * @param k + * a {@link java.lang.String} object. * @return a int. */ - public int getKeywordMagnitude(String k) { + public final int getKeywordMagnitude(final String k) { int count = 0; ArrayList keywords = getKeyword(); for (String kw : keywords) { @@ -4985,14 +6160,17 @@ public class Card extends GameEntity implements Comparable { return count; } - private String toMixedCase(String s) { - if (s.equals("")) return s; + private String toMixedCase(final String s) { + if (s.equals("")) { + return s; + } StringBuilder sb = new StringBuilder(); // to handle hyphenated Types String[] types = s.split("-"); for (int i = 0; i < types.length; i++) { - if (i != 0) + if (i != 0) { sb.append("-"); + } sb.append(types[i].substring(0, 1).toUpperCase()); sb.append(types[i].substring(1).toLowerCase()); } @@ -5000,178 +6178,272 @@ public class Card extends GameEntity implements Comparable { return sb.toString(); } - //usable to check for changelings + // usable to check for changelings /** - *

isType.

- * - * @param cardType a {@link java.lang.String} object. + *

+ * isType. + *

+ * + * @param cardType + * a {@link java.lang.String} object. * @return a boolean. */ - public boolean isType(String cardType) { + public final boolean isType(String cardType) { cardType = toMixedCase(cardType); - if (typeContains(cardType) - || ((isCreature() || isTribal()) - && CardUtil.isACreatureType(cardType) && typeContains("AllCreatureTypes"))) return true; + if (typeContains(cardType) || ((isCreature() || isTribal()) + && CardUtil.isACreatureType(cardType) && typeContains("AllCreatureTypes"))) + { + return true; + } return false; - }//isType + } // isType // Takes one argument like Permanent.Blue+withFlying /** - *

isValid.

- * - * @param Restriction a {@link java.lang.String} object. - * @param sourceController a {@link forge.Player} object. - * @param source a {@link forge.Card} object. + *

+ * isValid. + *

+ * + * @param Restriction + * a {@link java.lang.String} object. + * @param sourceController + * a {@link forge.Player} object. + * @param source + * a {@link forge.Card} object. * @return a boolean. */ @Override - public boolean isValid(final String Restriction, final Player sourceController, final Card source) { + public final boolean isValid(final String Restriction, final Player sourceController, final Card source) { - if (getName().equals("Mana Pool") || isImmutable()) return false; - - String incR[] = Restriction.split("\\."); // Inclusive restrictions are Card types - - if (incR[0].equals("Spell") && !isSpell()) + if (getName().equals("Mana Pool") || isImmutable()) { return false; - if (incR[0].equals("Permanent") && (isInstant() || isSorcery())) + } + + String[] incR = Restriction.split("\\."); // Inclusive restrictions are + // Card types + + if (incR[0].equals("Spell") && !isSpell()) { return false; - if (!incR[0].equals("card") - && !incR[0].equals("Card") - && !incR[0].equals("Spell") - && !incR[0].equals("Permanent") - && !(isType(incR[0]))) - return false; //Check for wrong type + } + if (incR[0].equals("Permanent") && (isInstant() || isSorcery())) { + return false; + } + if (!incR[0].equals("card") && !incR[0].equals("Card") && !incR[0].equals("Spell") + && !incR[0].equals("Permanent") && !(isType(incR[0]))) + { + return false; // Check for wrong type + } if (incR.length > 1) { final String excR = incR[1]; - String exR[] = excR.split("\\+"); // Exclusive Restrictions are ... - for (int j = 0; j < exR.length; j++) - if (hasProperty(exR[j], sourceController, source) == false) return false; + String[] exR = excR.split("\\+"); // Exclusive Restrictions are ... + for (int j = 0; j < exR.length; j++) { + if (!hasProperty(exR[j], sourceController, source)) { + return false; + } + } } return true; - }//isValid(String Restriction) + } // isValid(String Restriction) // Takes arguments like Blue or withFlying /** - *

hasProperty.

- * - * @param Property a {@link java.lang.String} object. - * @param sourceController a {@link forge.Player} object. - * @param source a {@link forge.Card} object. + *

+ * hasProperty. + *

+ * + * @param Property + * a {@link java.lang.String} object. + * @param sourceController + * a {@link forge.Player} object. + * @param source + * a {@link forge.Card} object. * @return a boolean. */ @Override - public boolean hasProperty(String Property, final Player sourceController, final Card source) { - //by name can also have color names, so needs to happen before colors. + public boolean hasProperty(final String Property, final Player sourceController, final Card source) { + // by name can also have color names, so needs to happen before colors. if (Property.startsWith("named")) { - if (!getName().equals(Property.substring(5))) return false; + if (!getName().equals(Property.substring(5))) { + return false; + } } else if (Property.startsWith("notnamed")) { - if (getName().equals(Property.substring(8))) return false; + if (getName().equals(Property.substring(8))) { + return false; + } } else if (Property.startsWith("sameName")) { - if (!getName().equals(source.getName())) return false; + if (!getName().equals(source.getName())) { + return false; + } } else if (Property.equals("NamedCard")) { - if (!getName().equals(source.getNamedCard())) return false; + if (!getName().equals(source.getNamedCard())) { + return false; + } } // ... Card colors - else if (Property.contains("White") - || Property.contains("Blue") - || Property.contains("Black") - || Property.contains("Red") - || Property.contains("Green") - || Property.contains("Colorless")) { + else if (Property.contains("White") || Property.contains("Blue") || Property.contains("Black") + || Property.contains("Red") || Property.contains("Green") || Property.contains("Colorless")) { if (Property.startsWith("non")) { - if (CardUtil.getColors(this).contains(Property.substring(3).toLowerCase())) return false; - } else if (!CardUtil.getColors(this).contains(Property.toLowerCase())) return false; + if (CardUtil.getColors(this).contains(Property.substring(3).toLowerCase())) { + return false; + } + } else if (!CardUtil.getColors(this).contains(Property.toLowerCase())) { + return false; + } } else if (Property.contains("MultiColor")) // ... Card is multicolored { - if (Property.startsWith("non") && (CardUtil.getColors(this).size() > 1)) return false; - if (!Property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) return false; - } else if (Property.contains("MonoColor")) // ... Card is monocolored - { - if (Property.startsWith("non") && (CardUtil.getColors(this).size() == 1 && !isColorless())) return false; - if (!Property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) return false; + if (Property.startsWith("non") && (CardUtil.getColors(this).size() > 1)) { + return false; + } + if (!Property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) { + return false; + } + } else if (Property.contains("MonoColor")) { + // ... Card is monocolored + if (Property.startsWith("non") && (CardUtil.getColors(this).size() == 1 && !isColorless())) { + return false; + } + if (!Property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) { + return false; + } } else if (Property.equals("ChosenColor")) { - //Should this match All chosen colors, or any? Default to first chosen for now until it matters. - if (source.getChosenColor().size() == 0) return false; - if (!CardUtil.getColors(this).contains(source.getChosenColor().get(0))) return false; + // Should this match All chosen colors, or any? Default to first + // chosen for now until it matters. + if (source.getChosenColor().size() == 0) { + return false; + } + if (!CardUtil.getColors(this).contains(source.getChosenColor().get(0))) { + return false; + } } else if (Property.equals("DoubleFaced")) { - if (!isDoubleFaced) return false; + if (!isDoubleFaced) { + return false; + } } else if (Property.equals("Flip")) { - if (!isFlip) return false; + if (!isFlip) { + return false; + } } else if (Property.startsWith("YouCtrl")) { - if (!getController().isPlayer(sourceController)) return false; + if (!getController().isPlayer(sourceController)) { + return false; + } } else if (Property.startsWith("YouDontCtrl")) { - if (getController().isPlayer(sourceController)) return false; + if (getController().isPlayer(sourceController)) { + return false; + } } else if (Property.startsWith("EnchantedPlayerCtrl")) { Object o = source.getEnchanting(); if (o instanceof Player) { - if (!getController().isPlayer((Player) o)) return false; - } - else { // source not enchanting a player + if (!getController().isPlayer((Player) o)) { + return false; + } + } else { // source not enchanting a player return false; } } else if (Property.startsWith("YouOwn")) { - if (!getOwner().isPlayer(sourceController)) return false; + if (!getOwner().isPlayer(sourceController)) { + return false; + } } else if (Property.startsWith("YouDontOwn")) { - if (getOwner().isPlayer(sourceController)) return false; + if (getOwner().isPlayer(sourceController)) { + return false; + } } else if (Property.startsWith("OwnerDoesntControl")) { - if(getOwner().isPlayer(getController())) return false; + if (getOwner().isPlayer(getController())) { + return false; + } } else if (Property.startsWith("ControllerControls")) { String type = Property.substring(18); CardList list = getController().getCardsIn(Zone.Battlefield); - if (list.getType(type).isEmpty()) return false; + if (list.getType(type).isEmpty()) { + return false; + } } else if (Property.startsWith("Other")) { - if (this.equals(source)) return false; + if (this.equals(source)) { + return false; + } } else if (Property.startsWith("Self")) { - if (!this.equals(source)) return false; + if (!this.equals(source)) { + return false; + } } else if (Property.startsWith("AttachedBy")) { - if (!equippedBy.contains(source) && !enchantedBy.contains(source)) return false; + if (!equippedBy.contains(source) && !enchantedBy.contains(source)) { + return false; + } } else if (Property.startsWith("Attached")) { - if (!equipping.contains(source) && !source.equals(enchanting)) return false; + if (!equipping.contains(source) && !source.equals(enchanting)) { + return false; + } } else if (Property.startsWith("EnchantedBy")) { - if (!enchantedBy.contains(source)) return false; + if (!enchantedBy.contains(source)) { + return false; + } } else if (Property.startsWith("NotEnchantedBy")) { - if (enchantedBy.contains(source)) return false; + if (enchantedBy.contains(source)) { + return false; + } } else if (Property.startsWith("Enchanted")) { - if (!source.equals(enchanting)) return false; + if (!source.equals(enchanting)) { + return false; + } } else if (Property.startsWith("EquippedBy")) { - if (!equippedBy.contains(source)) return false; + if (!equippedBy.contains(source)) { + return false; + } } else if (Property.startsWith("Equipped")) { - if (!equipping.contains(source)) return false; + if (!equipping.contains(source)) { + return false; + } } else if (Property.startsWith("HauntedBy")) { - if (!hauntedBy.contains(source)) return false; - } else if (Property.startsWith("Above")){ // "Are Above" Source - CardList list = this.getOwner().getCardsIn(Zone.Graveyard); - if (!list.getAbove(source, this)) - return false; - } else if (Property.startsWith("DirectlyAbove")){ // "Are Directly Above" Source - CardList list = this.getOwner().getCardsIn(Zone.Graveyard); - if (!list.getDirectlyAbove(source, this)) - return false; - } else if (Property.startsWith("TopGraveyardCreature")){ + if (!hauntedBy.contains(source)) { + return false; + } + } else if (Property.startsWith("Above")) { // "Are Above" Source + CardList list = this.getOwner().getCardsIn(Zone.Graveyard); + if (!list.getAbove(source, this)) { + return false; + } + } else if (Property.startsWith("DirectlyAbove")) { // "Are Directly Above" + // Source + CardList list = this.getOwner().getCardsIn(Zone.Graveyard); + if (!list.getDirectlyAbove(source, this)) { + return false; + } + } else if (Property.startsWith("TopGraveyardCreature")) { CardList list = this.getOwner().getCardsIn(Zone.Graveyard); list = list.getType("Creature"); list.reverse(); - if (list.isEmpty() || !this.equals(list.get(0))) + if (list.isEmpty() || !this.equals(list.get(0))) { return false; - } else if (Property.startsWith("TopGraveyard")){ + } + } else if (Property.startsWith("TopGraveyard")) { CardList list = this.getOwner().getCardsIn(Zone.Graveyard); list.reverse(); - if (list.isEmpty() || !this.equals(list.get(0))) + if (list.isEmpty() || !this.equals(list.get(0))) { return false; - } else if (Property.startsWith("TopLibrary")){ + } + } else if (Property.startsWith("TopLibrary")) { CardList list = this.getOwner().getCardsIn(Zone.Library); - if (list.isEmpty() || !this.equals(list.get(0))) + if (list.isEmpty() || !this.equals(list.get(0))) { return false; + } } else if (Property.startsWith("Cloned")) { - if (cloneOrigin == null || !cloneOrigin.equals(source)) return false; + if (cloneOrigin == null || !cloneOrigin.equals(source)) { + return false; + } } else if (Property.startsWith("DamagedBy")) { - if (!receivedDamageFromThisTurn.containsKey(source)) return false; + if (!receivedDamageFromThisTurn.containsKey(source)) { + return false; + } } else if (Property.startsWith("Damaged")) { - if (!dealtDamageToThisTurn.containsKey(source)) return false; + if (!dealtDamageToThisTurn.containsKey(source)) { + return false; + } } else if (Property.startsWith("SharesColorWith")) { - if (!sharesColorWith(source)) return false; + if (!sharesColorWith(source)) { + return false; + } } else if (Property.startsWith("withFlashback")) { boolean fb = false; if (hasStartOfUnHiddenKeyword("Flashback")) { @@ -5185,28 +6457,48 @@ public class Card extends GameEntity implements Comparable { if (!fb) { return false; } - } else if (Property.startsWith("with")) // ... Card keywords - { - if (Property.startsWith("without") && hasStartOfUnHiddenKeyword(Property.substring(7))) return false; - if (!Property.startsWith("without") && !hasStartOfUnHiddenKeyword(Property.substring(4))) return false; + } else if (Property.startsWith("with")) { + // ... Card keywords + if (Property.startsWith("without") && hasStartOfUnHiddenKeyword(Property.substring(7))) { + return false; + } + if (!Property.startsWith("without") && !hasStartOfUnHiddenKeyword(Property.substring(4))) { + return false; + } } else if (Property.startsWith("tapped")) { - if (!isTapped()) return false; + if (!isTapped()) { + return false; + } } else if (Property.startsWith("untapped")) { - if (!isUntapped()) return false; + if (!isUntapped()) { + return false; + } } else if (Property.startsWith("faceDown")) { - if (!isFaceDown()) return false; + if (!isFaceDown()) { + return false; + } } else if (Property.startsWith("faceUp")) { - if (isFaceDown()) return false; + if (isFaceDown()) { + return false; + } } else if (Property.startsWith("hasLevelUp")) { - if (!hasLevelUp()) return false; + if (!hasLevelUp()) { + return false; + } } else if (Property.startsWith("enteredBattlefieldThisTurn")) { - if (!(getTurnInZone() == AllZone.getPhase().getTurn())) return false; + if (!(getTurnInZone() == AllZone.getPhase().getTurn())) { + return false; + } } else if (Property.startsWith("dealtDamageToYouThisTurn")) { if (!(dealtDmgToHumanThisTurn && getController().isPlayer(AllZone.getComputerPlayer())) && !(dealtDmgToComputerThisTurn && getController().isPlayer(AllZone.getHumanPlayer()))) + { return false; + } } else if (Property.startsWith("wasDealtDamageThisTurn")) { - if ((getReceivedDamageFromThisTurn().keySet()).isEmpty()) return false; + if ((getReceivedDamageFromThisTurn().keySet()).isEmpty()) { + return false; + } } else if (Property.startsWith("greatestPower")) { CardList list = AllZoneUtil.getCreaturesInPlay(); for (Card crd : list) { @@ -5229,29 +6521,47 @@ public class Card extends GameEntity implements Comparable { } } } else if (Property.startsWith("enchanted")) { - if (!isEnchanted()) return false; + if (!isEnchanted()) { + return false; + } } else if (Property.startsWith("unenchanted")) { - if (isEnchanted()) return false; + if (isEnchanted()) { + return false; + } } else if (Property.startsWith("enchanting")) { - if (!isEnchanting()) return false; + if (!isEnchanting()) { + return false; + } } else if (Property.startsWith("equipped")) { - if (!isEquipped()) return false; + if (!isEquipped()) { + return false; + } } else if (Property.startsWith("unequipped")) { - if (isEquipped()) return false; + if (isEquipped()) { + return false; + } } else if (Property.startsWith("equipping")) { - if (!isEquipping()) return false; + if (!isEquipping()) { + return false; + } } else if (Property.startsWith("token")) { - if (!isToken()) return false; + if (!isToken()) { + return false; + } } else if (Property.startsWith("nonToken")) { - if (isToken()) return false; + if (isToken()) { + return false; + } } else if (Property.startsWith("hasXCost")) { - if (getSpellAbility().length > 0) - if (!getSpellAbility()[0].isXCost()) + if (getSpellAbility().length > 0) { + if (!getSpellAbility()[0].isXCost()) { return false; + } + } - } else if (Property.startsWith("power") || // 8/10 - Property.startsWith("toughness") || - Property.startsWith("cmc")) { + } else if (Property.startsWith("power") || // 8/10 + Property.startsWith("toughness") || Property.startsWith("cmc")) + { int x = 0; int y = 0; int z = 0; @@ -5271,183 +6581,247 @@ public class Card extends GameEntity implements Comparable { x = CardFactoryUtil.xCount(source, source.getSVar("X")); } else if (Property.substring(z).equals("Y")) { x = CardFactoryUtil.xCount(source, source.getSVar("Y")); - } else + } else { x = Integer.parseInt(Property.substring(z)); + } - if (!AllZoneUtil.compare(y, Property, x)) + if (!AllZoneUtil.compare(y, Property, x)) { return false; + } } - // syntax example: countersGE9 P1P1 or countersLT12TIME (greater number than 99 not supported) + // syntax example: countersGE9 P1P1 or countersLT12TIME (greater number + // than 99 not supported) /* - * slapshot5 - fair warning, you cannot use numbers with 2 digits (greater number than 9 not supported - * you can use X and the SVar:X:Number$12 to get two digits. This will need a better fix, and I have the - * beginnings of a regex below - */ + * slapshot5 - fair warning, you cannot use numbers with 2 digits + * (greater number than 9 not supported you can use X and the + * SVar:X:Number$12 to get two digits. This will need a better fix, and + * I have the beginnings of a regex below + */ else if (Property.startsWith("counters")) { /* - Pattern p = Pattern.compile("[a-z]*[A-Z][A-Z][X0-9]+.*$"); - String[] parse = ??? - System.out.println("Parsing completed of: "+Property); - for(int i = 0; i < parse.length; i++) { - System.out.println("parse["+i+"]: "+parse[i]); - }*/ + * Pattern p = Pattern.compile("[a-z]*[A-Z][A-Z][X0-9]+.*$"); + * String[] parse = ??? + * System.out.println("Parsing completed of: "+Property); for(int i + * = 0; i < parse.length; i++) { + * System.out.println("parse["+i+"]: "+parse[i]); } + */ - // TODO: get a working regex out of this pattern so the amount of digits doesn't matter + // TODO get a working regex out of this pattern so the amount of + // digits doesn't matter int number = 0; String[] splitProperty = Property.split("_"); String strNum = splitProperty[1].substring(2); - String comparator = splitProperty[1].substring(0,2); + String comparator = splitProperty[1].substring(0, 2); String counterType = ""; try { number = Integer.parseInt(strNum); - } - catch(NumberFormatException e) { + } catch (NumberFormatException e) { number = CardFactoryUtil.xCount(source, source.getSVar(strNum)); } counterType = splitProperty[2]; - + int actualnumber = getCounters(Counters.getType(counterType)); - - if (!AllZoneUtil.compare(actualnumber, comparator, number)) + + if (!AllZoneUtil.compare(actualnumber, comparator, number)) { return false; + } } else if (Property.startsWith("attacking")) { - if (!isAttacking()) return false; + if (!isAttacking()) { + return false; + } } else if (Property.startsWith("notattacking")) { - if (isAttacking()) return false; + if (isAttacking()) { + return false; + } } else if (Property.equals("blocking")) { - if (!isBlocking()) return false; + if (!isBlocking()) { + return false; + } } else if (Property.startsWith("blockingSource")) { - if (!isBlocking(source)) return false; + if (!isBlocking(source)) { + return false; + } } else if (Property.startsWith("notblocking")) { - if (isBlocking()) return false; + if (isBlocking()) { + return false; + } } else if (Property.equals("blocked")) { - if (!AllZone.getCombat().isBlocked(this)) return false; + if (!AllZone.getCombat().isBlocked(this)) { + return false; + } } else if (Property.startsWith("blockedBySource")) { - if (!isBlockedBy(source)) return false; + if (!isBlockedBy(source)) { + return false; + } } else if (Property.startsWith("unblocked")) { - if (!AllZone.getCombat().isUnblocked(this)) return false; + if (!AllZone.getCombat().isUnblocked(this)) { + return false; + } } else if (Property.startsWith("kicked")) { - if (!isKicked()) return false; + if (!isKicked()) { + return false; + } } else if (Property.startsWith("notkicked")) { - if (isKicked()) return false; + if (isKicked()) { + return false; + } } else if (Property.startsWith("evoked")) { - if (!isEvoked()) return false; + if (!isEvoked()) { + return false; + } } else if (Property.equals("HasDevoured")) { - if(devouredCards.size() == 0) return false; + if (devouredCards.size() == 0) { + return false; + } } else if (Property.equals("HasNotDevoured")) { - if(devouredCards.size() != 0) return false; - } else if (Property.startsWith("non")) // ... Other Card types - { - if (isType(Property.substring(3))) return false; + if (devouredCards.size() != 0) { + return false; + } + } else if (Property.startsWith("non")) { + // ... Other Card types + if (isType(Property.substring(3))) { + return false; + } } else if (Property.equals("CostsPhyrexianMana")) { - if (!getCharacteristics().getManaCost().contains("P")) return false; + if (!getCharacteristics().getManaCost().contains("P")) { + return false; + } } else if (Property.equals("IsRemembered")) { - if(!source.getRemembered().contains(this)) return false; + if (!source.getRemembered().contains(this)) { + return false; + } } else { if (Property.equals("ChosenType")) { - if (!isType(source.getChosenType())) return false; + if (!isType(source.getChosenType())) { + return false; + } } else { - if (!isType(Property)) return false; + if (!isType(Property)) { + return false; + } } } return true; - }//hasProperty + } // hasProperty /** - *

setImmutable.

- * - * @param isImmutable a boolean. + *

+ * setImmutable. + *

+ * + * @param isImmutable + * a boolean. */ - public void setImmutable(boolean isImmutable) { + public final void setImmutable(final boolean isImmutable) { this.isImmutable = isImmutable; } /** - *

isImmutable.

- * + *

+ * isImmutable. + *

+ * * @return a boolean. */ - public boolean isImmutable() { + public final boolean isImmutable() { return isImmutable; } /* - * there are easy checkers for Color. The CardUtil functions should - * be made part of the Card class, so calling out is not necessary - */ + * there are easy checkers for Color. The CardUtil functions should be made + * part of the Card class, so calling out is not necessary + */ /** - *

isColor.

- * - * @param col a {@link java.lang.String} object. + *

+ * isColor. + *

+ * + * @param col + * a {@link java.lang.String} object. * @return a boolean. */ - public boolean isColor(String col) { + public final boolean isColor(final String col) { return CardUtil.getColors(this).contains(col); } /** - *

isBlack.

- * + *

+ * isBlack. + *

+ * * @return a boolean. */ - public boolean isBlack() { + public final boolean isBlack() { return CardUtil.getColors(this).contains(Constant.Color.Black); } /** - *

isBlue.

- * + *

+ * isBlue. + *

+ * * @return a boolean. */ - public boolean isBlue() { + public final boolean isBlue() { return CardUtil.getColors(this).contains(Constant.Color.Blue); } /** - *

isRed.

- * + *

+ * isRed. + *

+ * * @return a boolean. */ - public boolean isRed() { + public final boolean isRed() { return CardUtil.getColors(this).contains(Constant.Color.Red); } /** - *

isGreen.

- * + *

+ * isGreen. + *

+ * * @return a boolean. */ - public boolean isGreen() { + public final boolean isGreen() { return CardUtil.getColors(this).contains(Constant.Color.Green); } /** - *

isWhite.

- * + *

+ * isWhite. + *

+ * * @return a boolean. */ - public boolean isWhite() { + public final boolean isWhite() { return CardUtil.getColors(this).contains(Constant.Color.White); } /** - *

isColorless.

- * + *

+ * isColorless. + *

+ * * @return a boolean. */ - public boolean isColorless() { + public final boolean isColorless() { return CardUtil.getColors(this).contains(Constant.Color.Colorless); } /** - *

sharesColorWith.

- * - * @param c1 a {@link forge.Card} object. + *

+ * sharesColorWith. + *

+ * + * @param c1 + * a {@link forge.Card} object. * @return a boolean. */ - public boolean sharesColorWith(final Card c1) { + public final boolean sharesColorWith(final Card c1) { boolean shares = false; shares |= (isBlack() && c1.isBlack()); shares |= (isBlue() && c1.isBlue()); @@ -5458,179 +6832,232 @@ public class Card extends GameEntity implements Comparable { } /** - *

isAttacking.

- * + *

+ * isAttacking. + *

+ * * @return a boolean. */ - public boolean isAttacking() { + public final boolean isAttacking() { return AllZone.getCombat().isAttacking(this); } /** - *

isBlocking.

- * + *

+ * isBlocking. + *

+ * * @return a boolean. */ - public boolean isBlocking() { + public final boolean isBlocking() { CardList blockers = AllZone.getCombat().getAllBlockers(); return blockers.contains(this); } /** - *

isBlocking.

- * - * @param attacker a {@link forge.Card} object. + *

+ * isBlocking. + *

+ * + * @param attacker + * a {@link forge.Card} object. * @return a boolean. */ - public boolean isBlocking(Card attacker) { + public final boolean isBlocking(final Card attacker) { return attacker.equals(AllZone.getCombat().getAttackerBlockedBy(this)); } /** - *

isBlockedBy.

- * - * @param blocker a {@link forge.Card} object. + *

+ * isBlockedBy. + *

+ * + * @param blocker + * a {@link forge.Card} object. * @return a boolean. */ - public boolean isBlockedBy(Card blocker) { + public final boolean isBlockedBy(final Card blocker) { return this.equals(AllZone.getCombat().getAttackerBlockedBy(blocker)); } - /////////////////////////// + // ///////////////////////// // // Damage code // - ////////////////////////// + // //////////////////////// - //all damage to cards is now handled in Card.java, no longer AllZone.getGameAction()... + // all damage to cards is now handled in Card.java, no longer + // AllZone.getGameAction()... /** - *

addReceivedDamageFromThisTurn.

- * - * @param c a {@link forge.Card} object. - * @param damage a int. + *

+ * addReceivedDamageFromThisTurn. + *

+ * + * @param c + * a {@link forge.Card} object. + * @param damage + * a int. */ - public void addReceivedDamageFromThisTurn(Card c, int damage) { + public final void addReceivedDamageFromThisTurn(final Card c, int damage) { receivedDamageFromThisTurn.put(c, damage); } /** - *

Setter for the field receivedDamageFromThisTurn.

- * - * @param receivedDamageList a Map object. + *

+ * Setter for the field receivedDamageFromThisTurn. + *

+ * + * @param receivedDamageList + * a Map object. */ - public void setReceivedDamageFromThisTurn(Map receivedDamageList) { + public final void setReceivedDamageFromThisTurn(final Map receivedDamageList) { receivedDamageFromThisTurn = receivedDamageList; } /** - *

Getter for the field receivedDamageFromThisTurn.

- * + *

+ * Getter for the field receivedDamageFromThisTurn. + *

+ * * @return a Map object. */ - public Map getReceivedDamageFromThisTurn() { + public final Map getReceivedDamageFromThisTurn() { return receivedDamageFromThisTurn; } /** - *

resetReceivedDamageFromThisTurn.

+ *

+ * resetReceivedDamageFromThisTurn. + *

*/ - public void resetReceivedDamageFromThisTurn() { + public final void resetReceivedDamageFromThisTurn() { receivedDamageFromThisTurn.clear(); } /** - *

addDealtDamageToThisTurn.

- * - * @param c a {@link forge.Card} object. - * @param damage a int. + *

+ * addDealtDamageToThisTurn. + *

+ * + * @param c + * a {@link forge.Card} object. + * @param damage + * a int. */ - public void addDealtDamageToThisTurn(Card c, int damage) { + public final void addDealtDamageToThisTurn(final Card c, int damage) { dealtDamageToThisTurn.put(c, damage); } /** - *

Setter for the field dealtDamageToThisTurn.

- * - * @param dealtDamageList a {@link java.util.Map} object. + *

+ * Setter for the field dealtDamageToThisTurn. + *

+ * + * @param dealtDamageList + * a {@link java.util.Map} object. */ - public void setDealtDamageToThisTurn(Map dealtDamageList) { + public final void setDealtDamageToThisTurn(final Map dealtDamageList) { dealtDamageToThisTurn = dealtDamageList; } /** - *

Getter for the field dealtDamageToThisTurn.

- * + *

+ * Getter for the field dealtDamageToThisTurn. + *

+ * * @return a {@link java.util.Map} object. */ - public Map getDealtDamageToThisTurn() { + public final Map getDealtDamageToThisTurn() { return dealtDamageToThisTurn; } /** - *

resetDealtDamageToThisTurn.

+ *

+ * resetDealtDamageToThisTurn. + *

*/ - public void resetDealtDamageToThisTurn() { + public final void resetDealtDamageToThisTurn() { dealtDamageToThisTurn.clear(); } - //how much damage is enough to kill the creature (for AI) + // how much damage is enough to kill the creature (for AI) /** - *

getEnoughDamageToKill.

- * - * @param maxDamage a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * getEnoughDamageToKill. + *

+ * + * @param maxDamage + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ - public int getEnoughDamageToKill(int maxDamage, Card source, boolean isCombat) { + public final int getEnoughDamageToKill(final int maxDamage, final Card source, final boolean isCombat) { return getEnoughDamageToKill(maxDamage, source, isCombat, false); } /** - *

getEnoughDamageToKill.

- * - * @param maxDamage a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. - * @param noPrevention a boolean. + *

+ * getEnoughDamageToKill. + *

+ * + * @param maxDamage + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. + * @param noPrevention + * a boolean. * @return a int. */ - public int getEnoughDamageToKill(int maxDamage, Card source, boolean isCombat, boolean noPrevention) { + public final int getEnoughDamageToKill(final int maxDamage, + final Card source, final boolean isCombat, final boolean noPrevention) + { int killDamage = getKillDamage(); if (hasKeyword("Indestructible") || getShield() > 0) { - if (!(source.hasKeyword("Wither") || source.hasKeyword("Infect"))) + if (!(source.hasKeyword("Wither") || source.hasKeyword("Infect"))) { return maxDamage + 1; + } } else if (source.hasKeyword("Deathtouch")) { for (int i = 1; i <= maxDamage; i++) { if (noPrevention) { - if (staticReplaceDamage(i, source, isCombat) > 0) + if (staticReplaceDamage(i, source, isCombat) > 0) { return i; - } else if (predictDamage(i, source, isCombat) > 0) + } + } else if (predictDamage(i, source, isCombat) > 0) { return i; + } } } for (int i = 1; i <= maxDamage; i++) { if (noPrevention) { - if (staticReplaceDamage(i, source, isCombat) >= killDamage) + if (staticReplaceDamage(i, source, isCombat) >= killDamage) { return i; + } } else { - if (predictDamage(i, source, isCombat) >= killDamage) + if (predictDamage(i, source, isCombat) >= killDamage) { return i; + } } } return maxDamage + 1; } - //the amount of damage needed to kill the creature (for AI) + // the amount of damage needed to kill the creature (for AI) /** - *

getKillDamage.

- * + *

+ * getKillDamage. + *

+ * * @return a int. */ - public int getKillDamage() { + public final int getKillDamage() { int killDamage = getLethalDamage() + getPreventNextDamage(); if (killDamage > getPreventNextDamage() && hasStartOfKeyword("When CARDNAME is dealt damage, destroy it.")) { killDamage = 1 + getPreventNextDamage(); @@ -5639,44 +7066,58 @@ public class Card extends GameEntity implements Comparable { return killDamage; } - //this is the minimal damage a trampling creature has to assign to a blocker + // this is the minimal damage a trampling creature has to assign to a + // blocker /** - *

getLethalDamage.

- * + *

+ * getLethalDamage. + *

+ * * @return a int. */ - public int getLethalDamage() { + public final int getLethalDamage() { int lethalDamage = getNetDefense() - getDamage() - getTotalAssignedDamage(); return lethalDamage; } /** - *

Setter for the field damage.

- * - * @param n a int. + *

+ * Setter for the field damage. + *

+ * + * @param n + * a int. */ - public void setDamage(int n) { - //if (this.hasKeyword("Prevent all damage that would be dealt to CARDNAME.")) n = 0; + public final void setDamage(final int n) { + // if + // (this.hasKeyword("Prevent all damage that would be dealt to CARDNAME.")) + // n = 0; damage = n; } /** - *

Getter for the field damage.

- * + *

+ * Getter for the field damage. + *

+ * * @return a int. */ - public int getDamage() { + public final int getDamage() { return damage; } /** - *

addAssignedDamage.

- * - * @param damage a int. - * @param sourceCard a {@link forge.Card} object. + *

+ * addAssignedDamage. + *

+ * + * @param damage + * a int. + * @param sourceCard + * a {@link forge.Card} object. */ - public void addAssignedDamage(int damage, Card sourceCard) { + public final void addAssignedDamage(int damage, final Card sourceCard) { if (damage < 0) { damage = 0; } @@ -5692,29 +7133,33 @@ public class Card extends GameEntity implements Comparable { Log.debug("***"); /* - if(sourceCards.size() > 1) - System.out.println("(MULTIPLE blockers):"); - System.out.println("Assigned " + damage + " damage to " + card); - for (int i=0;i 1) + * System.out.println("(MULTIPLE blockers):"); + * System.out.println("Assigned " + damage + " damage to " + card); for + * (int i=0;iclearAssignedDamage.

+ *

+ * clearAssignedDamage. + *

*/ - public void clearAssignedDamage() { + public final void clearAssignedDamage() { assignedDamageMap.clear(); } /** - *

getTotalAssignedDamage.

- * + *

+ * getTotalAssignedDamage. + *

+ * * @return a int. */ - public int getTotalAssignedDamage() { + public final int getTotalAssignedDamage() { int total = 0; Collection c = assignedDamageMap.values(); @@ -5728,20 +7173,25 @@ public class Card extends GameEntity implements Comparable { } /** - *

Getter for the field assignedDamageMap.

- * + *

+ * Getter for the field assignedDamageMap. + *

+ * * @return a {@link java.util.Map} object. */ - public Map getAssignedDamageMap() { + public final Map getAssignedDamageMap() { return assignedDamageMap; } /** - *

addCombatDamage.

- * - * @param map a {@link java.util.Map} object. + *

+ * addCombatDamage. + *

+ * + * @param map + * a {@link java.util.Map} object. */ - public void addCombatDamage(Map map) { + public final void addCombatDamage(final Map map) { CardList list = new CardList(); for (Entry entry : map.entrySet()) { @@ -5753,7 +7203,7 @@ public class Card extends GameEntity implements Comparable { damageToAdd = preventDamage(damageToAdd, source, true); if (damageToAdd > 0 && isCreature()) { - GameActionUtil.executeCombatDamageToCreatureEffects(source, this, damageToAdd); + GameActionUtil.executeCombatDamageToCreatureEffects(source, this, damageToAdd); } map.put(source, damageToAdd); } @@ -5763,17 +7213,26 @@ public class Card extends GameEntity implements Comparable { } } - //This function helps the AI calculate the actual amount of damage an effect would deal + // This function helps the AI calculate the actual amount of damage an + // effect would deal /** - *

predictDamage.

- * - * @param damage a int. - * @param possiblePrevention a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * predictDamage. + *

+ * + * @param damage + * a int. + * @param possiblePrevention + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ - public int predictDamage(final int damage, final int possiblePrevention, final Card source, final boolean isCombat) { + public final int predictDamage(final int damage, + final int possiblePrevention, final Card source, final boolean isCombat) + { int restDamage = damage; @@ -5784,17 +7243,26 @@ public class Card extends GameEntity implements Comparable { return restDamage; } - //This should be also usable by the AI to forecast an effect (so it must not change the game state) + // This should be also usable by the AI to forecast an effect (so it must + // not change the game state) /** - *

staticDamagePrevention.

- * - * @param damage a int. - * @param possiblePrvenetion a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * staticDamagePrevention. + *

+ * + * @param damage + * a int. + * @param possiblePrvenetion + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ - public int staticDamagePrevention(final int damage, final int possiblePrvenetion, final Card source, final boolean isCombat) { + public final int staticDamagePrevention(final int damage, final int possiblePrvenetion, final Card source, + final boolean isCombat) + { if (AllZoneUtil.isCardInPlay("Leyline of Punishment")) { return damage; @@ -5807,13 +7275,19 @@ public class Card extends GameEntity implements Comparable { return restDamage; } - //This should be also usable by the AI to forecast an effect (so it must not change the game state) + // This should be also usable by the AI to forecast an effect (so it must + // not change the game state) /** - *

staticDamagePrevention.

- * - * @param damageIn a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * staticDamagePrevention. + *

+ * + * @param damageIn + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ @Override @@ -5830,15 +7304,31 @@ public class Card extends GameEntity implements Comparable { } if (isCombat) { - if (hasKeyword("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")) return 0; - if (hasKeyword("Prevent all combat damage that would be dealt to CARDNAME.")) return 0; - if (source.hasKeyword("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")) return 0; - if (source.hasKeyword("Prevent all combat damage that would be dealt by CARDNAME.")) return 0; + if (hasKeyword("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")) { + return 0; + } + if (hasKeyword("Prevent all combat damage that would be dealt to CARDNAME.")) { + return 0; + } + if (source.hasKeyword("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")) { + return 0; + } + if (source.hasKeyword("Prevent all combat damage that would be dealt by CARDNAME.")) { + return 0; + } + } + if (hasKeyword("Prevent all damage that would be dealt to CARDNAME.")) { + return 0; + } + if (hasKeyword("Prevent all damage that would be dealt to and dealt by CARDNAME.")) { + return 0; + } + if (source.hasKeyword("Prevent all damage that would be dealt to and dealt by CARDNAME.")) { + return 0; + } + if (source.hasKeyword("Prevent all damage that would be dealt by CARDNAME.")) { + return 0; } - if (hasKeyword("Prevent all damage that would be dealt to CARDNAME.")) return 0; - if (hasKeyword("Prevent all damage that would be dealt to and dealt by CARDNAME.")) return 0; - if (source.hasKeyword("Prevent all damage that would be dealt to and dealt by CARDNAME.")) return 0; - if (source.hasKeyword("Prevent all damage that would be dealt by CARDNAME.")) return 0; if (hasStartOfKeyword("Absorb")) { int absorbed = this.getKeywordMagnitude("Absorb"); @@ -5856,8 +7346,8 @@ public class Card extends GameEntity implements Comparable { return 0; } } - - //Prevent Damage static abilities + + // Prevent Damage static abilities CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield); for (Card ca : allp) { ArrayList staticAbilities = ca.getStaticAbilities(); @@ -5867,7 +7357,7 @@ public class Card extends GameEntity implements Comparable { } // specific Cards - if (isCreature()) { //and not a planeswalker + if (isCreature()) { // and not a planeswalker if (getName().equals("Swans of Bryn Argoll")) { return 0; } @@ -5875,7 +7365,7 @@ public class Card extends GameEntity implements Comparable { if ((source.isCreature() && AllZoneUtil.isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this))) { return 0; } - } //Creature end + } // Creature end if (restDamage > 0) { return restDamage; @@ -5885,15 +7375,20 @@ public class Card extends GameEntity implements Comparable { } /** - *

preventDamage.

- * - * @param damage a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * preventDamage. + *

+ * + * @param damage + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ @Override - public int preventDamage(final int damage, Card source, boolean isCombat) { + public final int preventDamage(final int damage, final Card source, final boolean isCombat) { if (AllZoneUtil.isCardInPlay("Leyline of Punishment")) { return damage; @@ -5912,7 +7407,9 @@ public class Card extends GameEntity implements Comparable { return 0; } - if (this.hasKeyword("If damage would be dealt to CARDNAME, prevent that damage. Remove a +1/+1 counter from CARDNAME.")) { + if (this.hasKeyword( + "If damage would be dealt to CARDNAME, prevent that damage. Remove a +1/+1 counter from CARDNAME.")) + { restDamage = 0; this.subtractCounter(Counters.P1P1, 1); } @@ -5933,17 +7430,23 @@ public class Card extends GameEntity implements Comparable { return restDamage; } - //This should be also usable by the AI to forecast an effect (so it must not change the game state) + // This should be also usable by the AI to forecast an effect (so it must + // not change the game state) /** - *

staticReplaceDamage.

- * - * @param damage a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * staticReplaceDamage. + *

+ * + * @param damage + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ @Override - public final int staticReplaceDamage(final int damage, Card source, boolean isCombat) { + public final int staticReplaceDamage(final int damage, final Card source, final boolean isCombat) { int restDamage = damage; @@ -5954,8 +7457,8 @@ public class Card extends GameEntity implements Comparable { } } - if (AllZoneUtil.isCardInPlay("Pyromancer's Swath", source.getController()) && (source.isInstant() || source.isSorcery()) - && isCreature()) + if (AllZoneUtil.isCardInPlay("Pyromancer's Swath", source.getController()) + && (source.isInstant() || source.isSorcery()) && isCreature()) { int amount = source.getController().getCardsIn(Zone.Battlefield, "Pyromancer's Swath").size(); for (int i = 0; i < amount; i++) { @@ -5970,7 +7473,9 @@ public class Card extends GameEntity implements Comparable { } } - if (AllZoneUtil.isCardInPlay("Gratuitous Violence", source.getController()) && source.isCreature() && isCreature()) { + if (AllZoneUtil.isCardInPlay("Gratuitous Violence", source.getController()) && source.isCreature() + && isCreature()) + { int amount = source.getController().getCardsIn(Zone.Battlefield, "Gratuitous Violence").size(); for (int i = 0; i < amount; i++) { restDamage += restDamage; @@ -6017,11 +7522,16 @@ public class Card extends GameEntity implements Comparable { } /** - *

replaceDamage.

- * - * @param damageIn a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * replaceDamage. + *

+ * + * @param damageIn + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. * @return a int. */ @Override @@ -6051,23 +7561,36 @@ public class Card extends GameEntity implements Comparable { } /** - *

addDamage.

- * - * @param sourcesMap a {@link java.util.Map} object. + *

+ * addDamage. + *

+ * + * @param sourcesMap + * a {@link java.util.Map} object. */ public final void addDamage(final Map sourcesMap) { for (Entry entry : sourcesMap.entrySet()) { - addDamageAfterPrevention(entry.getValue(), entry.getKey(), true); // damage prevention is already checked! + addDamageAfterPrevention(entry.getValue(), entry.getKey(), true); // damage + // prevention + // is + // already + // checked! } } /** - *

addDamageAfterPrevention.

- * This function handles damage after replacement and prevention effects are applied. - * - * @param damageIn a int. - * @param source a {@link forge.Card} object. - * @param isCombat a boolean. + *

+ * addDamageAfterPrevention. + *

+ * This function handles damage after replacement and prevention effects are + * applied. + * + * @param damageIn + * a int. + * @param source + * a {@link forge.Card} object. + * @param isCombat + * a boolean. */ @Override public final void addDamageAfterPrevention(final int damageIn, final Card source, final boolean isCombat) { @@ -6075,7 +7598,7 @@ public class Card extends GameEntity implements Comparable { boolean wither = false; if (damageToAdd == 0) { - return; //Rule 119.8 + return; // Rule 119.8 } System.out.println("Adding " + damageToAdd + " damage to " + getName()); @@ -6086,7 +7609,7 @@ public class Card extends GameEntity implements Comparable { GameActionUtil.executeDamageDealingEffects(source, damageToAdd); - //Run triggers + // Run triggers Map runParams = new TreeMap(); runParams.put("DamageSource", source); runParams.put("DamageTarget", this); @@ -6114,21 +7637,25 @@ public class Card extends GameEntity implements Comparable { } - private String curSetCode = ""; /** - *

addSet.

- * - * @param sInfo a {@link forge.SetInfo} object. + *

+ * addSet. + *

+ * + * @param sInfo + * a {@link forge.SetInfo} object. */ public final void addSet(final SetInfo sInfo) { getCharacteristics().getSets().add(sInfo); } /** - *

getSets.

- * + *

+ * getSets. + *

+ * * @return a {@link java.util.ArrayList} object. */ public final ArrayList getSets() { @@ -6136,26 +7663,34 @@ public class Card extends GameEntity implements Comparable { } /** - *

setSets.

- * - * @param siList a {@link java.util.ArrayList} object. + *

+ * setSets. + *

+ * + * @param siList + * a {@link java.util.ArrayList} object. */ public final void setSets(final ArrayList siList) { getCharacteristics().setSets(siList); } /** - *

Setter for the field curSetCode.

- * - * @param setCode a {@link java.lang.String} object. + *

+ * Setter for the field curSetCode. + *

+ * + * @param setCode + * a {@link java.lang.String} object. */ public final void setCurSetCode(final String setCode) { curSetCode = setCode; } /** - *

Getter for the field curSetCode.

- * + *

+ * Getter for the field curSetCode. + *

+ * * @return a {@link java.lang.String} object. */ public final String getCurSetCode() { @@ -6163,7 +7698,9 @@ public class Card extends GameEntity implements Comparable { } /** - *

setRandomSetCode.

+ *

+ * setRandomSetCode. + *

*/ public final void setRandomSetCode() { if (getCharacteristics().getSets().size() < 1) { @@ -6177,9 +7714,12 @@ public class Card extends GameEntity implements Comparable { } /** - *

getSetImageName.

- * - * @param setCode a {@link java.lang.String} object. + *

+ * getSetImageName. + *

+ * + * @param setCode + * a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public final String getSetImageName(final String setCode) { @@ -6187,8 +7727,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getCurSetImage.

- * + *

+ * getCurSetImage. + *

+ * * @return a {@link java.lang.String} object. */ public final String getCurSetImage() { @@ -6196,8 +7738,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getCurSetRarity.

- * + *

+ * getCurSetRarity. + *

+ * * @return a {@link java.lang.String} object. */ public final String getCurSetRarity() { @@ -6211,8 +7755,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getCurSetURL.

- * + *

+ * getCurSetURL. + *

+ * * @return a {@link java.lang.String} object. */ public final String getCurSetURL() { @@ -6226,8 +7772,10 @@ public class Card extends GameEntity implements Comparable { } /** - *

getMostRecentSet.

- * + *

+ * getMostRecentSet. + *

+ * * @return a {@link java.lang.String} object. */ public final String getMostRecentSet() { @@ -6235,17 +7783,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

setImageFilename.

- * - * @param iFN a {@link java.lang.String} object. + *

+ * setImageFilename. + *

+ * + * @param iFN + * a {@link java.lang.String} object. */ - public void setImageFilename(final String iFN) { + public final void setImageFilename(final String iFN) { getCharacteristics().setImageFilename(iFN); } /** - *

getImageFilename.

- * + *

+ * getImageFilename. + *

+ * * @return a {@link java.lang.String} object. */ public final String getImageFilename() { @@ -6253,17 +7806,22 @@ public class Card extends GameEntity implements Comparable { } /** - *

Setter for the field evoked.

- * - * @param evokedIn a boolean. + *

+ * Setter for the field evoked. + *

+ * + * @param evokedIn + * a boolean. */ public final void setEvoked(final boolean evokedIn) { evoked = evokedIn; } /** - *

isEvoked.

- * + *

+ * isEvoked. + *

+ * * @return a boolean. */ public final boolean isEvoked() { @@ -6273,7 +7831,9 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param t a long + * + * @param t + * a long */ public final void setTimestamp(final long t) { timestamp = t; @@ -6282,6 +7842,7 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. + * * @return a long */ public final long getTimestamp() { @@ -6291,6 +7852,7 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. + * * @return an int */ public final int getFoil() { @@ -6303,55 +7865,92 @@ public class Card extends GameEntity implements Comparable { /** * * TODO Write javadoc for this method. - * @param f an int + * + * @param f + * an int */ public final void setFoil(final int f) { getCharacteristics().getsVars().put("Foil", Integer.toString(f)); } - + + /** + * Adds the haunted by. + * + * @param c the c + */ public final void addHauntedBy(final Card c) { hauntedBy.add(c); - if(c != null) { + if (c != null) { c.setHaunting(this); } } - + + /** + * Gets the haunted by. + * + * @return the haunted by + */ public final ArrayList getHauntedBy() { return hauntedBy; } - + + /** + * Removes the haunted by. + * + * @param c the c + */ public final void removeHauntedBy(final Card c) { hauntedBy.remove(c); } - + + /** + * Gets the haunting. + * + * @return the haunting + */ public final Card getHaunting() { return haunting; } - + + /** + * Sets the haunting. + * + * @param c the new haunting + */ public final void setHaunting(final Card c) { haunting = c; - } - + } + + /** + * Gets the damage done this turn. + * + * @return the damage done this turn + */ public final int getDamageDoneThisTurn() { int sum = 0; - for(Card c : dealtDamageToThisTurn.keySet()) { + for (Card c : dealtDamageToThisTurn.keySet()) { sum += dealtDamageToThisTurn.get(c); } - + return sum; } - + /** + * Checks if is card colors overridden. + * * @return the cardColorsOverridden */ - public boolean isCardColorsOverridden() { + public final boolean isCardColorsOverridden() { return getCharacteristics().isCardColorsOverridden(); } + /** + * Sets the card colors overridden. + * * @param cardColorsOverridden0 the cardColorsOverridden to set */ - public void setCardColorsOverridden(boolean cardColorsOverridden0) { + public final void setCardColorsOverridden(final boolean cardColorsOverridden0) { getCharacteristics().setCardColorsOverridden(cardColorsOverridden0); } -} //end Card class +} // end Card class