*/
+ @Override
public final void execute() {
- resolve();
+ this.resolve();
}
/**
@@ -112,7 +114,7 @@ public class Ability_Triggered extends Ability implements Command {
* @return a boolean.
*/
public final boolean triggerFor(final Card c) {
- return !(new CardList(c)).getValidCards(restrictions, c.getController(), c).isEmpty();
+ return !(new CardList(c)).getValidCards(this.restrictions, c.getController(), c).isEmpty();
}
/**
@@ -127,19 +129,20 @@ public class Ability_Triggered extends Ability implements Command {
* @return a boolean.
*/
public final boolean triggerOnZoneChange(final String sourceZone, final String destinationZone) {
- return trigger.triggerOn(sourceZone, destinationZone);
+ return this.trigger.triggerOn(sourceZone, destinationZone);
}
/** {@inheritDoc} */
@Override
- public final boolean equals(final Object o) // TODO triggers affecting other cards
- {
+ public final boolean equals(final Object o) {
+ // TODO triggers affecting other
+ // cards
if (!(o instanceof Ability_Triggered)) {
return false;
}
- Ability_Triggered tmp = (Ability_Triggered) o;
- return tmp.getSourceCard().equals(getSourceCard()) && tmp.trigger.equals(trigger) && tmp.todo.equals(todo)
- && Arrays.equals(tmp.restrictions, restrictions);
+ final Ability_Triggered tmp = (Ability_Triggered) o;
+ return tmp.getSourceCard().equals(this.getSourceCard()) && tmp.trigger.equals(this.trigger)
+ && tmp.todo.equals(this.todo) && Arrays.equals(tmp.restrictions, this.restrictions);
}
/**
@@ -150,6 +153,7 @@ public class Ability_Triggered extends Ability implements Command {
* @return a boolean.
*/
public final boolean isBasic() {
- return restrictions.length == 1 && restrictions[0].equals("named " + getSourceCard().getName());
+ return (this.restrictions.length == 1)
+ && this.restrictions[0].equals("named " + this.getSourceCard().getName());
}
}
diff --git a/src/main/java/forge/card/spellability/Spell.java b/src/main/java/forge/card/spellability/Spell.java
index 7dc019dbc5d..aa1db02e3a0 100644
--- a/src/main/java/forge/card/spellability/Spell.java
+++ b/src/main/java/forge/card/spellability/Spell.java
@@ -37,11 +37,11 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
* a {@link forge.Card} object.
*/
public Spell(final Card sourceCard) {
- super(SpellAbility.Spell, sourceCard);
+ super(SpellAbility.getSpell(), sourceCard);
- setManaCost(sourceCard.getManaCost());
- setStackDescription(sourceCard.getSpellText());
- getRestrictions().setZone(Constant.Zone.Hand);
+ this.setManaCost(sourceCard.getManaCost());
+ this.setStackDescription(sourceCard.getSpellText());
+ this.getRestrictions().setZone(Constant.Zone.Hand);
}
/**
@@ -57,14 +57,14 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
* a {@link forge.card.spellability.Target} object.
*/
public Spell(final Card sourceCard, final Cost abCost, final Target abTgt) {
- super(SpellAbility.Spell, sourceCard);
+ super(SpellAbility.getSpell(), sourceCard);
- setManaCost(sourceCard.getManaCost());
+ this.setManaCost(sourceCard.getManaCost());
- setPayCosts(abCost);
- setTarget(abTgt);
- setStackDescription(sourceCard.getSpellText());
- getRestrictions().setZone(Constant.Zone.Hand);
+ this.setPayCosts(abCost);
+ this.setTarget(abTgt);
+ this.setStackDescription(sourceCard.getSpellText());
+ this.getRestrictions().setZone(Constant.Zone.Hand);
}
/** {@inheritDoc} */
@@ -74,16 +74,16 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
return false;
}
- Card card = getSourceCard();
+ final Card card = this.getSourceCard();
- Player activator = getActivatingPlayer();
+ final Player activator = this.getActivatingPlayer();
// CantBeCast static abilities
- CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
allp.add(card);
- for (Card ca : allp) {
- ArrayList staticAbilities = ca.getStaticAbilities();
- for (StaticAbility stAb : staticAbilities) {
+ for (final Card ca : allp) {
+ final ArrayList staticAbilities = ca.getStaticAbilities();
+ for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("CantBeCast", card, activator)) {
return false;
}
@@ -94,8 +94,8 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
return false;
}
- if (payCosts != null) {
- if (!Cost_Payment.canPayAdditionalCosts(payCosts, this)) {
+ if (this.getPayCosts() != null) {
+ if (!Cost_Payment.canPayAdditionalCosts(this.getPayCosts(), this)) {
return false;
}
}
@@ -110,9 +110,9 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
/** {@inheritDoc} */
@Override
public boolean canPlayAI() {
- Card card = getSourceCard();
+ final Card card = this.getSourceCard();
if (card.getSVar("NeedsToPlay").length() > 0) {
- String needsToPlay = card.getSVar("NeedsToPlay");
+ final String needsToPlay = card.getSVar("NeedsToPlay");
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
list = list.getValidCards(needsToPlay.split(","), card.getController(), card);
@@ -135,7 +135,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
public final Object clone() {
try {
return super.clone();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
ErrorViewer.showError(ex);
throw new RuntimeException("Spell : clone() error, " + ex);
}
diff --git a/src/main/java/forge/card/spellability/SpellAbility.java b/src/main/java/forge/card/spellability/SpellAbility.java
index c258dca0c92..72308eb800b 100644
--- a/src/main/java/forge/card/spellability/SpellAbility.java
+++ b/src/main/java/forge/card/spellability/SpellAbility.java
@@ -27,13 +27,13 @@ import forge.gui.input.Input;
public abstract class SpellAbility {
/** The choices_made. */
- public Object[] choices_made; // open ended Casting choice storage
+ private Object[] choicesMade; // open ended Casting choice storage
// choices for constructor isPermanent argument
/** Constant Spell=0. */
- public static final int Spell = 0;
+ private static final int SPELL = 0;
/** Constant Ability=1. */
- public static final int Ability = 1;
+ private static final int ABILITY = 1;
private String description = "";
private Player targetPlayer = null;
@@ -74,7 +74,7 @@ public abstract class SpellAbility {
private int charmNumber;
private int minCharmNumber;
- private ArrayList charmChoices = new ArrayList();
+ private final ArrayList charmChoices = new ArrayList();
// private ArrayList charmChoicesMade = new
// ArrayList();
@@ -83,10 +83,10 @@ public abstract class SpellAbility {
private Input afterPayMana;
/** The pay costs. */
- protected Cost payCosts = null;
+ private Cost payCosts = null;
/** The chosen target. */
- protected Target chosenTarget = null;
+ private Target chosenTarget = null;
private SpellAbility_Restriction restrictions = new SpellAbility_Restriction();
private SpellAbility_Condition conditions = new SpellAbility_Condition();
@@ -94,8 +94,8 @@ public abstract class SpellAbility {
private AbilityFactory abilityFactory = null;
- private ArrayList payingMana = new ArrayList();
- private ArrayList paidAbilities = new ArrayList();
+ private final ArrayList payingMana = new ArrayList();
+ private final ArrayList paidAbilities = new ArrayList();
private HashMap paidLists = new HashMap();
@@ -108,6 +108,7 @@ public abstract class SpellAbility {
private static final long serialVersionUID = 1795025064923737374L;
+ @Override
public void execute(final Object o) {
}
};
@@ -119,20 +120,20 @@ public abstract class SpellAbility {
*
* @param spellOrAbility
* a int.
- * @param i_sourceCard
+ * @param iSourceCard
* a {@link forge.Card} object.
*/
- public SpellAbility(final int spellOrAbility, final Card i_sourceCard) {
- if (spellOrAbility == Spell) {
- spell = true;
- } else if (spellOrAbility == Ability) {
- spell = false;
+ public SpellAbility(final int spellOrAbility, final Card iSourceCard) {
+ if (spellOrAbility == SpellAbility.getSpell()) {
+ this.spell = true;
+ } else if (spellOrAbility == SpellAbility.getAbility()) {
+ this.spell = false;
} else {
throw new RuntimeException("SpellAbility : constructor error, invalid spellOrAbility argument = "
+ spellOrAbility);
}
- sourceCard = i_sourceCard;
+ this.sourceCard = iSourceCard;
}
// Spell, and Ability, and other Ability objects override this method
@@ -165,7 +166,7 @@ public abstract class SpellAbility {
* @return true, if successful
*/
public final boolean canPlayAndAfford() {
- return canPlay() && canAfford();
+ return this.canPlay() && this.canAfford();
}
// all Spell's and Abilities must override this method
@@ -207,7 +208,7 @@ public abstract class SpellAbility {
*
*/
public void chooseTargetAI() {
- randomTarget.execute(this);
+ this.randomTarget.execute(this);
}
/**
@@ -219,7 +220,7 @@ public abstract class SpellAbility {
* a {@link forge.CommandArgs} object.
*/
public void setChooseTargetAI(final CommandArgs c) {
- randomTarget = c;
+ this.randomTarget = c;
}
/**
@@ -230,7 +231,7 @@ public abstract class SpellAbility {
* @return a {@link forge.CommandArgs} object.
*/
public CommandArgs getChooseTargetAI() {
- return randomTarget;
+ return this.randomTarget;
}
/**
@@ -241,7 +242,7 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getManaCost() {
- return manaCost;
+ return this.manaCost;
}
/**
@@ -253,7 +254,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setManaCost(final String cost) {
- manaCost = cost;
+ this.manaCost = cost;
}
/**
@@ -264,7 +265,7 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getAdditionalManaCost() {
- return additionalManaCost;
+ return this.additionalManaCost;
}
/**
@@ -276,7 +277,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setAdditionalManaCost(final String cost) {
- additionalManaCost = cost;
+ this.additionalManaCost = cost;
}
/**
@@ -287,7 +288,7 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getMultiKickerManaCost() {
- return multiKickerManaCost;
+ return this.multiKickerManaCost;
}
/**
@@ -299,7 +300,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setMultiKickerManaCost(final String cost) {
- multiKickerManaCost = cost;
+ this.multiKickerManaCost = cost;
}
/**
@@ -310,7 +311,7 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getReplicateManaCost() {
- return replicateManaCost;
+ return this.replicateManaCost;
}
/**
@@ -322,7 +323,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setReplicateManaCost(final String cost) {
- replicateManaCost = cost;
+ this.replicateManaCost = cost;
}
/**
@@ -333,7 +334,7 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getXManaCost() {
- return xManaCost;
+ return this.xManaCost;
}
/**
@@ -345,7 +346,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setXManaCost(final String cost) {
- xManaCost = cost;
+ this.xManaCost = cost;
}
/**
@@ -356,7 +357,7 @@ public abstract class SpellAbility {
* @return a {@link forge.Player} object.
*/
public Player getActivatingPlayer() {
- return activatingPlayer;
+ return this.activatingPlayer;
}
/**
@@ -369,9 +370,9 @@ public abstract class SpellAbility {
*/
public void setActivatingPlayer(final Player player) {
// trickle down activating player
- activatingPlayer = player;
- if (subAbility != null) {
- subAbility.setActivatingPlayer(player);
+ this.activatingPlayer = player;
+ if (this.subAbility != null) {
+ this.subAbility.setActivatingPlayer(player);
}
}
@@ -383,7 +384,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isSpell() {
- return spell;
+ return this.spell;
}
/**
@@ -394,7 +395,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isAbility() {
- return !isSpell();
+ return !this.isSpell();
}
/**
@@ -405,7 +406,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isTapAbility() {
- return tapAbility;
+ return this.tapAbility;
}
/**
@@ -416,7 +417,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isUntapAbility() {
- return untapAbility;
+ return this.untapAbility;
}
/**
@@ -425,8 +426,8 @@ public abstract class SpellAbility {
*
*/
public void makeUntapAbility() {
- untapAbility = true;
- tapAbility = false;
+ this.untapAbility = true;
+ this.tapAbility = false;
}
/**
@@ -438,7 +439,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public void setIsBuyBackAbility(final boolean b) {
- buyBackAbility = b;
+ this.buyBackAbility = b;
}
/**
@@ -449,7 +450,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isBuyBackAbility() {
- return buyBackAbility;
+ return this.buyBackAbility;
}
/**
@@ -461,7 +462,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public void setIsMultiKicker(final boolean b) {
- multiKicker = b;
+ this.multiKicker = b;
}
/**
@@ -472,7 +473,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isMultiKicker() {
- return multiKicker;
+ return this.multiKicker;
}
/**
@@ -484,7 +485,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public void setIsReplicate(final boolean b) {
- replicate = b;
+ this.replicate = b;
}
/**
@@ -495,7 +496,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isReplicate() {
- return replicate;
+ return this.replicate;
}
/**
@@ -507,7 +508,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public void setIsXCost(final boolean b) {
- xCost = b;
+ this.xCost = b;
}
/**
@@ -518,7 +519,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isXCost() {
- return xCost;
+ return this.xCost;
}
/**
@@ -530,7 +531,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public void setIsCycling(final boolean b) {
- cycling = b;
+ this.cycling = b;
}
/**
@@ -540,8 +541,8 @@ public abstract class SpellAbility {
*
* @return a boolean.
*/
- public boolean isCycling() {
- return cycling;
+ public boolean isCycling() {
+ return this.cycling;
}
/**
@@ -552,8 +553,8 @@ public abstract class SpellAbility {
* @param c
* a {@link forge.Card} object.
*/
- public void setSourceCard(final Card c) {
- sourceCard = c;
+ public void setSourceCard(final Card c) {
+ this.sourceCard = c;
}
/**
@@ -564,7 +565,7 @@ public abstract class SpellAbility {
* @return a {@link forge.Card} object.
*/
public Card getSourceCard() {
- return sourceCard;
+ return this.sourceCard;
}
/**
@@ -575,7 +576,7 @@ public abstract class SpellAbility {
* @return a {@link forge.Command} object.
*/
public Command getBeforePayManaAI() {
- return beforePayManaAI;
+ return this.beforePayManaAI;
}
/**
@@ -587,7 +588,7 @@ public abstract class SpellAbility {
* a {@link forge.Command} object.
*/
public void setBeforePayManaAI(final Command c) {
- beforePayManaAI = c;
+ this.beforePayManaAI = c;
}
// begin - Input methods
@@ -599,7 +600,7 @@ public abstract class SpellAbility {
* @return a {@link forge.gui.input.Input} object.
*/
public Input getBeforePayMana() {
- return beforePayMana;
+ return this.beforePayMana;
}
/**
@@ -611,7 +612,7 @@ public abstract class SpellAbility {
* a {@link forge.gui.input.Input} object.
*/
public void setBeforePayMana(final Input in) {
- beforePayMana = in;
+ this.beforePayMana = in;
}
/**
@@ -622,7 +623,7 @@ public abstract class SpellAbility {
* @return a {@link forge.gui.input.Input} object.
*/
public Input getAfterPayMana() {
- return afterPayMana;
+ return this.afterPayMana;
}
/**
@@ -634,7 +635,7 @@ public abstract class SpellAbility {
* a {@link forge.gui.input.Input} object.
*/
public void setAfterPayMana(final Input in) {
- afterPayMana = in;
+ this.afterPayMana = in;
}
/**
@@ -645,7 +646,7 @@ public abstract class SpellAbility {
* @return a {@link forge.card.cost.Cost} object.
*/
public Cost getPayCosts() {
- return payCosts;
+ return this.payCosts;
}
/**
@@ -657,7 +658,7 @@ public abstract class SpellAbility {
* a {@link forge.card.cost.Cost} object.
*/
public void setPayCosts(final Cost abCost) {
- payCosts = abCost;
+ this.payCosts = abCost;
}
/**
@@ -668,7 +669,7 @@ public abstract class SpellAbility {
* @return a {@link forge.card.spellability.Target} object.
*/
public Target getTarget() {
- return chosenTarget;
+ return this.getChosenTarget();
}
/**
@@ -680,7 +681,7 @@ public abstract class SpellAbility {
* a {@link forge.card.spellability.Target} object.
*/
public void setTarget(final Target tgt) {
- chosenTarget = tgt;
+ this.setChosenTarget(tgt);
}
/**
@@ -693,7 +694,7 @@ public abstract class SpellAbility {
* object.
*/
public void setRestrictions(final SpellAbility_Restriction restrict) {
- restrictions = restrict;
+ this.restrictions = restrict;
}
/**
@@ -705,7 +706,7 @@ public abstract class SpellAbility {
* object.
*/
public SpellAbility_Restriction getRestrictions() {
- return restrictions;
+ return this.restrictions;
}
/**
@@ -716,7 +717,7 @@ public abstract class SpellAbility {
* @return the activations this turn
*/
public int getActivationsThisTurn() {
- return restrictions.getNumberTurnActivations();
+ return this.restrictions.getNumberTurnActivations();
}
/**
@@ -730,7 +731,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public void setConditions(final SpellAbility_Condition condition) {
- conditions = condition;
+ this.conditions = condition;
}
/**
@@ -742,7 +743,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public SpellAbility_Condition getConditions() {
- return conditions;
+ return this.conditions;
}
/**
@@ -754,7 +755,7 @@ public abstract class SpellAbility {
* a {@link forge.card.abilityFactory.AbilityFactory} object.
*/
public void setAbilityFactory(final AbilityFactory af) {
- abilityFactory = af;
+ this.abilityFactory = af;
}
/**
@@ -765,7 +766,7 @@ public abstract class SpellAbility {
* @return a {@link forge.card.abilityFactory.AbilityFactory} object.
*/
public AbilityFactory getAbilityFactory() {
- return abilityFactory;
+ return this.abilityFactory;
}
/**
@@ -776,7 +777,7 @@ public abstract class SpellAbility {
* @return a {@link java.util.ArrayList} object.
*/
public ArrayList getPayingMana() {
- return payingMana;
+ return this.payingMana;
}
/**
@@ -787,7 +788,7 @@ public abstract class SpellAbility {
* @return a {@link java.util.ArrayList} object.
*/
public ArrayList getPayingManaAbilities() {
- return paidAbilities;
+ return this.paidAbilities;
}
// Combined PaidLists
@@ -800,7 +801,7 @@ public abstract class SpellAbility {
* a {@link java.util.HashMap} object.
*/
public void setPaidHash(final HashMap hash) {
- paidLists = hash;
+ this.paidLists = hash;
}
/**
@@ -811,7 +812,7 @@ public abstract class SpellAbility {
* @return a {@link java.util.HashMap} object.
*/
public HashMap getPaidHash() {
- return paidLists;
+ return this.paidLists;
}
// Paid List are for things ca
@@ -826,7 +827,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setPaidList(final CardList list, final String str) {
- paidLists.put(str, list);
+ this.paidLists.put(str, list);
}
/**
@@ -839,7 +840,7 @@ public abstract class SpellAbility {
* @return a {@link forge.CardList} object.
*/
public CardList getPaidList(final String str) {
- return paidLists.get(str);
+ return this.paidLists.get(str);
}
/**
@@ -853,11 +854,11 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void addCostToHashList(final Card c, final String str) {
- if (!paidLists.containsKey(str)) {
- paidLists.put(str, new CardList());
+ if (!this.paidLists.containsKey(str)) {
+ this.paidLists.put(str, new CardList());
}
- paidLists.get(str).add(c);
+ this.paidLists.get(str).add(c);
}
/**
@@ -866,7 +867,7 @@ public abstract class SpellAbility {
*
*/
public void resetPaidHash() {
- paidLists = new HashMap();
+ this.paidLists = new HashMap();
}
/**
@@ -878,7 +879,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public HashMap getTriggeringObjects() {
- return triggeringObjects;
+ return this.triggeringObjects;
}
/**
@@ -920,7 +921,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public Object getTriggeringObject(final String type) {
- return triggeringObjects.get(type);
+ return this.triggeringObjects.get(type);
}
/**
@@ -934,7 +935,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public boolean hasTriggeringObject(final String type) {
- return triggeringObjects.containsKey(type);
+ return this.triggeringObjects.containsKey(type);
}
/**
@@ -945,7 +946,7 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public void resetTriggeringObjects() {
- triggeringObjects = new HashMap();
+ this.triggeringObjects = new HashMap();
}
/**
@@ -954,19 +955,19 @@ public abstract class SpellAbility {
*
*/
public void resetOnceResolved() {
- resetPaidHash();
+ this.resetPaidHash();
- if (chosenTarget != null) {
- chosenTarget.resetTargets();
+ if (this.getChosenTarget() != null) {
+ this.getChosenTarget().resetTargets();
}
- resetTriggeringObjects();
+ this.resetTriggeringObjects();
// Clear SVars
- for (String store : Card.getStorableSVars()) {
- String value = sourceCard.getSVar(store);
+ for (final String store : Card.getStorableSVars()) {
+ final String value = this.sourceCard.getSVar(store);
if (value.length() > 0) {
- sourceCard.setSVar(store, "");
+ this.sourceCard.setSVar(store, "");
}
}
}
@@ -979,7 +980,7 @@ public abstract class SpellAbility {
* @return a {@link forge.gui.input.Input} object.
*/
public Input getAfterResolve() {
- return afterResolve;
+ return this.afterResolve;
}
/**
@@ -991,7 +992,7 @@ public abstract class SpellAbility {
* a {@link forge.gui.input.Input} object.
*/
public void setAfterResolve(final Input in) {
- afterResolve = in;
+ this.afterResolve = in;
}
/**
@@ -1003,9 +1004,9 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setStackDescription(final String s) {
- stackDescription = s;
- if (description == "" && sourceCard.getText().equals("")) {
- description = s;
+ this.stackDescription = s;
+ if ((this.description == "") && this.sourceCard.getText().equals("")) {
+ this.description = s;
}
}
@@ -1017,11 +1018,11 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getStackDescription() {
- if (stackDescription.equals(getSourceCard().getText().trim())) {
- return getSourceCard().getName() + " - " + getSourceCard().getText();
+ if (this.stackDescription.equals(this.getSourceCard().getText().trim())) {
+ return this.getSourceCard().getName() + " - " + this.getSourceCard().getText();
}
- return stackDescription.replaceAll("CARDNAME", this.getSourceCard().getName());
+ return this.stackDescription.replaceAll("CARDNAME", this.getSourceCard().getName());
}
/**
@@ -1032,7 +1033,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isIntrinsic() {
- return type.equals("Intrinsic");
+ return this.type.equals("Intrinsic");
}
/**
@@ -1043,7 +1044,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isExtrinsic() {
- return type.equals("Extrinsic");
+ return this.type.equals("Extrinsic");
}
/**
@@ -1051,12 +1052,12 @@ public abstract class SpellAbility {
* Setter for the field type.
*
*
+ * Extrinsic or Intrinsic:
* @param s
* a {@link java.lang.String} object.
*/
- public void setType(final String s) // Extrinsic or Intrinsic:
- {
- type = s;
+ public void setType(final String s) {
+ this.type = s;
}
/**
@@ -1066,9 +1067,9 @@ public abstract class SpellAbility {
*
* @return a {@link java.lang.String} object.
*/
- public String getType() // Extrinsic or Intrinsic:
- {
- return type;
+ public String getType() {
+ // Extrinsic or Intrinsic:
+ return this.type;
}
// setDescription() includes mana cost and everything like
@@ -1082,7 +1083,7 @@ public abstract class SpellAbility {
* a {@link java.lang.String} object.
*/
public void setDescription(final String s) {
- description = s;
+ this.description = s;
}
/**
@@ -1093,18 +1094,18 @@ public abstract class SpellAbility {
* @return a {@link java.lang.String} object.
*/
public String getDescription() {
- return description;
+ return this.description;
}
/** {@inheritDoc} */
@Override
public final String toString() {
- if (isSuppressed()) {
+ if (this.isSuppressed()) {
return "";
}
- return toUnsuppressedString();
+ return this.toUnsuppressedString();
}
/**
@@ -1114,7 +1115,7 @@ public abstract class SpellAbility {
*/
public String toUnsuppressedString() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
SpellAbility node = this;
while (node != null) {
@@ -1162,11 +1163,11 @@ public abstract class SpellAbility {
*
* @return a {@link forge.Card} object.
*/
- public Card getTargetCard() {
- if (targetCard == null) {
- Target tgt = this.getTarget();
+ public Card getTargetCard() {
+ if (this.targetCard == null) {
+ final Target tgt = this.getTarget();
if (tgt != null) {
- ArrayList list = tgt.getTargetCards();
+ final ArrayList list = tgt.getTargetCards();
if (!list.isEmpty()) {
return list.get(0);
@@ -1175,7 +1176,7 @@ public abstract class SpellAbility {
return null;
}
- return targetCard;
+ return this.targetCard;
}
/**
@@ -1188,25 +1189,26 @@ public abstract class SpellAbility {
*/
public void setTargetCard(final Card card) {
if (card == null) {
- System.out.println(getSourceCard() + " - SpellAbility.setTargetCard() called with null for target card.");
+ System.out.println(this.getSourceCard()
+ + " - SpellAbility.setTargetCard() called with null for target card.");
return;
}
- Target tgt = this.getTarget();
+ final Target tgt = this.getTarget();
if (tgt != null) {
tgt.addTarget(card);
} else {
- targetPlayer = null; // reset setTargetPlayer()
- targetCard = card;
+ this.targetPlayer = null; // reset setTargetPlayer()
+ this.targetCard = card;
}
String desc = "";
if (null != card) {
if (!card.isFaceDown()) {
- desc = getSourceCard().getName() + " - targeting " + card;
+ desc = this.getSourceCard().getName() + " - targeting " + card;
} else {
- desc = getSourceCard().getName() + " - targeting Morph(" + card.getUniqueNumber() + ")";
+ desc = this.getSourceCard().getName() + " - targeting Morph(" + card.getUniqueNumber() + ")";
}
- setStackDescription(desc);
+ this.setStackDescription(desc);
}
}
@@ -1218,7 +1220,7 @@ public abstract class SpellAbility {
* @return a {@link forge.CardList} object.
*/
public CardList getTargetList() {
- return targetList;
+ return this.targetList;
}
/**
@@ -1236,22 +1238,22 @@ public abstract class SpellAbility {
// not result in other bugs. :)
// targetPlayer = null;//reset setTargetPlayer()
- targetList = list;
- StringBuilder sb = new StringBuilder();
- sb.append(getSourceCard().getName()).append(" - targeting ");
- for (int i = 0; i < targetList.size(); i++) {
+ this.targetList = list;
+ final StringBuilder sb = new StringBuilder();
+ sb.append(this.getSourceCard().getName()).append(" - targeting ");
+ for (int i = 0; i < this.targetList.size(); i++) {
- if (!targetList.get(i).isFaceDown()) {
- sb.append(targetList.get(i));
+ if (!this.targetList.get(i).isFaceDown()) {
+ sb.append(this.targetList.get(i));
} else {
- sb.append("Morph(").append(targetList.get(i).getUniqueNumber()).append(")");
+ sb.append("Morph(").append(this.targetList.get(i).getUniqueNumber()).append(")");
}
- if (i < targetList.size() - 1) {
+ if (i < (this.targetList.size() - 1)) {
sb.append(", ");
}
}
- setStackDescription(sb.toString());
+ this.setStackDescription(sb.toString());
}
/**
@@ -1263,19 +1265,19 @@ public abstract class SpellAbility {
* a {@link forge.Player} object.
*/
public void setTargetPlayer(final Player p) {
- if (p == null || (!(p.isHuman() || p.isComputer()))) {
+ if ((p == null) || (!(p.isHuman() || p.isComputer()))) {
throw new RuntimeException("SpellAbility : setTargetPlayer() error, argument is " + p + " source card is "
- + getSourceCard());
+ + this.getSourceCard());
}
- Target tgt = this.getTarget();
+ final Target tgt = this.getTarget();
if (tgt != null) {
tgt.addTarget(p);
} else {
- targetCard = null; // reset setTargetCard()
- targetPlayer = p;
+ this.targetCard = null; // reset setTargetCard()
+ this.targetPlayer = p;
}
- setStackDescription(getSourceCard().getName() + " - targeting " + p);
+ this.setStackDescription(this.getSourceCard().getName() + " - targeting " + p);
}
/**
@@ -1286,10 +1288,10 @@ public abstract class SpellAbility {
* @return a {@link forge.Player} object.
*/
public Player getTargetPlayer() {
- if (targetPlayer == null) {
- Target tgt = this.getTarget();
+ if (this.targetPlayer == null) {
+ final Target tgt = this.getTarget();
if (tgt != null) {
- ArrayList list = tgt.getTargetPlayers();
+ final ArrayList list = tgt.getTargetPlayers();
if (!list.isEmpty()) {
return list.get(0);
@@ -1297,7 +1299,7 @@ public abstract class SpellAbility {
}
return null;
}
- return targetPlayer;
+ return this.targetPlayer;
}
/**
@@ -1308,7 +1310,7 @@ public abstract class SpellAbility {
* @return a {@link forge.Command} object.
*/
public Command getCancelCommand() {
- return cancelCommand;
+ return this.cancelCommand;
}
/**
@@ -1343,7 +1345,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isFlashBackAbility() {
- return flashBackAbility;
+ return this.flashBackAbility;
}
/**
@@ -1366,7 +1368,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isKickerAbility() {
- return kickerAbility;
+ return this.kickerAbility;
}
// Only used by Ability_Reflected_Mana, because the user has an option to
@@ -1395,7 +1397,7 @@ public abstract class SpellAbility {
SpellAbility clone = null;
try {
clone = (SpellAbility) this.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
System.err.println(e);
}
return clone;
@@ -1421,7 +1423,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public boolean isTrigger() {
- return trigger;
+ return this.trigger;
}
/**
@@ -1448,11 +1450,11 @@ public abstract class SpellAbility {
* setSourceTrigger.
*
*
- * @param ID
+ * @param id
* a int.
*/
- public void setSourceTrigger(final int ID) {
- sourceTrigger = ID;
+ public void setSourceTrigger(final int id) {
+ this.sourceTrigger = id;
}
/**
@@ -1463,7 +1465,7 @@ public abstract class SpellAbility {
* @return a int.
*/
public int getSourceTrigger() {
- return sourceTrigger;
+ return this.sourceTrigger;
}
/**
@@ -1486,7 +1488,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public final boolean isMandatory() {
- return mandatory;
+ return this.mandatory;
}
/**
@@ -1499,7 +1501,7 @@ public abstract class SpellAbility {
*/
public final SpellAbility getRootSpellAbility() {
if (this instanceof Ability_Sub) {
- SpellAbility parent = ((Ability_Sub) this).getParent();
+ final SpellAbility parent = ((Ability_Sub) this).getParent();
if (parent != null) {
return parent.getRootSpellAbility();
}
@@ -1517,9 +1519,9 @@ public abstract class SpellAbility {
* @since 1.0.15
*/
public final ArrayList getAllTargetChoices() {
- ArrayList res = new ArrayList();
+ final ArrayList res = new ArrayList();
- SpellAbility sa = getRootSpellAbility();
+ SpellAbility sa = this.getRootSpellAbility();
if (sa.getTarget() != null) {
res.add(sa.getTarget().getTargetChoices());
}
@@ -1554,7 +1556,7 @@ public abstract class SpellAbility {
* the new temporarily suppressed
*/
public final void setTemporarilySuppressed(final boolean supp) {
- temporarilySuppressed = supp;
+ this.temporarilySuppressed = supp;
}
/**
@@ -1563,7 +1565,7 @@ public abstract class SpellAbility {
* @return true, if is suppressed
*/
public final boolean isSuppressed() {
- return (temporarilySuppressed);
+ return (this.temporarilySuppressed);
}
/**
@@ -1575,7 +1577,7 @@ public abstract class SpellAbility {
* a boolean.
*/
public final void setIsCharm(final boolean b) {
- isCharm = b;
+ this.isCharm = b;
}
/**
@@ -1586,7 +1588,7 @@ public abstract class SpellAbility {
* @return a boolean.
*/
public final boolean isCharm() {
- return isCharm;
+ return this.isCharm;
}
/**
@@ -1598,7 +1600,7 @@ public abstract class SpellAbility {
* an int
*/
public final void setCharmNumber(final int i) {
- charmNumber = i;
+ this.charmNumber = i;
}
/**
@@ -1609,7 +1611,7 @@ public abstract class SpellAbility {
* @return an int
*/
public final int getCharmNumber() {
- return charmNumber;
+ return this.charmNumber;
}
/**
@@ -1622,7 +1624,7 @@ public abstract class SpellAbility {
* @since 1.1.6
*/
public final void setMinCharmNumber(final int i) {
- minCharmNumber = i;
+ this.minCharmNumber = i;
}
/**
@@ -1634,7 +1636,7 @@ public abstract class SpellAbility {
* @since 1.1.6
*/
public final int getMinCharmNumber() {
- return minCharmNumber;
+ return this.minCharmNumber;
}
/**
@@ -1647,7 +1649,7 @@ public abstract class SpellAbility {
* @since 1.1.6
*/
public final void addCharmChoice(final SpellAbility sa) {
- charmChoices.add(sa);
+ this.charmChoices.add(sa);
}
/**
@@ -1659,7 +1661,7 @@ public abstract class SpellAbility {
* @since 1.1.6
*/
public final ArrayList getCharmChoices() {
- return charmChoices;
+ return this.charmChoices;
}
/**
@@ -1668,7 +1670,7 @@ public abstract class SpellAbility {
* @return the isDelve
*/
public final boolean getIsDelve() {
- return isDelve;
+ return this.isDelve;
}
/**
@@ -1681,4 +1683,32 @@ public abstract class SpellAbility {
this.isDelve = isDelve0; // TODO Add 0 to parameter's name.
}
+ /**
+ * @return the ability
+ */
+ public static int getAbility() {
+ return ABILITY;
+ }
+
+ /**
+ * @return the spell
+ */
+ public static int getSpell() {
+ return SPELL;
+ }
+
+ /**
+ * @return the chosenTarget
+ */
+ public Target getChosenTarget() {
+ return chosenTarget;
+ }
+
+ /**
+ * @param chosenTarget the chosenTarget to set
+ */
+ public void setChosenTarget(Target chosenTarget) {
+ this.chosenTarget = chosenTarget; // TODO: Add 0 to parameter's name.
+ }
+
}
diff --git a/src/main/java/forge/card/spellability/SpellAbilityList.java b/src/main/java/forge/card/spellability/SpellAbilityList.java
index 06ff444dc3e..21c9c2edd5e 100644
--- a/src/main/java/forge/card/spellability/SpellAbilityList.java
+++ b/src/main/java/forge/card/spellability/SpellAbilityList.java
@@ -13,7 +13,7 @@ import forge.ComputerUtil;
* @version $Id$
*/
public class SpellAbilityList {
- private ArrayList list = new ArrayList();
+ private final ArrayList list = new ArrayList();
/**
*
@@ -32,7 +32,7 @@ public class SpellAbilityList {
* a {@link forge.card.spellability.SpellAbility} object.
*/
public SpellAbilityList(final SpellAbility s) {
- add(s);
+ this.add(s);
}
/**
@@ -45,8 +45,8 @@ public class SpellAbilityList {
* objects.
*/
public SpellAbilityList(final SpellAbility[] s) {
- for (int i = 0; i < s.length; i++) {
- add(s[i]);
+ for (final SpellAbility element : s) {
+ this.add(element);
}
}
@@ -59,7 +59,7 @@ public class SpellAbilityList {
* a int.
*/
public final void remove(final int n) {
- list.remove(n);
+ this.list.remove(n);
}
/**
@@ -71,7 +71,7 @@ public class SpellAbilityList {
* a {@link forge.card.spellability.SpellAbility} object.
*/
public final void add(final SpellAbility s) {
- list.add(s);
+ this.list.add(s);
}
/**
@@ -82,7 +82,7 @@ public class SpellAbilityList {
* @return a int.
*/
public final int size() {
- return list.size();
+ return this.list.size();
}
/**
@@ -95,7 +95,7 @@ public class SpellAbilityList {
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility get(final int n) {
- return list.get(n);
+ return this.list.get(n);
}
/**
@@ -108,7 +108,7 @@ public class SpellAbilityList {
*/
public final void addAll(final SpellAbilityList s) {
for (int i = 0; i < s.size(); i++) {
- add(s.get(i));
+ this.add(s.get(i));
}
}
@@ -119,24 +119,24 @@ public class SpellAbilityList {
*
*/
public final void execute() {
- for (int i = 0; i < size(); i++) {
- if (!ComputerUtil.canPayCost(get(i))) {
+ for (int i = 0; i < this.size(); i++) {
+ if (!ComputerUtil.canPayCost(this.get(i))) {
throw new RuntimeException("SpellAbilityList : execute() error, cannot pay for the spell "
- + get(i).getSourceCard() + " - " + get(i).getStackDescription());
+ + this.get(i).getSourceCard() + " - " + this.get(i).getStackDescription());
}
- ComputerUtil.playNoStack(get(i));
+ ComputerUtil.playNoStack(this.get(i));
}
} // execute()
/** {@inheritDoc} */
@Override
public final String toString() {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < size(); i++) {
- sb.append(get(i).getSourceCard().toString());
+ final StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < this.size(); i++) {
+ sb.append(this.get(i).getSourceCard().toString());
sb.append(" - ");
- sb.append(get(i).getStackDescription());
+ sb.append(this.get(i).getStackDescription());
sb.append("\r\n");
}
return sb.toString();
@@ -148,6 +148,6 @@ public class SpellAbilityList {
if (o == null) {
return false;
}
- return toString().equals(o.toString());
+ return this.toString().equals(o.toString());
}
}
diff --git a/src/main/java/forge/card/spellability/SpellAbility_Condition.java b/src/main/java/forge/card/spellability/SpellAbility_Condition.java
index 92d06dd2158..9473e848d7f 100644
--- a/src/main/java/forge/card/spellability/SpellAbility_Condition.java
+++ b/src/main/java/forge/card/spellability/SpellAbility_Condition.java
@@ -47,32 +47,32 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
*/
public final void setConditions(final HashMap params) {
if (params.containsKey("Condition")) {
- String value = params.get("Condition");
+ final String value = params.get("Condition");
if (value.equals("Threshold")) {
- setThreshold(true);
+ this.setThreshold(true);
}
if (value.equals("Metalcraft")) {
- setMetalcraft(true);
+ this.setMetalcraft(true);
}
if (value.equals("Hellbent")) {
- setHellbent(true);
+ this.setHellbent(true);
}
}
if (params.containsKey("ConditionZone")) {
- setZone(Zone.smartValueOf(params.get("ContitionZone")));
+ this.setZone(Zone.smartValueOf(params.get("ContitionZone")));
}
if (params.containsKey("ConditionSorcerySpeed")) {
- setSorcerySpeed(true);
+ this.setSorcerySpeed(true);
}
if (params.containsKey("ConditionPlayerTurn")) {
- setPlayerTurn(true);
+ this.setPlayerTurn(true);
}
if (params.containsKey("ConditionOpponentTurn")) {
- setOpponentTurn(true);
+ this.setOpponentTurn(true);
}
if (params.containsKey("ConditionPhases")) {
@@ -84,59 +84,59 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
// Draw-> (After Upkeep)
// Upkeep->Combat_Begin (Before Declare Attackers)
- String[] split = phases.split("->", 2);
+ final String[] split = phases.split("->", 2);
phases = AllZone.getPhase().buildActivateString(split[0], split[1]);
}
- setPhases(phases);
+ this.setPhases(phases);
}
if (params.containsKey("ConditionAllM12Empires")) {
- setAllM12Empires(true);
+ this.setAllM12Empires(true);
}
if (params.containsKey("ConditionNotAllM12Empires")) {
- setNotAllM12Empires(true);
+ this.setNotAllM12Empires(true);
}
if (params.containsKey("ConditionCardsInHand")) {
- setActivateCardsInHand(Integer.parseInt(params.get("ConditionCardsInHand")));
+ this.setActivateCardsInHand(Integer.parseInt(params.get("ConditionCardsInHand")));
}
// Condition version of IsPresent stuff
if (params.containsKey("ConditionPresent")) {
- setIsPresent(params.get("ConditionPresent"));
+ this.setIsPresent(params.get("ConditionPresent"));
if (params.containsKey("ConditionCompare")) {
- setPresentCompare(params.get("ConditionCompare"));
+ this.setPresentCompare(params.get("ConditionCompare"));
}
}
if (params.containsKey("ConditionDefined")) {
- setPresentDefined(params.get("ConditionDefined"));
+ this.setPresentDefined(params.get("ConditionDefined"));
}
if (params.containsKey("ConditionNotPresent")) {
- setIsPresent(params.get("ConditionNotPresent"));
- setPresentCompare("EQ0");
+ this.setIsPresent(params.get("ConditionNotPresent"));
+ this.setPresentCompare("EQ0");
}
// basically PresentCompare for life totals:
if (params.containsKey("ConditionLifeTotal")) {
- setLifeTotal(params.get("ConditionLifeTotal"));
+ this.setLifeTotal(params.get("ConditionLifeTotal"));
if (params.containsKey("ConditionLifeAmount")) {
- setLifeAmount(params.get("ConditionLifeAmount"));
+ this.setLifeAmount(params.get("ConditionLifeAmount"));
}
}
if (params.containsKey("ConditionManaSpent")) {
- setManaSpent(params.get("ConditionManaSpent"));
+ this.setManaSpent(params.get("ConditionManaSpent"));
}
if (params.containsKey("ConditionCheckSVar")) {
- setSvarToCheck(params.get("ConditionCheckSVar"));
+ this.setSvarToCheck(params.get("ConditionCheckSVar"));
}
if (params.containsKey("ConditionSVarCompare")) {
- setSvarOperator(params.get("ConditionSVarCompare").substring(0, 2));
- setSvarOperand(params.get("ConditionSVarCompare").substring(2));
+ this.setSvarOperator(params.get("ConditionSVarCompare").substring(0, 2));
+ this.setSvarOperand(params.get("ConditionSVarCompare").substring(2));
}
} // setConditions
@@ -159,42 +159,42 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
+ " Did not have activator set in SpellAbility_Condition.checkConditions()");
}
- if (isHellbent()) {
+ if (this.isHellbent()) {
if (!activator.hasHellbent()) {
return false;
}
}
- if (isThreshold()) {
+ if (this.isThreshold()) {
if (!activator.hasThreshold()) {
return false;
}
}
- if (isMetalcraft()) {
+ if (this.isMetalcraft()) {
if (!activator.hasMetalcraft()) {
return false;
}
}
- if (isSorcerySpeed() && !Phase.canCastSorcery(activator)) {
+ if (this.isSorcerySpeed() && !Phase.canCastSorcery(activator)) {
return false;
}
- if (isPlayerTurn() && !AllZone.getPhase().isPlayerTurn(activator)) {
+ if (this.isPlayerTurn() && !AllZone.getPhase().isPlayerTurn(activator)) {
return false;
}
- if (isOpponentTurn() && AllZone.getPhase().isPlayerTurn(activator)) {
+ if (this.isOpponentTurn() && AllZone.getPhase().isPlayerTurn(activator)) {
return false;
}
- if (getActivationLimit() != -1 && getNumberTurnActivations() >= getActivationLimit()) {
+ if ((this.getActivationLimit() != -1) && (this.getNumberTurnActivations() >= this.getActivationLimit())) {
return false;
}
- if (getPhases().size() > 0) {
+ if (this.getPhases().size() > 0) {
boolean isPhase = false;
- String currPhase = AllZone.getPhase().getPhase();
- for (String s : getPhases()) {
+ final String currPhase = AllZone.getPhase().getPhase();
+ for (final String s : this.getPhases()) {
if (s.equals(currPhase)) {
isPhase = true;
break;
@@ -206,8 +206,8 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
}
}
- if (isAllM12Empires()) {
- Player p = sa.getSourceCard().getController();
+ if (this.isAllM12Empires()) {
+ final Player p = sa.getSourceCard().getController();
boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
@@ -215,8 +215,8 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
return false;
}
}
- if (isNotAllM12Empires()) {
- Player p = sa.getSourceCard().getController();
+ if (this.isNotAllM12Empires()) {
+ final Player p = sa.getSourceCard().getController();
boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
@@ -225,72 +225,73 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
}
}
- if (getCardsInHand() != -1) {
+ if (this.getCardsInHand() != -1) {
// Can handle Library of Alexandria, or Hellbent
- if (activator.getCardsIn(Zone.Hand).size() != getCardsInHand()) {
+ if (activator.getCardsIn(Zone.Hand).size() != this.getCardsInHand()) {
return false;
}
}
- if (getIsPresent() != null) {
+ if (this.getIsPresent() != null) {
CardList list = new CardList();
- if (getPresentDefined() != null) {
- list.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), getPresentDefined(), sa).toArray());
+ if (this.getPresentDefined() != null) {
+ list.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), this.getPresentDefined(), sa).toArray());
} else {
list = AllZoneUtil.getCardsIn(Zone.Battlefield);
}
- list = list.getValidCards(getIsPresent().split(","), sa.getActivatingPlayer(), sa.getSourceCard());
+ list = list.getValidCards(this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getSourceCard());
int right;
- String rightString = getPresentCompare().substring(2);
+ final String rightString = this.getPresentCompare().substring(2);
try { // If this is an Integer, just parse it
right = Integer.parseInt(rightString);
- } catch (NumberFormatException e) { // Otherwise, grab it from the
- // SVar
+ } catch (final NumberFormatException e) { // Otherwise, grab it from
+ // the
+ // SVar
right = CardFactoryUtil.xCount(sa.getSourceCard(), sa.getSourceCard().getSVar(rightString));
}
- int left = list.size();
+ final int left = list.size();
- if (!AllZoneUtil.compare(left, getPresentCompare(), right)) {
+ if (!AllZoneUtil.compare(left, this.getPresentCompare(), right)) {
return false;
}
}
- if (getLifeTotal() != null) {
+ if (this.getLifeTotal() != null) {
int life = 1;
- if (getLifeTotal().equals("You")) {
+ if (this.getLifeTotal().equals("You")) {
life = activator.getLife();
}
- if (getLifeTotal().equals("Opponent")) {
+ if (this.getLifeTotal().equals("Opponent")) {
life = activator.getOpponent().getLife();
}
int right = 1;
- String rightString = getLifeAmount().substring(2);
+ final String rightString = this.getLifeAmount().substring(2);
if (rightString.equals("X")) {
right = CardFactoryUtil.xCount(sa.getSourceCard(), sa.getSourceCard().getSVar("X"));
} else {
- right = Integer.parseInt(getLifeAmount().substring(2));
+ right = Integer.parseInt(this.getLifeAmount().substring(2));
}
- if (!AllZoneUtil.compare(life, getLifeAmount(), right)) {
+ if (!AllZoneUtil.compare(life, this.getLifeAmount(), right)) {
return false;
}
}
- if (null != getManaSpent()) {
- if (!sa.getSourceCard().getColorsPaid().contains(getManaSpent())) {
+ if (null != this.getManaSpent()) {
+ if (!sa.getSourceCard().getColorsPaid().contains(this.getManaSpent())) {
return false;
}
}
- if (getsVarToCheck() != null) {
- int svarValue = AbilityFactory.calculateAmount(sa.getSourceCard(), getsVarToCheck(), sa);
- int operandValue = AbilityFactory.calculateAmount(sa.getSourceCard(), getsVarOperand(), sa);
+ if (this.getsVarToCheck() != null) {
+ final int svarValue = AbilityFactory.calculateAmount(sa.getSourceCard(), this.getsVarToCheck(), sa);
+ final int operandValue = AbilityFactory.calculateAmount(sa.getSourceCard(), this.getsVarOperand(), sa);
- if (!AllZoneUtil.compare(svarValue, getsVarOperator(), operandValue)) {
+ if (!AllZoneUtil.compare(svarValue, this.getsVarOperator(), operandValue)) {
return false;
}
diff --git a/src/main/java/forge/card/spellability/SpellAbility_Requirements.java b/src/main/java/forge/card/spellability/SpellAbility_Requirements.java
index d37e9e0038b..58fe9eedf61 100644
--- a/src/main/java/forge/card/spellability/SpellAbility_Requirements.java
+++ b/src/main/java/forge/card/spellability/SpellAbility_Requirements.java
@@ -32,7 +32,7 @@ public class SpellAbility_Requirements {
* a boolean.
*/
public final void setSkipStack(final boolean bSkip) {
- skipStack = bSkip;
+ this.skipStack = bSkip;
}
/**
@@ -44,7 +44,7 @@ public class SpellAbility_Requirements {
* a boolean.
*/
public final void setFree(final boolean bFree) {
- isFree = bFree;
+ this.isFree = bFree;
}
private PlayerZone fromZone = null;
@@ -63,9 +63,9 @@ public class SpellAbility_Requirements {
* a {@link forge.card.cost.Cost_Payment} object.
*/
public SpellAbility_Requirements(final SpellAbility sa, final Target_Selection ts, final Cost_Payment cp) {
- ability = sa;
- select = ts;
- payment = cp;
+ this.ability = sa;
+ this.select = ts;
+ this.payment = cp;
}
/**
@@ -74,7 +74,7 @@ public class SpellAbility_Requirements {
*
*/
public final void fillRequirements() {
- fillRequirements(false);
+ this.fillRequirements(false);
}
/**
@@ -86,13 +86,13 @@ public class SpellAbility_Requirements {
* a boolean.
*/
public final void fillRequirements(final boolean skipTargeting) {
- if (ability instanceof Spell && !bCasting) {
+ if ((this.ability instanceof Spell) && !this.bCasting) {
// remove from hand
- bCasting = true;
- if (!ability.getSourceCard().isCopiedSpell()) {
- Card c = ability.getSourceCard();
+ this.bCasting = true;
+ if (!this.ability.getSourceCard().isCopiedSpell()) {
+ final Card c = this.ability.getSourceCard();
- fromZone = AllZone.getZoneOf(c);
+ this.fromZone = AllZone.getZoneOf(c);
AllZone.getGameAction().moveToStack(c);
}
}
@@ -104,12 +104,12 @@ public class SpellAbility_Requirements {
// Skip to paying if parent ability doesn't target and has no
// subAbilities.
// (or trigger case where its already targeted)
- if (!skipTargeting && (select.doesTarget() || ability.getSubAbility() != null)) {
- select.setRequirements(this);
- select.resetTargets();
- select.chooseTargets();
+ if (!skipTargeting && (this.select.doesTarget() || (this.ability.getSubAbility() != null))) {
+ this.select.setRequirements(this);
+ this.select.resetTargets();
+ this.select.chooseTargets();
} else {
- needPayment();
+ this.needPayment();
}
}
@@ -119,19 +119,19 @@ public class SpellAbility_Requirements {
*
*/
public final void finishedTargeting() {
- if (select.isCanceled()) {
+ if (this.select.isCanceled()) {
// cancel ability during target choosing
- Card c = ability.getSourceCard();
- if (bCasting && !c.isCopiedSpell()) { // and not a copy
+ final Card c = this.ability.getSourceCard();
+ if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
// add back to where it came from
- AllZone.getGameAction().moveTo(fromZone, c);
+ AllZone.getGameAction().moveTo(this.fromZone, c);
}
- select.resetTargets();
+ this.select.resetTargets();
AllZone.getStack().clearFrozen();
return;
} else {
- needPayment();
+ this.needPayment();
}
}
@@ -141,10 +141,10 @@ public class SpellAbility_Requirements {
*
*/
public final void needPayment() {
- if (!isFree) {
- startPaying();
+ if (!this.isFree) {
+ this.startPaying();
} else {
- finishPaying();
+ this.finishPaying();
}
}
@@ -154,8 +154,8 @@ public class SpellAbility_Requirements {
*
*/
public final void startPaying() {
- payment.setRequirements(this);
- payment.payCost();
+ this.payment.setRequirements(this);
+ this.payment.payCost();
}
/**
@@ -164,28 +164,28 @@ public class SpellAbility_Requirements {
*
*/
public final void finishPaying() {
- if (isFree || payment.isAllPaid()) {
- if (skipStack) {
- AbilityFactory.resolve(ability, false);
+ if (this.isFree || this.payment.isAllPaid()) {
+ if (this.skipStack) {
+ AbilityFactory.resolve(this.ability, false);
} else {
- addAbilityToStack();
+ this.addAbilityToStack();
}
- select.resetTargets();
+ this.select.resetTargets();
AllZone.getGameAction().checkStateEffects();
- } else if (payment.isCanceled()) {
- Card c = ability.getSourceCard();
- if (bCasting && !c.isCopiedSpell()) { // and not a copy
+ } else if (this.payment.isCanceled()) {
+ final Card c = this.ability.getSourceCard();
+ if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
// add back to Previous Zone
- AllZone.getGameAction().moveTo(fromZone, c);
+ AllZone.getGameAction().moveTo(this.fromZone, c);
}
- if (select != null) {
- select.resetTargets();
+ if (this.select != null) {
+ this.select.resetTargets();
}
- ability.resetOnceResolved();
- payment.cancelPayment();
+ this.ability.resetOnceResolved();
+ this.payment.cancelPayment();
AllZone.getStack().clearFrozen();
}
}
@@ -197,23 +197,23 @@ public class SpellAbility_Requirements {
*/
public final void addAbilityToStack() {
// For older abilities that don't setStackDescription set it here
- if (ability.getStackDescription().equals("")) {
- StringBuilder sb = new StringBuilder();
- sb.append(ability.getSourceCard().getName());
- if (ability.getTarget() != null) {
- ArrayList