sas;
- Target tgt = af.getAbTgt();
+ final Target tgt = af.getAbTgt();
if (tgt != null) {
sas = tgt.getTargetSAs();
} else {
- sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
+ sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), this.params.get("Defined"), sa);
}
- if (params.containsKey("ForgetOtherTargets")) {
- if (params.get("ForgetOtherTargets").equals("True")) {
+ if (this.params.containsKey("ForgetOtherTargets")) {
+ if (this.params.get("ForgetOtherTargets").equals("True")) {
af.getHostCard().clearRemembered();
}
}
for (final SpellAbility tgtSA : sas) {
- Card tgtSACard = tgtSA.getSourceCard();
+ final Card tgtSACard = tgtSA.getSourceCard();
if (tgtSA.isSpell() && tgtSACard.keywordsContain("CARDNAME can't be countered.")) {
continue;
}
- SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(tgtSA);
+ final SpellAbility_StackInstance si = AllZone.getStack().getInstanceFromSpellAbility(tgtSA);
if (si == null) {
continue;
}
- removeFromStack(tgtSA, sa, si);
+ this.removeFromStack(tgtSA, sa, si);
// Destroy Permanent may be able to be turned into a SubAbility
- if (tgtSA.isAbility() && params.containsKey("DestroyPermanent")) {
+ if (tgtSA.isAbility() && this.params.containsKey("DestroyPermanent")) {
AllZone.getGameAction().destroy(tgtSACard);
}
- if (params.containsKey("RememberTargets")) {
- if (params.get("RememberTargets").equals("True")) {
+ if (this.params.containsKey("RememberTargets")) {
+ if (this.params.get("RememberTargets").equals("True")) {
af.getHostCard().addRemembered(tgtSACard);
}
}
}
- }// end counterResolve
+ } // end counterResolve
/**
*
@@ -418,7 +425,7 @@ public class AbilityFactory_CounterMagic {
*/
private String counterStackDescription(final AbilityFactory af, final SpellAbility sa) {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
if (!(sa instanceof Ability_Sub)) {
sb.append(sa.getSourceCard().getName()).append(" - ");
@@ -428,11 +435,11 @@ public class AbilityFactory_CounterMagic {
ArrayList sas;
- Target tgt = af.getAbTgt();
+ final Target tgt = af.getAbTgt();
if (tgt != null) {
sas = tgt.getTargetSAs();
} else {
- sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
+ sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), this.params.get("Defined"), sa);
}
sb.append("countering");
@@ -447,19 +454,19 @@ public class AbilityFactory_CounterMagic {
}
}
- if (isAbility && params.containsKey("DestroyPermanent")) {
+ if (isAbility && this.params.containsKey("DestroyPermanent")) {
sb.append(" and destroy it");
}
sb.append(".");
- Ability_Sub abSub = sa.getSubAbility();
+ final Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
sb.append(abSub.getStackDescription());
}
return sb.toString();
- }// end counterStackDescription
+ } // end counterStackDescription
/**
*
@@ -474,23 +481,25 @@ public class AbilityFactory_CounterMagic {
* a {@link forge.card.spellability.SpellAbility_StackInstance}
* object.
*/
- private void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbility_StackInstance si) {
+ private void removeFromStack(final SpellAbility tgtSA,
+ final SpellAbility srcSA, final SpellAbility_StackInstance si)
+ {
AllZone.getStack().remove(si);
if (tgtSA.isAbility()) {
// For Ability-targeted counterspells - do not move it anywhere,
// even if Destination$ is specified.
- } else if (destination.equals("Graveyard")) {
+ } else if (this.destination.equals("Graveyard")) {
AllZone.getGameAction().moveToGraveyard(tgtSA.getSourceCard());
- } else if (destination.equals("Exile")) {
+ } else if (this.destination.equals("Exile")) {
AllZone.getGameAction().exile(tgtSA.getSourceCard());
- } else if (destination.equals("TopOfLibrary")) {
+ } else if (this.destination.equals("TopOfLibrary")) {
AllZone.getGameAction().moveToLibrary(tgtSA.getSourceCard());
- } else if (destination.equals("Hand")) {
+ } else if (this.destination.equals("Hand")) {
AllZone.getGameAction().moveToHand(tgtSA.getSourceCard());
- } else if (destination.equals("BottomOfLibrary")) {
+ } else if (this.destination.equals("BottomOfLibrary")) {
AllZone.getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
- } else if (destination.equals("ShuffleIntoLibrary")) {
+ } else if (this.destination.equals("ShuffleIntoLibrary")) {
AllZone.getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
tgtSA.getSourceCard().getController().shuffle();
} else {
@@ -499,8 +508,8 @@ public class AbilityFactory_CounterMagic {
}
if (!tgtSA.isAbility()) {
- System.out.println("Send countered spell to " + destination);
+ System.out.println("Send countered spell to " + this.destination);
}
}
-}// end class AbilityFactory_CounterMagic
+} // end class AbilityFactory_CounterMagic
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Counters.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Counters.java
index be4aa5207dd..17ceb02b605 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Counters.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Counters.java
@@ -143,7 +143,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return putPlayDrawbackAI(af, this);
}
@@ -369,7 +369,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
if (AbilityFactory.playReusable(sa)) {
@@ -453,7 +453,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
@@ -788,7 +788,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return removePlayDrawbackAI(af, this);
}
@@ -926,7 +926,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -971,7 +971,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
@@ -1168,7 +1168,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return proliferateShouldPlayAI(this);
}
@@ -1222,7 +1222,7 @@ public class AbilityFactory_Counters {
boolean chance = true;
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
// TODO Make sure Human has poison counters or there are some counters
@@ -1532,7 +1532,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return putAllPlayDrawbackAI(af, this);
}
@@ -1685,7 +1685,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -1840,7 +1840,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return removeCounterAllPlayDrawbackAI(af, this);
}
@@ -2061,7 +2061,7 @@ public class AbilityFactory_Counters {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return moveCounterPlayDrawbackAI(af, this);
}
@@ -2160,7 +2160,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
if (AbilityFactory.playReusable(sa)) {
@@ -2186,7 +2186,7 @@ public class AbilityFactory_Counters {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java
index 9fc516a4709..d876ccf5339 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java
@@ -138,7 +138,7 @@ public class AbilityFactory_DealDamage {
private static final long serialVersionUID = 7239608350643325111L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
// Make sure there is a valid target
return damageDrawback(this);
}
@@ -357,7 +357,7 @@ public class AbilityFactory_DealDamage {
Ability_Sub subAb = saMe.getSubAbility();
if (subAb != null) {
- rr &= subAb.chkAI_Drawback();
+ rr &= subAb.chkAIDrawback();
}
return rr;
}
@@ -889,7 +889,7 @@ public class AbilityFactory_DealDamage {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
// check AI life before playing this drawback?
return true;
}
@@ -1017,7 +1017,7 @@ public class AbilityFactory_DealDamage {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Debuff.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Debuff.java
index 14a8a61db14..09d05c01f44 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Debuff.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Debuff.java
@@ -138,7 +138,7 @@ public final class AbilityFactory_Debuff {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return debuffDrawbackAI(af, this);
}
@@ -678,7 +678,7 @@ public final class AbilityFactory_Debuff {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return debuffAllChkDrawbackAI(af, this);
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_DelayedTrigger.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_DelayedTrigger.java
index 33770f59a41..825619ea99b 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_DelayedTrigger.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_DelayedTrigger.java
@@ -104,7 +104,7 @@ public class AbilityFactory_DelayedTrigger {
private static final long serialVersionUID = 6192972525033429820L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return doChkAI_Drawback(AF, this);
}
@@ -139,7 +139,7 @@ public class AbilityFactory_DelayedTrigger {
SpellAbility trigsa = tempCreator.getAbility(AF.getHostCard().getSVar(svarName), AF.getHostCard());
if (trigsa instanceof Ability_Sub) {
- return ((Ability_Sub) trigsa).chkAI_Drawback();
+ return ((Ability_Sub) trigsa).chkAIDrawback();
} else {
return trigsa.canPlayAI();
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Destroy.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Destroy.java
index d2514125229..2b1cbaeea51 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Destroy.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Destroy.java
@@ -126,7 +126,7 @@ public class AbilityFactory_Destroy {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return false;
}
@@ -175,7 +175,7 @@ public class AbilityFactory_Destroy {
// If NoRegen is not set, filter out creatures that have a
// regeneration shield
if (!noRegen) {
- // TODO: filter out things that could regenerate in response?
+ // TODO filter out things that could regenerate in response?
// might be tougher?
list = list.filter(new CardListFilter() {
public boolean addCard(final Card c) {
@@ -257,7 +257,7 @@ public class AbilityFactory_Destroy {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .6667) && chance);
@@ -304,7 +304,7 @@ public class AbilityFactory_Destroy {
// If NoRegen is not set, filter out creatures that have a
// regeneration shield
if (!noRegen) {
- // TODO: filter out things that could regenerate in response?
+ // TODO filter out things that could regenerate in response?
// might be tougher?
preferred = preferred.filter(new CardListFilter() {
public boolean addCard(final Card c) {
@@ -313,8 +313,9 @@ public class AbilityFactory_Destroy {
});
}
- for (Card c : preferred)
+ for (Card c : preferred) {
list.remove(c);
+ }
while (tgt.getNumTargeted() < tgt.getMaxTargets(sa.getSourceCard(), sa)) {
if (preferred.size() == 0) {
@@ -527,8 +528,8 @@ public class AbilityFactory_Destroy {
final SpellAbility abDestroyAll = new Ability_Activated(af.getHostCard(), af.getAbCost(), af.getAbTgt()) {
private static final long serialVersionUID = -1376444173137861437L;
- final HashMap params = af.getMapParams();
- final boolean noRegen = params.containsKey("NoRegen");
+ private final HashMap params = af.getMapParams();
+ private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -567,8 +568,8 @@ public class AbilityFactory_Destroy {
final SpellAbility spDestroyAll = new Spell(af.getHostCard(), af.getAbCost(), af.getAbTgt()) {
private static final long serialVersionUID = -3712659336576469102L;
- final HashMap params = af.getMapParams();
- final boolean noRegen = params.containsKey("NoRegen");
+ private final HashMap params = af.getMapParams();
+ private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -606,8 +607,8 @@ public class AbilityFactory_Destroy {
final SpellAbility dbDestroyAll = new Ability_Sub(af.getHostCard(), af.getAbTgt()) {
private static final long serialVersionUID = -242160421677518351L;
- final HashMap params = af.getMapParams();
- final boolean noRegen = params.containsKey("NoRegen");
+ private final HashMap params = af.getMapParams();
+ private final boolean noRegen = params.containsKey("NoRegen");
@Override
public String getStackDescription() {
@@ -624,7 +625,7 @@ public class AbilityFactory_Destroy {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -651,7 +652,9 @@ public class AbilityFactory_Destroy {
* a boolean.
* @return a {@link java.lang.String} object.
*/
- private static String destroyAllStackDescription(final AbilityFactory af, final SpellAbility sa, final boolean noRegen) {
+ private static String destroyAllStackDescription(final AbilityFactory af,
+ final SpellAbility sa, final boolean noRegen)
+ {
StringBuilder sb = new StringBuilder();
String name = af.getHostCard().getName();
@@ -706,17 +709,17 @@ public class AbilityFactory_Destroy {
Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard();
final HashMap params = af.getMapParams();
- String Valid = "";
+ String valid = "";
if (params.containsKey("ValidCards")) {
- Valid = params.get("ValidCards");
+ valid = params.get("ValidCards");
}
- if (Valid.contains("X") && source.getSVar("X").equals("Count$xPaid")) {
+ if (valid.contains("X") && source.getSVar("X").equals("Count$xPaid")) {
// Set PayX here to maximum value.
int xPay = ComputerUtil.determineLeftoverMana(sa);
source.setSVar("PayX", Integer.toString(xPay));
- Valid = Valid.replace("X", Integer.toString(xPay));
+ valid = valid.replace("X", Integer.toString(xPay));
}
CardList humanlist = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
@@ -730,8 +733,8 @@ public class AbilityFactory_Destroy {
computerlist.clear();
}
- humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source);
- computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source);
+ humanlist = humanlist.getValidCards(valid.split(","), source.getController(), source);
+ computerlist = computerlist.getValidCards(valid.split(","), source.getController(), source);
humanlist = humanlist.getNotKeyword("Indestructible");
computerlist = computerlist.getNotKeyword("Indestructible");
@@ -754,7 +757,7 @@ public class AbilityFactory_Destroy {
.evaluateCreatureList(humanlist)) {
return false;
}
- }// only lands involved
+ } // only lands involved
else if (humanlist.getNotType("Land").size() == 0 && computerlist.getNotType("Land").size() == 0) {
if (CardFactoryUtil.evaluatePermanentList(computerlist) + 1 >= CardFactoryUtil
.evaluatePermanentList(humanlist)) {
@@ -769,7 +772,7 @@ public class AbilityFactory_Destroy {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .9667) && chance);
@@ -798,17 +801,17 @@ public class AbilityFactory_Destroy {
targetPlayer = tgt.getTargetPlayers().get(0);
}
- String Valid = "";
+ String valid = "";
if (params.containsKey("ValidCards")) {
- Valid = params.get("ValidCards");
+ valid = params.get("ValidCards");
}
// Ugh. If calculateAmount needs to be called with DestroyAll it _needs_
// to use the X variable
// We really need a better solution to this
- if (Valid.contains("X")) {
- Valid = Valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
+ if (valid.contains("X")) {
+ valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
}
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
@@ -817,7 +820,7 @@ public class AbilityFactory_Destroy {
list = list.getController(targetPlayer);
}
- list = AbilityFactory.filterListByType(list, Valid, sa);
+ list = AbilityFactory.filterListByType(list, valid, sa);
boolean remDestroyed = params.containsKey("RememberDestroyed");
if (remDestroyed) {
@@ -832,10 +835,11 @@ public class AbilityFactory_Destroy {
}
} else {
for (int i = 0; i < list.size(); i++) {
- if (AllZone.getGameAction().destroy(list.get(i)) && remDestroyed)
+ if (AllZone.getGameAction().destroy(list.get(i)) && remDestroyed) {
card.addRemembered(list.get(i));
+ }
}
}
}
-}// end class AbilityFactory_Destroy
+} // end class AbilityFactory_Destroy
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Effect.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Effect.java
index 350eb666625..64e3ba32efa 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Effect.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Effect.java
@@ -135,7 +135,7 @@ public class AbilityFactory_Effect {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_EndGameCondition.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_EndGameCondition.java
index a283ebc0761..9c16c73c28c 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_EndGameCondition.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_EndGameCondition.java
@@ -143,7 +143,7 @@ public final class AbilityFactory_EndGameCondition {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -379,7 +379,7 @@ public final class AbilityFactory_EndGameCondition {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_GainControl.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_GainControl.java
index 3718b97b308..1349423b8b3 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_GainControl.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_GainControl.java
@@ -188,7 +188,7 @@ public class AbilityFactory_GainControl {
} // resolve
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return gainControlDrawbackAI(this);
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Mana.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Mana.java
index 00b4fe0da8d..29bdedb02b2 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Mana.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Mana.java
@@ -165,7 +165,7 @@ public class AbilityFactory_Mana {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -868,7 +868,7 @@ public class AbilityFactory_Mana {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return drainManaPlayDrawbackAI(af, this);
}
@@ -966,7 +966,7 @@ public class AbilityFactory_Mana {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1046,7 +1046,7 @@ public class AbilityFactory_Mana {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_PermanentState.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_PermanentState.java
index 41464ca84e2..c13aab7ce11 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_PermanentState.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_PermanentState.java
@@ -133,7 +133,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return untapPlayDrawbackAI(af, this);
}
@@ -237,7 +237,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -315,7 +315,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -691,7 +691,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return tapPlayDrawbackAI(af, this);
}
@@ -807,7 +807,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -884,7 +884,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1208,7 +1208,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return untapAllPlayDrawbackAI(af, this);
}
@@ -1434,7 +1434,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return tapAllPlayDrawbackAI(af, this);
}
@@ -1767,7 +1767,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return tapOrUntapPlayDrawbackAI(af, this);
}
@@ -1874,7 +1874,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -1951,7 +1951,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -2101,7 +2101,7 @@ public class AbilityFactory_PermanentState {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return phasesPlayDrawbackAI(af, this);
}
@@ -2202,7 +2202,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
@@ -2269,7 +2269,7 @@ public class AbilityFactory_PermanentState {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_PreventDamage.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_PreventDamage.java
index d2d42b60d3e..1c7b2ffc8c3 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_PreventDamage.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_PreventDamage.java
@@ -134,7 +134,7 @@ public class AbilityFactory_PreventDamage {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -344,7 +344,7 @@ public class AbilityFactory_PreventDamage {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Protection.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Protection.java
index c72c6c6e4a3..7cf66aa95c6 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Protection.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Protection.java
@@ -141,7 +141,7 @@ public final class AbilityFactory_Protection {
} // resolve
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return protectDrawbackAI(af, this);
}
@@ -898,7 +898,7 @@ public final class AbilityFactory_Protection {
} // resolve
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return protectAllDrawbackAI(af, this);
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Pump.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Pump.java
index 2ca1d632963..0301c98bfd5 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Pump.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Pump.java
@@ -178,7 +178,7 @@ public class AbilityFactory_Pump {
}// resolve
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return pumpDrawbackAI(this);
}
@@ -1037,7 +1037,7 @@ public class AbilityFactory_Pump {
}// resolve
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return pumpAllChkDrawbackAI(this);
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Regenerate.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Regenerate.java
index c7090e5cf99..f2af5432fc9 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Regenerate.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Regenerate.java
@@ -138,7 +138,7 @@ public class AbilityFactory_Regenerate {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -314,7 +314,7 @@ public class AbilityFactory_Regenerate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
@@ -567,7 +567,7 @@ public class AbilityFactory_Regenerate {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -687,7 +687,7 @@ public class AbilityFactory_Regenerate {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Reveal.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Reveal.java
index a7c0500bb60..5b228e86457 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Reveal.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Reveal.java
@@ -139,7 +139,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -259,7 +259,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
- return randomReturn && abSub.chkAI_Drawback();
+ return randomReturn && abSub.chkAIDrawback();
}
}
@@ -671,7 +671,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -809,7 +809,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
- return randomReturn && abSub.chkAI_Drawback();
+ return randomReturn && abSub.chkAIDrawback();
}
}
@@ -1032,7 +1032,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return revealHandTargetAI(af, this, false, false);
}
@@ -1145,7 +1145,7 @@ public final class AbilityFactory_Reveal {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}
@@ -1365,7 +1365,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return scryTargetAI(af, this);
}
@@ -1534,7 +1534,7 @@ public final class AbilityFactory_Reveal {
if (af.hasSubAbility()) {
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
- return randomReturn && abSub.chkAI_Drawback();
+ return randomReturn && abSub.chkAIDrawback();
}
}
return randomReturn;
@@ -1646,7 +1646,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return false;
}
@@ -1949,7 +1949,7 @@ public final class AbilityFactory_Reveal {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
// reuse code from RevealHand
return revealHandTargetAI(af, this, false, false);
}
@@ -2068,7 +2068,7 @@ public final class AbilityFactory_Reveal {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Sacrifice.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Sacrifice.java
index 1c3f821b5d4..aac4a78c3e0 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Sacrifice.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Sacrifice.java
@@ -122,7 +122,7 @@ public class AbilityFactory_Sacrifice {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return sacrificePlayDrawbackAI(af, this);
}
@@ -257,7 +257,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
@@ -282,7 +282,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance;
@@ -318,7 +318,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return chance || mandatory;
@@ -627,7 +627,7 @@ public class AbilityFactory_Sacrifice {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
@@ -763,7 +763,7 @@ public class AbilityFactory_Sacrifice {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- chance &= subAb.chkAI_Drawback();
+ chance &= subAb.chkAIDrawback();
}
return ((r.nextFloat() < .9667) && chance);
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Token.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Token.java
index 08b72e03702..5fa89706d14 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Token.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Token.java
@@ -203,7 +203,7 @@ public class AbilityFactory_Token extends AbilityFactory {
private static final long serialVersionUID = 7239608350643325111L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_Turns.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_Turns.java
index d6fa4e56477..82988b48bf5 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_Turns.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_Turns.java
@@ -119,7 +119,7 @@ public class AbilityFactory_Turns {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return true;
}
diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java
index 677b47750ef..ce1925202d7 100644
--- a/src/main/java/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java
+++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java
@@ -132,7 +132,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return drawTargetAI(af, this, false, false);
}
@@ -299,7 +299,7 @@ public class AbilityFactory_ZoneAffecting {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}
@@ -626,7 +626,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return millDrawback(af, this);
}
@@ -860,7 +860,7 @@ public class AbilityFactory_ZoneAffecting {
// check SubAbilities DoTrigger?
Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) {
- return abSub.chkAI_Drawback();
+ return abSub.chkAIDrawback();
}
return true;
@@ -1051,7 +1051,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return discardCheckDrawbackAI(af, this);
}
@@ -1424,7 +1424,7 @@ public class AbilityFactory_ZoneAffecting {
Ability_Sub subAb = sa.getSubAbility();
if (subAb != null) {
- randomReturn &= subAb.chkAI_Drawback();
+ randomReturn &= subAb.chkAIDrawback();
}
return randomReturn;
}// discardCanPlayAI()
@@ -1602,7 +1602,7 @@ public class AbilityFactory_ZoneAffecting {
}
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return shuffleTargetAI(af, this, false, false);
}
diff --git a/src/main/java/forge/card/cardFactory/AbstractCardFactory.java b/src/main/java/forge/card/cardFactory/AbstractCardFactory.java
index 52f1394b1a2..a6d682d5f4d 100644
--- a/src/main/java/forge/card/cardFactory/AbstractCardFactory.java
+++ b/src/main/java/forge/card/cardFactory/AbstractCardFactory.java
@@ -627,7 +627,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = 7202704600935499188L;
public void execute() {
- ability.setStackDescription("As Sarpadian Empires, Vol. VII enters the battlefield, choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.");
+ ability.setStackDescription("As Sarpadian Empires, Vol. VII enters the battlefield, "
+ + "choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.");
AllZone.getStack().addSimultaneousStackEntry(ability);
@@ -665,7 +666,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
Input soilTarget = new Input() {
- boolean once = false;
+ private boolean once = false;
private static final long serialVersionUID = 8243511353958609599L;
@Override
@@ -907,7 +908,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = -7679939432259603542L;
public void execute() {
- ability.setStackDescription("If Mox Diamond would enter the battlefield, you may discard a land card instead. If you do, put Mox Diamond onto the battlefield. If you don't, put it into its owner's graveyard.");
+ ability.setStackDescription("If Mox Diamond would enter the battlefield, you may "
+ + "discard a land card instead. If you do, put Mox Diamond onto the battlefield. "
+ + "If you don't, put it into its owner's graveyard.");
AllZone.getStack().addSimultaneousStackEntry(ability);
}
@@ -1012,9 +1015,12 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
StringBuilder sb = new StringBuilder();
sb.append(abCost);
- sb.append("Reveal cards from the top of your library until you reveal a land card. Goblin Charbelcher deals damage equal ");
- sb.append("to the number of nonland cards revealed this way to target creature or player. If the revealed land card was a Mountain, ");
- sb.append("Goblin Charbelcher deals double that damage instead. Put the revealed cards on the bottom of your library in any order.");
+ sb.append("Reveal cards from the top of your library until you reveal a land card. "
+ + "Goblin Charbelcher deals damage equal ");
+ sb.append("to the number of nonland cards revealed this way to target creature or player. "
+ + "If the revealed land card was a Mountain, ");
+ sb.append("Goblin Charbelcher deals double that damage instead. Put the revealed cards on "
+ + "the bottom of your library in any order.");
ability.setDescription(sb.toString());
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
@@ -1101,7 +1107,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}; // ability
ability.setDescription(abCost
- + "Put up to four target basic land cards from a player's graveyard on top of his or her library in any order. That player draws a card at the beginning of the next turn's upkeep.");
+ + "Put up to four target basic land cards from a player's graveyard on top of his "
+ + "or her library in any order. That player draws a card at "
+ + "the beginning of the next turn's upkeep.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1152,7 +1160,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
ab1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
ab1.setDescription(abCost
- + "Put the top two cards of target player's library into that player's graveyard. If both cards share a color, repeat this process.");
+ + "Put the top two cards of target player's library into that player's graveyard. "
+ + "If both cards share a color, repeat this process.");
card.addSpellAbility(ab1);
} // *************** END ************ END **************************
@@ -1307,7 +1316,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
if (card.getController().isHuman()) {
AllZone.getInputControl().setInput(new Input() {
private static final long serialVersionUID = -2305549394512889450L;
- CardList exiled = new CardList();
+ private CardList exiled = new CardList();
@Override
public void showMessage() {
@@ -1371,7 +1380,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}
}; // ability
ability.setDescription(abCost
- + "Exile any number of cards from your hand face down. Put that many cards from the top of your library into your hand. Then look at the exiled cards and put them on top of your library in any order.");
+ + "Exile any number of cards from your hand face down. Put that many cards "
+ + "from the top of your library into your hand. Then look at the exiled cards "
+ + "and put them on top of your library in any order.");
ability.setStackDescription(cardName + " - exile any number of cards from your hand.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1433,7 +1444,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
ability.setStackDescription(sbStack.toString());
ability.setDescription(abCost
- + "Name a card. Reveal a card at random from your hand. If it's the named card, CARDNAME deals 2 damage to target creature or player.");
+ + "Name a card. Reveal a card at random from your hand. If it's the named card, "
+ + "CARDNAME deals 2 damage to target creature or player.");
ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
card.addSpellAbility(ability);
@@ -1531,7 +1543,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Shuffle your library, then reveal the top card. ");
- sbDesc.append("Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed ");
+ sbDesc.append("Until end of turn, for as long as that card remains on top of your library, "
+ + "play with the top card of your library revealed ");
sbDesc.append("and you may play that card without paying its mana cost. ");
sbDesc.append("(If it has X in its mana cost, X is 0.)");
ability.setDescription(abCost + sbDesc.toString());
@@ -1599,7 +1612,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
private static final long serialVersionUID = -572849470457911366L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return false;
}
@@ -1640,7 +1653,8 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
};
ability.setSubAbility(sub);
ability.setDescription(abCost
- + "Choose target creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its power to the other.");
+ + "Choose target creature you control and target creature an opponent controls. "
+ + "Each of those creatures deals damage equal to its power to the other.");
ability.setStackDescription(card + " - Each creature deals damage equal to its power to the other.");
card.addSpellAbility(ability);
} // *************** END ************ END **************************
@@ -1738,7 +1752,11 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
else if (cardName.equals("Sylvan Library")) {
final Trigger drawStepTrigger = forge.card.trigger.TriggerHandler
.parseTrigger(
- "Mode$ Phase | Phase$ Draw | ValidPlayer$ You | OptionalDecider$ You | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library.",
+ "Mode$ Phase | Phase$ Draw | ValidPlayer$ You | OptionalDecider$ You | "
+ + "TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ At the beginning of "
+ + "your draw step, you may draw two additional cards. If you do, choose two "
+ + "cards in your hand drawn this turn. For each of those cards, "
+ + "pay 4 life or put the card on top of your library.",
card, true);
final Ability ability = new Ability(card, "") {
@Override
@@ -1763,8 +1781,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
@Override
public void selectCard(final Card card, final PlayerZone zone) {
- if (zone.is(Constant.Zone.Hand) && true == card.getDrawnThisTurn()) {
- if (player.canPayLife(4) && GameActionUtil.showYesNoDialog(card, cardQuestion)) {
+ if (zone.is(Constant.Zone.Hand) && card.getDrawnThisTurn()) {
+ if (player.canPayLife(4) && GameActionUtil
+ .showYesNoDialog(card, cardQuestion)) {
player.payLife(4, card);
// card stays in hand
} else {
@@ -1782,7 +1801,9 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
}; // Ability
StringBuilder sb = new StringBuilder();
- sb.append("At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library.");
+ sb.append("At the beginning of your draw step, you may draw two additional cards. "
+ + "If you do, choose two cards in your hand drawn this turn. For each of those cards, "
+ + "pay 4 life or put the card on top of your library.");
ability.setStackDescription(sb.toString());
drawStepTrigger.setOverridingAbility(ability);
diff --git a/src/main/java/forge/card/cardFactory/CardFactoryUtil.java b/src/main/java/forge/card/cardFactory/CardFactoryUtil.java
index 22c120d3a06..a53f8c5a336 100644
--- a/src/main/java/forge/card/cardFactory/CardFactoryUtil.java
+++ b/src/main/java/forge/card/cardFactory/CardFactoryUtil.java
@@ -80,13 +80,14 @@ public class CardFactoryUtil {
CardList all = list;
if (targeted) {
all = all.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return CardFactoryUtil.canTarget(spell, c);
}
});
}
- return AI_getMostExpensivePermanent(all);
+ return CardFactoryUtil.AI_getMostExpensivePermanent(all);
}
/**
@@ -105,11 +106,11 @@ public class CardFactoryUtil {
int bigCMC = 0;
for (int i = 0; i < all.size(); i++) {
- Card card = all.get(i);
+ final Card card = all.get(i);
int curCMC = card.getCMC();
// Add all cost of all auras with the same controller
- CardList auras = new CardList(card.getEnchantedBy().toArray());
+ final CardList auras = new CardList(card.getEnchantedBy().toArray());
auras.getController(card.getController());
curCMC += auras.getTotalConvertedManaCost() + auras.size();
@@ -138,11 +139,12 @@ public class CardFactoryUtil {
*/
public static Card AI_getCheapestCreature(CardList list, final Card spell, final boolean targeted) {
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isCreature();
}
});
- return AI_getCheapestPermanent(list, spell, targeted);
+ return CardFactoryUtil.AI_getCheapestPermanent(list, spell, targeted);
}
/**
@@ -162,6 +164,7 @@ public class CardFactoryUtil {
CardList all = list;
if (targeted) {
all = all.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return CardFactoryUtil.canTarget(spell, c);
}
@@ -196,13 +199,14 @@ public class CardFactoryUtil {
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestLand(final CardList list) {
- CardList land = list.getType("Land");
+ final CardList land = list.getType("Land");
if (!(land.size() > 0)) {
return null;
}
// prefer to target non basic lands
- CardList nbLand = land.filter(new CardListFilter() {
+ final CardList nbLand = land.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return (!c.isBasicLand());
}
@@ -211,21 +215,22 @@ public class CardFactoryUtil {
if (nbLand.size() > 0) {
// TODO - Rank non basics?
- Random r = MyRandom.random;
+ final Random r = MyRandom.random;
return nbLand.get(r.nextInt(nbLand.size()));
}
// if no non-basic lands, target the least represented basic land type
- String[] names = { "Plains", "Island", "Swamp", "Mountain", "Forest" };
+ final String[] names = { "Plains", "Island", "Swamp", "Mountain", "Forest" };
String sminBL = "";
int iminBL = 20000; // hopefully no one will ever have more than 20000
// lands of one type....
int n = 0;
for (int i = 0; i < 5; i++) {
n = land.getType(names[i]).size();
- if (n < iminBL && n > 0) // if two or more are tied, only the first
- // one checked will be used
- {
+ if ((n < iminBL) && (n > 0)) {
+ // if two or more are tied, only the
+ // first
+ // one checked will be used
iminBL = n;
sminBL = names[i];
}
@@ -234,7 +239,7 @@ public class CardFactoryUtil {
return null; // no basic land was a minimum
}
- CardList bLand = land.getType(sminBL);
+ final CardList bLand = land.getType(sminBL);
for (int i = 0; i < bLand.size(); i++) {
if (!bLand.get(i).isTapped()) {
// prefer untapped lands
@@ -242,7 +247,7 @@ public class CardFactoryUtil {
}
}
- Random r = MyRandom.random;
+ final Random r = MyRandom.random;
return bLand.get(r.nextInt(bLand.size())); // random tapped land of
// least represented type
}
@@ -267,6 +272,7 @@ public class CardFactoryUtil {
if (targeted) {
all = all.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return CardFactoryUtil.canTarget(spell, c);
}
@@ -282,7 +288,7 @@ public class CardFactoryUtil {
int bigCMC = 0;
for (int i = 0; i < all.size(); i++) {
- int curCMC = CardUtil.getConvertedManaCost(all.get(i).getManaCost());
+ final int curCMC = CardUtil.getConvertedManaCost(all.get(i).getManaCost());
if (curCMC > bigCMC) {
bigCMC = curCMC;
@@ -316,7 +322,7 @@ public class CardFactoryUtil {
int bigCMC = 0;
for (int i = 0; i < all.size(); i++) {
- int curCMC = CardUtil.getConvertedManaCost(all.get(i).getManaCost());
+ final int curCMC = CardUtil.getConvertedManaCost(all.get(i).getManaCost());
if (curCMC > bigCMC) {
bigCMC = curCMC;
@@ -343,8 +349,9 @@ public class CardFactoryUtil {
artifact = artifact.getType("Artifact");
if (targeted) {
artifact = artifact.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return canTarget(spell, c);
+ return CardFactoryUtil.canTarget(spell, c);
}
});
}
@@ -361,10 +368,10 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean AI_doesCreatureAttack(final Card card) {
- Combat combat = ComputerUtil.getAttackers();
- Card[] att = combat.getAttackers();
- for (int i = 0; i < att.length; i++) {
- if (att[i].equals(card)) {
+ final Combat combat = ComputerUtil.getAttackers();
+ final Card[] att = combat.getAttackers();
+ for (final Card element : att) {
+ if (element.equals(card)) {
return true;
}
}
@@ -384,7 +391,7 @@ public class CardFactoryUtil {
public static int evaluateCreatureList(final CardList list) {
int value = 0;
for (int i = 0; i < list.size(); i++) {
- value += evaluateCreature(list.get(i));
+ value += CardFactoryUtil.evaluateCreature(list.get(i));
}
return value;
@@ -424,7 +431,7 @@ public class CardFactoryUtil {
value = 80; // tokens should be worth less than actual cards
}
int power = c.getNetAttack();
- int toughness = c.getNetDefense();
+ final int toughness = c.getNetDefense();
// Doran
if (AllZoneUtil.isCardInPlay("Doran, the Siege Tower")) {
@@ -467,39 +474,41 @@ public class CardFactoryUtil {
// Battle stats increasing keywords
if (c.hasKeyword("Double Strike")) {
- value += 10 + power * 15;
+ value += 10 + (power * 15);
}
value += c.getKeywordMagnitude("Bushido") * 16;
value += c.getAmountOfKeyword("Flanking") * 15;
// Other good keywords
- if (c.hasKeyword("Deathtouch") && power > 0) {
+ if (c.hasKeyword("Deathtouch") && (power > 0)) {
value += 25;
}
value += c.getAmountOfKeyword("Exalted") * 15;
- if (c.hasKeyword("First Strike") && !c.hasKeyword("Double Strike") && power > 0) {
- value += 10 + power * 5;
+ if (c.hasKeyword("First Strike") && !c.hasKeyword("Double Strike") && (power > 0)) {
+ value += 10 + (power * 5);
}
if (c.hasKeyword("Lifelink")) {
value += power * 10;
}
- if (c.hasKeyword("Trample") && power > 1) {
+ if (c.hasKeyword("Trample") && (power > 1)) {
value += power * 3;
}
if (c.hasKeyword("Vigilance")) {
- value += power * 5 + toughness * 5;
+ value += (power * 5) + (toughness * 5);
}
if (c.hasKeyword("Wither")) {
value += power * 10;
}
value += c.getKeywordMagnitude("Rampage");
value += c.getKeywordMagnitude("Annihilator") * 50;
- if (c.hasKeyword("Whenever a creature dealt damage by CARDNAME this turn is put into a graveyard, put a +1/+1 counter on CARDNAME.")
- && power > 0) {
+ if (c.hasKeyword("Whenever a creature dealt damage by CARDNAME this turn is "
+ + "put into a graveyard, put a +1/+1 counter on CARDNAME.")
+ && (power > 0)) {
value += 2;
}
- if (c.hasKeyword("Whenever a creature dealt damage by CARDNAME this turn is put into a graveyard, put a +2/+2 counter on CARDNAME.")
- && power > 0) {
+ if (c.hasKeyword("Whenever a creature dealt damage by CARDNAME this turn is "
+ + "put into a graveyard, put a +2/+2 counter on CARDNAME.")
+ && (power > 0)) {
value += 4;
}
if (c.hasKeyword("Whenever CARDNAME is dealt damage, put a +1/+1 counter on it.")) {
@@ -545,7 +554,7 @@ public class CardFactoryUtil {
// Bad keywords
if (c.hasKeyword("Defender") || c.hasKeyword("CARDNAME can't attack.")) {
- value -= power * 9 + 40;
+ value -= (power * 9) + 40;
}
if (c.hasKeyword("CARDNAME can't block.")) {
value -= 10;
@@ -562,7 +571,7 @@ public class CardFactoryUtil {
}
if (c.hasKeyword("CARDNAME can't attack or block.")) {
- value = 50 + c.getCMC() * 5; // reset everything - useless
+ value = 50 + (c.getCMC() * 5); // reset everything - useless
}
if (c.hasKeyword("At the beginning of the end step, destroy CARDNAME.")) {
value -= 50;
@@ -621,16 +630,16 @@ public class CardFactoryUtil {
// Get Best will filter by appropriate getBest list if ALL of the list
// is of that type
if (list.getNotType("Creature").size() == 0) {
- return AI_getBestCreature(list);
+ return CardFactoryUtil.AI_getBestCreature(list);
}
if (list.getNotType("Land").size() == 0) {
- return AI_getBestLand(list);
+ return CardFactoryUtil.AI_getBestLand(list);
}
// TODO - Once we get an EvaluatePermanent this should call
// getBestPermanent()
- return AI_getMostExpensivePermanent(list);
+ return CardFactoryUtil.AI_getMostExpensivePermanent(list);
}
/**
@@ -649,7 +658,7 @@ public class CardFactoryUtil {
biggest = all.get(0);
for (int i = 0; i < all.size(); i++) {
- if (evaluateCreature(biggest) < evaluateCreature(all.get(i))) {
+ if (CardFactoryUtil.evaluateCreature(biggest) < CardFactoryUtil.evaluateCreature(all.get(i))) {
biggest = all.get(i);
}
}
@@ -668,7 +677,7 @@ public class CardFactoryUtil {
* @return a {@link forge.Card} object.
*/
public static Card AI_getBestCreatureToBounce(final CardList list) {
- int tokenBonus = 40;
+ final int tokenBonus = 40;
CardList all = list;
all = all.getType("Creature");
Card biggest = null; // returns null if list.size() == 0
@@ -679,11 +688,11 @@ public class CardFactoryUtil {
biggest = all.get(0);
for (int i = 0; i < all.size(); i++) {
- biggestvalue = evaluateCreature(biggest);
+ biggestvalue = CardFactoryUtil.evaluateCreature(biggest);
if (biggest.isToken()) {
biggestvalue += tokenBonus; // raise the value of tokens
}
- newvalue = evaluateCreature(all.get(i));
+ newvalue = CardFactoryUtil.evaluateCreature(all.get(i));
if (all.get(i).isToken()) {
newvalue += tokenBonus; // raise the value of tokens
}
@@ -715,7 +724,7 @@ public class CardFactoryUtil {
smallest = all.get(0);
for (int i = 0; i < all.size(); i++) {
- if (evaluateCreature(smallest) > evaluateCreature(all.get(i))) {
+ if (CardFactoryUtil.evaluateCreature(smallest) > CardFactoryUtil.evaluateCreature(all.get(i))) {
smallest = all.get(i);
}
}
@@ -746,28 +755,29 @@ public class CardFactoryUtil {
return null;
}
- if (biasEnch && list.getType("Enchantment").size() > 0) {
- return AI_getCheapestPermanent(list.getType("Enchantment"), null, false);
+ if (biasEnch && (list.getType("Enchantment").size() > 0)) {
+ return CardFactoryUtil.AI_getCheapestPermanent(list.getType("Enchantment"), null, false);
}
- if (biasArt && list.getType("Artifact").size() > 0) {
- return AI_getCheapestPermanent(list.getType("Artifact"), null, false);
+ if (biasArt && (list.getType("Artifact").size() > 0)) {
+ return CardFactoryUtil.AI_getCheapestPermanent(list.getType("Artifact"), null, false);
}
- if (biasLand && list.getType("Land").size() > 0) {
- return getWorstLand(list.getType("Land"));
+ if (biasLand && (list.getType("Land").size() > 0)) {
+ return CardFactoryUtil.getWorstLand(list.getType("Land"));
}
- if (biasCreature && list.getType("Creature").size() > 0) {
- return AI_getWorstCreature(list.getType("Creature"));
+ if (biasCreature && (list.getType("Creature").size() > 0)) {
+ return CardFactoryUtil.AI_getWorstCreature(list.getType("Creature"));
}
if (list.getType("Land").size() > 6) {
- return getWorstLand(list.getType("Land"));
+ return CardFactoryUtil.getWorstLand(list.getType("Land"));
}
- if (list.getType("Artifact").size() > 0 || list.getType("Enchantment").size() > 0) {
- return AI_getCheapestPermanent(list.filter(new CardListFilter() {
+ if ((list.getType("Artifact").size() > 0) || (list.getType("Enchantment").size() > 0)) {
+ return CardFactoryUtil.AI_getCheapestPermanent(list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isArtifact() || c.isEnchantment();
}
@@ -775,12 +785,12 @@ public class CardFactoryUtil {
}
if (list.getType("Creature").size() > 0) {
- return AI_getWorstCreature(list.getType("Creature"));
+ return CardFactoryUtil.AI_getWorstCreature(list.getType("Creature"));
}
// Planeswalkers fall through to here, lands will fall through if there
// aren't very many
- return AI_getCheapestPermanent(list, null, false);
+ return CardFactoryUtil.AI_getCheapestPermanent(list, null, false);
}
/**
@@ -797,31 +807,31 @@ public class CardFactoryUtil {
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_Spell(final SpellAbility spell, final CardList choices, final boolean free) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = 2781418414287281005L;
@Override
public void showMessage() {
if (choices.size() == 0) {
- stop();
+ this.stop();
}
if (spell.getTargetCard() != null) {
- stop();
+ this.stop();
}
AllZone.getDisplay().showMessage("Select target Spell: ");
- Card choice = GuiUtils.getChoiceOptional("Choose a Spell", choices.toArray());
+ final Card choice = GuiUtils.getChoiceOptional("Choose a Spell", choices.toArray());
if (choice != null) {
spell.setTargetCard(choice);
- done();
+ this.done();
} else {
- stop();
+ this.stop();
}
}
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
void done() {
@@ -830,9 +840,9 @@ public class CardFactoryUtil {
if (spell.getTargetCard() != null) {
AllZone.getStack().add(spell);
}
- stop();
+ this.stop();
} else {
- stopSetNext(new Input_PayManaCost(spell));
+ this.stopSetNext(new Input_PayManaCost(spell));
}
}
};
@@ -851,7 +861,7 @@ public class CardFactoryUtil {
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_destroyNoRegeneration(final CardList choices, final String message) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = -6637588517573573232L;
@Override
@@ -864,7 +874,7 @@ public class CardFactoryUtil {
public void selectCard(final Card card, final PlayerZone zone) {
if (choices.contains(card)) {
AllZone.getGameAction().destroyNoRegeneration(card);
- stop();
+ this.stop();
}
}
};
@@ -882,17 +892,17 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_Flashback(final Card sourceCard, final String cost) {
- Cost fbCost = new Cost(cost, sourceCard.getName(), true);
+ public static SpellAbility abilityFlashback(final Card sourceCard, final String cost) {
+ final Cost fbCost = new Cost(cost, sourceCard.getName(), true);
final SpellAbility flashback = new Spell(sourceCard) {
private static final long serialVersionUID = -4196027546564209412L;
@Override
public void resolve() {
- SpellAbility[] sa = sourceCard.getSpellAbility();
+ final SpellAbility[] sa = sourceCard.getSpellAbility();
AllZone.getGameAction().moveToStack(sourceCard);
- SpellAbility flash = sa[0];
+ final SpellAbility flash = sa[0];
flash.setFlashBackAbility(true);
AllZone.getStack().add(flash);
}
@@ -904,7 +914,7 @@ public class CardFactoryUtil {
@Override
public boolean canPlay() {
- Card sourceCard = this.getSourceCard();
+ final Card sourceCard = this.getSourceCard();
return sourceCard.getController().getZone(Zone.Graveyard).contains(sourceCard)
&& (sourceCard.isInstant() || Phase.canCastSorcery(sourceCard.getController()));
@@ -915,14 +925,14 @@ public class CardFactoryUtil {
flashback.setPayCosts(fbCost);
- String costString = fbCost.toString().replace(":", ".");
+ final String costString = fbCost.toString().replace(":", ".");
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Flashback: ").append(costString);
flashback.setDescription(sbDesc.toString());
// possibly add Flashback into here?
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append("Flashback: ").append(sourceCard.getName());
flashback.setStackDescription(sbStack.toString());
@@ -941,15 +951,15 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.card.spellability.Ability_Activated} object.
*/
- public static Ability_Activated ability_Unearth(final Card sourceCard, final String manaCost) {
+ public static Ability_Activated abilityUnearth(final Card sourceCard, final String manaCost) {
- Cost cost = new Cost(manaCost, sourceCard.getName(), true);
+ final Cost cost = new Cost(manaCost, sourceCard.getName(), true);
final Ability_Activated unearth = new Ability_Activated(sourceCard, cost, null) {
private static final long serialVersionUID = -5633945565395478009L;
@Override
public void resolve() {
- Card card = AllZone.getGameAction().moveToPlay(sourceCard);
+ final Card card = AllZone.getGameAction().moveToPlay(sourceCard);
card.addIntrinsicKeyword("At the beginning of the end step, exile CARDNAME.");
card.addIntrinsicKeyword("Haste");
@@ -965,12 +975,12 @@ public class CardFactoryUtil {
return ComputerUtil.canPayCost(this);
}
};
- SpellAbility_Restriction restrict = new SpellAbility_Restriction();
+ final SpellAbility_Restriction restrict = new SpellAbility_Restriction();
restrict.setZone(Zone.Graveyard);
restrict.setSorcerySpeed(true);
unearth.setRestrictions(restrict);
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append("Unearth: ").append(sourceCard.getName());
unearth.setStackDescription(sbStack.toString());
@@ -986,8 +996,8 @@ public class CardFactoryUtil {
* a {@link forge.Card} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_Morph_Down(final Card sourceCard) {
- final SpellAbility morph_down = new Spell(sourceCard) {
+ public static SpellAbility abilityMorphDown(final Card sourceCard) {
+ final SpellAbility morphDown = new Spell(sourceCard) {
private static final long serialVersionUID = -1438810964807867610L;
@Override
@@ -1017,11 +1027,11 @@ public class CardFactoryUtil {
};
- morph_down.setManaCost("3");
- morph_down.setDescription("(You may cast this face down as a 2/2 creature for 3.)");
- morph_down.setStackDescription("Morph - Creature 2/2");
+ morphDown.setManaCost("3");
+ morphDown.setDescription("(You may cast this face down as a 2/2 creature for 3.)");
+ morphDown.setStackDescription("Morph - Creature 2/2");
- return morph_down;
+ return morphDown;
}
/**
@@ -1041,7 +1051,7 @@ public class CardFactoryUtil {
* a int.
* @return a {@link forge.card.spellability.Ability_Activated} object.
*/
- public static Ability_Activated ability_Morph_Up(final Card sourceCard, final Cost cost, final String orgManaCost,
+ public static Ability_Activated abilityMorphUp(final Card sourceCard, final Cost cost, final String orgManaCost,
final int a, final int d) {
// final String player = sourceCard.getController();
// final String manaCost = cost;
@@ -1063,7 +1073,7 @@ public class CardFactoryUtil {
sourceCard.setType(sourceCard.getPrevType());
// Run triggers
- Map runParams = new TreeMap();
+ final Map runParams = new TreeMap();
runParams.put("Card", sourceCard);
AllZone.getTriggerHandler().runTrigger("TurnFaceUp", runParams);
}
@@ -1082,7 +1092,7 @@ public class CardFactoryUtil {
String costDesc = cost.toString();
// get rid of the ": " at the end
costDesc = costDesc.substring(0, costDesc.length() - 2);
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Morph");
if (!cost.isOnlyManaCost()) {
sb.append(" -");
@@ -1090,7 +1100,7 @@ public class CardFactoryUtil {
sb.append(" ").append(costDesc).append(" (Turn this face up any time for its morph cost.)");
morph_up.setDescription(sb.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard.getName()).append(" - turn this card face up.");
morph_up.setStackDescription(sbStack.toString());
@@ -1108,9 +1118,9 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_cycle(final Card sourceCard, String cycleCost) {
+ public static SpellAbility abilityCycle(final Card sourceCard, String cycleCost) {
cycleCost += " Discard<1/CARDNAME>";
- Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
+ final Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
final SpellAbility cycle = new Ability_Activated(sourceCard, abCost, null) {
private static final long serialVersionUID = -4960704261761785512L;
@@ -1124,12 +1134,12 @@ public class CardFactoryUtil {
// The AI should cycle lands if it has 6 already and no cards in
// hand with higher CMC
- CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
+ final CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
CardList lands = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
lands.addAll(hand);
lands = lands.getType("Land");
- if (sourceCard.isLand() && lands.size() >= Math.max(hand.getHighestConvertedManaCost(), 6)) {
+ if (sourceCard.isLand() && (lands.size() >= Math.max(hand.getHighestConvertedManaCost(), 6))) {
return true;
}
@@ -1151,12 +1161,12 @@ public class CardFactoryUtil {
}
};
cycle.setIsCycling(true);
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Cycling ").append(cycle.getManaCost()).append(" (").append(abCost.toString())
.append(" Draw a card.)");
cycle.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard).append(" Cycling: Draw a card");
cycle.setStackDescription(sbStack.toString());
@@ -1177,10 +1187,10 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_typecycle(final Card sourceCard, String cycleCost, final String type) {
+ public static SpellAbility abilityTypecycle(final Card sourceCard, String cycleCost, final String type) {
String description;
cycleCost += " Discard<1/CARDNAME>";
- Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
+ final Cost abCost = new Cost(cycleCost, sourceCard.getName(), true);
final SpellAbility cycle = new Ability_Activated(sourceCard, abCost, null) {
private static final long serialVersionUID = -4960704261761785512L;
@@ -1203,8 +1213,8 @@ public class CardFactoryUtil {
@Override
public void resolve() {
- CardList cards = sourceCard.getController().getCardsIn(Zone.Library);
- CardList sameType = new CardList();
+ final CardList cards = sourceCard.getController().getCardsIn(Zone.Library);
+ final CardList sameType = new CardList();
for (int i = 0; i < cards.size(); i++) {
if (cards.get(i).isType(type)) {
@@ -1217,12 +1227,12 @@ public class CardFactoryUtil {
return;
}
- Object o = GuiUtils.getChoiceOptional("Select a card", sameType.toArray());
+ final Object o = GuiUtils.getChoiceOptional("Select a card", sameType.toArray());
if (o != null) {
// ability.setTargetCard((Card)o);
sourceCard.getController().discard(sourceCard, this);
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
AllZone.getGameAction().moveToHand(c1);
}
@@ -1236,12 +1246,12 @@ public class CardFactoryUtil {
}
cycle.setIsCycling(true);
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append(description).append("cycling (").append(abCost.toString()).append(" Search your library for a ");
sbDesc.append(description).append(" card, reveal it, and put it into your hand. Then shuffle your library.)");
cycle.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard).append(" ").append(description);
sbStack.append("cycling: Search your library for a ").append(description).append(" card.)");
cycle.setStackDescription(sbStack.toString());
@@ -1262,9 +1272,9 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_transmute(final Card sourceCard, String transmuteCost) {
+ public static SpellAbility abilityTransmute(final Card sourceCard, String transmuteCost) {
transmuteCost += " Discard<1/CARDNAME>";
- Cost abCost = new Cost(transmuteCost, sourceCard.getName(), true);
+ final Cost abCost = new Cost(transmuteCost, sourceCard.getName(), true);
final SpellAbility transmute = new Ability_Activated(sourceCard, abCost, null) {
private static final long serialVersionUID = -4960704261761785512L;
@@ -1281,8 +1291,8 @@ public class CardFactoryUtil {
@Override
public void resolve() {
- CardList cards = sourceCard.getController().getCardsIn(Zone.Library);
- CardList sameCost = new CardList();
+ final CardList cards = sourceCard.getController().getCardsIn(Zone.Library);
+ final CardList sameCost = new CardList();
for (int i = 0; i < cards.size(); i++) {
if (CardUtil.getConvertedManaCost(cards.get(i).getManaCost()) == CardUtil
@@ -1295,12 +1305,12 @@ public class CardFactoryUtil {
return;
}
- Object o = GuiUtils.getChoiceOptional("Select a card", sameCost.toArray());
+ final Object o = GuiUtils.getChoiceOptional("Select a card", sameCost.toArray());
if (o != null) {
// ability.setTargetCard((Card)o);
sourceCard.getController().discard(sourceCard, this);
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
AllZone.getGameAction().moveToHand(c1);
@@ -1309,13 +1319,13 @@ public class CardFactoryUtil {
}
};
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Transmute (").append(abCost.toString());
sbDesc.append("Search your library for a card with the same converted mana cost as this card, reveal it, ");
sbDesc.append("and put it into your hand. Then shuffle your library. Transmute only as a sorcery.)");
transmute.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard).append(
" Transmute: Search your library for a card with the same converted mana cost.)");
transmute.setStackDescription(sbStack.toString());
@@ -1337,15 +1347,13 @@ public class CardFactoryUtil {
* a int.
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
- public static SpellAbility ability_suspend(final Card sourceCard, final String suspendCost,
+ public static SpellAbility abilitySuspend(final Card sourceCard, final String suspendCost,
final int suspendCounters) {
// be careful with Suspend ability, it will not hit the stack
final SpellAbility suspend = new Ability_Static(sourceCard, suspendCost) {
- private static final long serialVersionUID = 21625903128384507L;
-
@Override
public boolean canPlay() {
- if (!(getRestrictions().canPlay(sourceCard, this))) {
+ if (!(this.getRestrictions().canPlay(sourceCard, this))) {
return false;
}
@@ -1365,15 +1373,15 @@ public class CardFactoryUtil {
@Override
public void resolve() {
- Card c = AllZone.getGameAction().exile(sourceCard);
+ final Card c = AllZone.getGameAction().exile(sourceCard);
c.addCounter(Counters.TIME, suspendCounters);
}
};
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Suspend ").append(suspendCounters).append(": ").append(suspendCost);
suspend.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard.getName()).append(" suspending for ").append(suspendCounters).append(" turns.)");
suspend.setStackDescription(sbStack.toString());
@@ -1400,17 +1408,18 @@ public class CardFactoryUtil {
*/
public static SpellAbility eqPump_Equip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
- Target target = new Target(sourceCard, "Select target creature you control", "Creature.YouCtrl".split(","));
+ final Target target = new Target(sourceCard, "Select target creature you control",
+ "Creature.YouCtrl".split(","));
final SpellAbility equip = new Ability_Activated(sourceCard, abCost, target) {
private static final long serialVersionUID = -4960704261761785512L;
@Override
public void resolve() {
- Card targetCard = getTargetCard();
+ final Card targetCard = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(targetCard) && CardFactoryUtil.canTarget(sourceCard, targetCard)) {
if (sourceCard.isEquipping()) {
- Card crd = sourceCard.getEquipping().get(0);
+ final Card crd = sourceCard.getEquipping().get(0);
if (crd.equals(targetCard)) {
return;
}
@@ -1429,23 +1438,24 @@ public class CardFactoryUtil {
@Override
public boolean canPlayAI() {
- return getCreature().size() != 0 && !sourceCard.isEquipping();
+ return (this.getCreature().size() != 0) && !sourceCard.isEquipping();
}
@Override
public void chooseTargetAI() {
- Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
- setTargetCard(target);
+ final Card target = CardFactoryUtil.AI_getBestCreature(this.getCreature());
+ this.setTargetCard(target);
}
CardList getCreature() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isCreature()
&& (CombatUtil.canAttack(c) || (CombatUtil.canAttackNextTurn(c) && AllZone.getPhase()
.is(Constant.Phase.Main2))) && CardFactoryUtil.canTarget(sourceCard, c)
- && (c.getNetDefense() + tough > 0 || sourceCard.getName().equals("Skullclamp"));
+ && (((c.getNetDefense() + tough) > 0) || sourceCard.getName().equals("Skullclamp"));
}
});
@@ -1454,16 +1464,18 @@ public class CardFactoryUtil {
CardList equipMagnetList = list;
equipMagnetList = equipMagnetList.getEquipMagnets();
- if (!equipMagnetList.isEmpty() && tough >= 0) {
+ if (!equipMagnetList.isEmpty() && (tough >= 0)) {
return equipMagnetList;
}
// This equipment is keyword only
- if (power == 0 && tough == 0) {
+ if ((power == 0) && (tough == 0)) {
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- ArrayList extKeywords = new ArrayList(Arrays.asList(extrinsicKeywords));
- for (String s : extKeywords) {
+ final ArrayList extKeywords = new ArrayList(Arrays
+ .asList(extrinsicKeywords));
+ for (final String s : extKeywords) {
// We want to give a new keyword
if (!c.hasKeyword(s)) {
@@ -1484,7 +1496,7 @@ public class CardFactoryUtil {
// get rid of the ": " at the end
costDesc = costDesc.substring(0, costDesc.length() - 2);
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Equip");
if (!abCost.isOnlyManaCost()) {
sbDesc.append(" -");
@@ -1515,13 +1527,14 @@ public class CardFactoryUtil {
public static Command eqPump_onEquip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
- Command onEquip = new Command() {
+ final Command onEquip = new Command() {
private static final long serialVersionUID = 8130682765214560887L;
+ @Override
public void execute() {
if (sourceCard.isEquipping()) {
- Card crd = sourceCard.getEquipping().get(0);
+ final Card crd = sourceCard.getEquipping().get(0);
for (int i = 0; i < extrinsicKeywords.length; i++) {
// prevent Flying, Flying
@@ -1559,16 +1572,17 @@ public class CardFactoryUtil {
public static Command eqPump_unEquip(final Card sourceCard, final int power, final int tough,
final String[] extrinsicKeywords, final Cost abCost) {
- Command onUnEquip = new Command() {
+ final Command onUnEquip = new Command() {
private static final long serialVersionUID = 5783423127748320501L;
+ @Override
public void execute() {
if (sourceCard.isEquipping()) {
- Card crd = sourceCard.getEquipping().get(0);
+ final Card crd = sourceCard.getEquipping().get(0);
- for (int i = 0; i < extrinsicKeywords.length; i++) {
- crd.removeExtrinsicKeyword(extrinsicKeywords[i]);
+ for (final String extrinsicKeyword : extrinsicKeywords) {
+ crd.removeExtrinsicKeyword(extrinsicKeyword);
}
crd.addSemiPermanentAttackBoost(-1 * power);
@@ -1592,8 +1606,8 @@ public class CardFactoryUtil {
* @return a {@link forge.card.spellability.Ability_Mana} object.
*/
public static Ability_Mana getEldraziSpawnAbility(final Card c) {
- Cost cost = new Cost("Sac<1/CARDNAME>", c.getName(), true);
- Ability_Mana mana = new Ability_Mana(c, cost, "1") {
+ final Cost cost = new Cost("Sac<1/CARDNAME>", c.getName(), true);
+ final Ability_Mana mana = new Ability_Mana(c, cost, "1") {
private static final long serialVersionUID = -2478676548112738019L;
};
mana.setDescription("Sacrifice CARDNAME: Add 1 to your mana pool.");
@@ -1614,9 +1628,10 @@ public class CardFactoryUtil {
* @return a {@link forge.Command} object.
*/
public static Command entersBattleFieldWithCounters(final Card c, final Counters type, final int n) {
- Command addCounters = new Command() {
+ final Command addCounters = new Command() {
private static final long serialVersionUID = 4825430555490333062L;
+ @Override
public void execute() {
c.addCounter(type, n);
}
@@ -1636,17 +1651,18 @@ public class CardFactoryUtil {
* @return a {@link forge.Command} object.
*/
public static Command fading(final Card sourceCard, final int power) {
- Command fade = new Command() {
+ final Command fade = new Command() {
private static final long serialVersionUID = 431920157968451817L;
public boolean firstTime = true;
+ @Override
public void execute() {
// testAndSet - only needed when enters the battlefield.
- if (firstTime) {
+ if (this.firstTime) {
sourceCard.addCounter(Counters.FADE, power);
}
- firstTime = false;
+ this.firstTime = false;
}
};
return fade;
@@ -1664,17 +1680,18 @@ public class CardFactoryUtil {
* @return a {@link forge.Command} object.
*/
public static Command vanishing(final Card sourceCard, final int power) {
- Command age = new Command() {
+ final Command age = new Command() {
private static final long serialVersionUID = 431920157968451817L;
public boolean firstTime = true;
+ @Override
public void execute() {
// testAndSet - only needed when enters the battlefield
- if (firstTime) {
+ if (this.firstTime) {
sourceCard.addCounter(Counters.TIME, power);
}
- firstTime = false;
+ this.firstTime = false;
}
};
return age;
@@ -1691,12 +1708,13 @@ public class CardFactoryUtil {
* a {@link java.lang.String} object.
* @return a {@link forge.Command} object.
*/
- public static Command ability_Soulshift(final Card sourceCard, final String manacost) {
+ public static Command abilitySoulshift(final Card sourceCard, final String manacost) {
final Command soulshift = new Command() {
private static final long serialVersionUID = -4960704261761785512L;
+ @Override
public void execute() {
- AllZone.getStack().add(soulshiftTrigger(sourceCard, manacost));
+ AllZone.getStack().add(CardFactoryUtil.soulshiftTrigger(sourceCard, manacost));
}
};
@@ -1717,13 +1735,11 @@ public class CardFactoryUtil {
*/
public static SpellAbility soulshiftTrigger(final Card sourceCard, final String manacost) {
final SpellAbility desc = new Ability(sourceCard, "0") {
- private static final long serialVersionUID = -4960704261761785512L;
-
@Override
public void resolve() {
- CardList cards = sourceCard.getController().getCardsIn(Zone.Graveyard);
- CardList sameCost = new CardList();
- int cost = CardUtil.getConvertedManaCost(manacost);
+ final CardList cards = sourceCard.getController().getCardsIn(Zone.Graveyard);
+ final CardList sameCost = new CardList();
+ final int cost = CardUtil.getConvertedManaCost(manacost);
for (int i = 0; i < cards.size(); i++) {
if ((CardUtil.getConvertedManaCost(cards.get(i).getManaCost()) <= cost)
&& cards.get(i).isType("Spirit")) {
@@ -1736,15 +1752,15 @@ public class CardFactoryUtil {
}
if (sourceCard.getController().isHuman()) {
- StringBuilder question = new StringBuilder();
+ final StringBuilder question = new StringBuilder();
question.append("Return target Spirit card with converted mana cost ");
question.append(manacost).append(" or less from your graveyard to your hand?");
if (GameActionUtil.showYesNoDialog(sourceCard, question.toString())) {
- Object o = GuiUtils.getChoiceOptional("Select a card", sameCost.toArray());
+ final Object o = GuiUtils.getChoiceOptional("Select a card", sameCost.toArray());
if (o != null) {
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
AllZone.getGameAction().moveToHand(c1);
}
}
@@ -1762,13 +1778,14 @@ public class CardFactoryUtil {
}; // SpellAbility desc
// The spell description below fails to appear in the card detail panel
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("Soulshift ").append(manacost);
- sbDesc.append(" - When this permanent is put into a graveyard from play, you may return target Spirit card with converted mana cost ");
+ sbDesc.append(" - When this permanent is put into a graveyard from play, "
+ + "you may return target Spirit card with converted mana cost ");
sbDesc.append(manacost).append(" or less from your graveyard to your hand.");
desc.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(sourceCard.getName()).append(" - Soulshift ").append(manacost);
desc.setStackDescription(sbStack.toString());
@@ -1795,7 +1812,7 @@ public class CardFactoryUtil {
*/
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
final boolean targeted, final boolean free) {
- return input_targetSpecific(spell, choices, message, Command.Blank, targeted, free);
+ return CardFactoryUtil.input_targetSpecific(spell, choices, message, Command.Blank, targeted, free);
}
// CardList choices are the only cards the user can successful select
@@ -1820,7 +1837,7 @@ public class CardFactoryUtil {
*/
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
final Command paid, final boolean targeted, final boolean free) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = -1779224307654698954L;
@Override
@@ -1831,21 +1848,21 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
- if (targeted && !canTarget(spell, card)) {
+ if (targeted && !CardFactoryUtil.canTarget(spell, card)) {
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
} else if (choices.contains(card)) {
spell.setTargetCard(card);
if (spell.getManaCost().equals("0") || free) {
this.setFree(false);
AllZone.getStack().add(spell);
- stop();
+ this.stop();
} else {
- stopSetNext(new Input_PayManaCost(spell));
+ this.stopSetNext(new Input_PayManaCost(spell));
}
paid.execute();
@@ -1877,7 +1894,7 @@ public class CardFactoryUtil {
*/
public static Input input_targetChampionSac(final Card crd, final SpellAbility spell, final CardList choices,
final String message, final boolean targeted, final boolean free) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = -3320425330743678663L;
@Override
@@ -1889,7 +1906,7 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
AllZone.getGameAction().sacrifice(crd);
- stop();
+ this.stop();
}
@Override
@@ -1897,15 +1914,15 @@ public class CardFactoryUtil {
if (choices.contains(card)) {
if (card == spell.getSourceCard()) {
AllZone.getGameAction().sacrifice(spell.getSourceCard());
- stop();
+ this.stop();
} else {
spell.getSourceCard().setChampionedCard(card);
AllZone.getGameAction().exile(card);
- stop();
+ this.stop();
// Run triggers
- HashMap runParams = new HashMap();
+ final HashMap runParams = new HashMap();
runParams.put("Card", spell.getSourceCard());
runParams.put("Championed", card);
AllZone.getTriggerHandler().runTrigger("Championed", runParams);
@@ -1926,15 +1943,16 @@ public class CardFactoryUtil {
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_equipCreature(final SpellAbility equip) {
- Input runtime = new Input() {
+ final Input runtime = new Input() {
private static final long serialVersionUID = 2029801495067540196L;
@Override
public void showMessage() {
// get all creatures you control
- CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
+ final CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
- stopSetNext(input_targetSpecific(equip, list, "Select target creature to equip", true, false));
+ this.stopSetNext(CardFactoryUtil.input_targetSpecific(equip, list, "Select target creature to equip",
+ true, false));
}
}; // Input
return runtime;
@@ -1952,14 +1970,14 @@ public class CardFactoryUtil {
* @return input
*/
public static Input input_discardRecall(final int numCards, final Card recall, final SpellAbility sa) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = 1942999595292561944L;
int n = 0;
@Override
public void showMessage() {
if (AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0) {
- stop();
+ this.stop();
}
AllZone.getDisplay().showMessage("Select a card to discard");
@@ -1970,13 +1988,13 @@ public class CardFactoryUtil {
public void selectCard(final Card card, final PlayerZone zone) {
if (zone.is(Constant.Zone.Hand)) {
card.getController().discard(card, sa);
- n++;
+ this.n++;
// in case no more cards in hand
- if (n == numCards || AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0) {
- done();
+ if ((this.n == numCards) || (AllZone.getHumanPlayer().getZone(Zone.Hand).size() == 0)) {
+ this.done();
} else {
- showMessage();
+ this.showMessage();
}
}
}
@@ -1984,18 +2002,18 @@ public class CardFactoryUtil {
void done() {
AllZone.getDisplay().showMessage("Returning cards to hand.");
AllZone.getGameAction().exile(recall);
- CardList grave = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
- for (int i = 1; i <= n; i++) {
- String title = "Return card from grave to hand";
- Object o = GuiUtils.getChoice(title, grave.toArray());
+ final CardList grave = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
+ for (int i = 1; i <= this.n; i++) {
+ final String title = "Return card from grave to hand";
+ final Object o = GuiUtils.getChoice(title, grave.toArray());
if (o == null) {
break;
}
- Card toHand = (Card) o;
+ final Card toHand = (Card) o;
grave.remove(toHand);
AllZone.getGameAction().moveToHand(toHand);
}
- stop();
+ this.stop();
}
};
return target;
@@ -2016,7 +2034,7 @@ public class CardFactoryUtil {
*/
public static Input MasteroftheWildHunt_input_targetCreature(final SpellAbility spell, final CardList choices,
final Command paid) {
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = -1779224307654698954L;
@Override
@@ -2027,18 +2045,18 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (choices.size() == 0) {
- stop();
+ this.stop();
}
if (choices.contains(card)) {
spell.setTargetCard(card);
paid.execute();
- stop();
+ this.stop();
}
} // selectCard()
};
@@ -2057,7 +2075,7 @@ public class CardFactoryUtil {
* @return a {@link forge.gui.input.Input} object.
*/
public static Input modularInput(final SpellAbility ability, final Card card) {
- Input modularInput = new Input() {
+ final Input modularInput = new Input() {
private static final long serialVersionUID = 2322926875771867901L;
@@ -2069,7 +2087,7 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
@@ -2080,7 +2098,7 @@ public class CardFactoryUtil {
ability.setStackDescription("Put " + card.getCounters(Counters.P1P1) + " +1/+1 counter/s from "
+ card + " on " + card2);
AllZone.getStack().add(ability);
- stop();
+ this.stop();
}
}
};
@@ -2122,9 +2140,10 @@ public class CardFactoryUtil {
public static CardList AI_getHumanCreature(final String keyword, final Card spell, final boolean targeted) {
CardList creature = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
creature = creature.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
if (targeted) {
- return c.isCreature() && c.hasKeyword(keyword) && canTarget(spell, c);
+ return c.isCreature() && c.hasKeyword(keyword) && CardFactoryUtil.canTarget(spell, c);
} else {
return c.isCreature() && c.hasKeyword(keyword);
}
@@ -2149,9 +2168,10 @@ public class CardFactoryUtil {
public static CardList AI_getHumanCreature(final int toughness, final Card spell, final boolean targeted) {
CardList creature = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
creature = creature.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
if (targeted) {
- return c.isCreature() && (c.getNetDefense() <= toughness) && canTarget(spell, c);
+ return c.isCreature() && (c.getNetDefense() <= toughness) && CardFactoryUtil.canTarget(spell, c);
} else {
return c.isCreature() && (c.getNetDefense() <= toughness);
}
@@ -2171,8 +2191,9 @@ public class CardFactoryUtil {
return new CommandArgs() {
private static final long serialVersionUID = 8406907523134006697L;
+ @Override
public void execute(final Object o) {
- SpellAbility sa = (SpellAbility) o;
+ final SpellAbility sa = (SpellAbility) o;
sa.setTargetPlayer(AllZone.getHumanPlayer());
}
};
@@ -2188,9 +2209,9 @@ public class CardFactoryUtil {
* @return a int.
*/
public static int getNumberOfPermanentsByColor(final String color) {
- CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield);
- CardList coloredPerms = new CardList();
+ final CardList coloredPerms = new CardList();
for (int i = 0; i < cards.size(); i++) {
if (CardUtil.getColors(cards.get(i)).contains(color)) {
@@ -2210,7 +2231,7 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean multipleControlled(final Card c) {
- CardList list = c.getController().getCardsIn(Zone.Battlefield);
+ final CardList list = c.getController().getCardsIn(Zone.Battlefield);
list.remove(c);
return list.containsName(c.getName());
@@ -2226,9 +2247,10 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean oppHasKismet(final Player player) {
- Player opp = player.getOpponent();
+ final Player opp = player.getOpponent();
CardList list = opp.getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.getName().equals("Kismet") || c.getName().equals("Frozen AEther")
|| c.getName().equals("Loxodon Gatekeeper");
@@ -2249,8 +2271,8 @@ public class CardFactoryUtil {
* @return a int.
*/
public static int getNumberOfManaSymbolsControlledByColor(final String colorAbb, final Player player) {
- CardList cards = player.getCardsIn(Zone.Battlefield);
- return getNumberOfManaSymbolsByColor(colorAbb, cards);
+ final CardList cards = player.getCardsIn(Zone.Battlefield);
+ return CardFactoryUtil.getNumberOfManaSymbolsByColor(colorAbb, cards);
}
/**
@@ -2267,11 +2289,11 @@ public class CardFactoryUtil {
public static int getNumberOfManaSymbolsByColor(final String colorAbb, final CardList cards) {
int count = 0;
for (int i = 0; i < cards.size(); i++) {
- Card c = cards.get(i);
+ final Card c = cards.get(i);
if (!c.isToken()) {
String manaCost = c.getManaCost();
manaCost = manaCost.trim();
- count += countOccurrences(manaCost, colorAbb);
+ count += CardFactoryUtil.countOccurrences(manaCost, colorAbb);
}
}
return count;
@@ -2296,13 +2318,13 @@ public class CardFactoryUtil {
return manacost;
}
- String[] tokenized = manacost.split("\\s");
- StringBuilder sb = new StringBuilder();
+ final String[] tokenized = manacost.split("\\s");
+ final StringBuilder sb = new StringBuilder();
- if (Character.isDigit(tokenized[0].charAt(0))) // manacost starts with
- // "colorless" number
- // cost
- {
+ if (Character.isDigit(tokenized[0].charAt(0))) {
+ // manacost starts with
+ // "colorless" number
+ // cost
int cost = Integer.parseInt(tokenized[0]);
cost = multiplier * cost;
tokenized[0] = "" + cost;
@@ -2347,8 +2369,8 @@ public class CardFactoryUtil {
return false; // for tokens that disappeared
}
- Card source = ability.getSourceCard();
- Target tgt = ability.getTarget();
+ final Card source = ability.getSourceCard();
+ final Target tgt = ability.getTarget();
if (tgt != null) {
// Reconfirm the Validity of a TgtValid, or if the Creature is still
// a Creature
@@ -2371,7 +2393,7 @@ public class CardFactoryUtil {
}
// Make sure it's still targetable as well
- return canTarget(source, target);
+ return CardFactoryUtil.canTarget(source, target);
}
/**
@@ -2386,7 +2408,7 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean canTarget(final SpellAbility ability, final Card target) {
- return canTarget(ability.getSourceCard(), target);
+ return CardFactoryUtil.canTarget(ability.getSourceCard(), target);
}
/**
@@ -2422,9 +2444,9 @@ public class CardFactoryUtil {
return false;
}
- PlayerZone zone = AllZone.getZoneOf(target);
+ final PlayerZone zone = AllZone.getZoneOf(target);
// if zone is null, it means its on the stack
- if (zone == null || !zone.is(Constant.Zone.Battlefield)) {
+ if ((zone == null) || !zone.is(Constant.Zone.Battlefield)) {
// targets not in play, can normally be targeted
return true;
}
@@ -2438,12 +2460,12 @@ public class CardFactoryUtil {
return false;
}
- if (hasProtectionFrom(spell, target)) {
+ if (CardFactoryUtil.hasProtectionFrom(spell, target)) {
return false;
}
if (target.getKeyword() != null) {
- ArrayList list = target.getKeyword();
+ final ArrayList list = target.getKeyword();
String kw = "";
for (int i = 0; i < list.size(); i++) {
@@ -2514,7 +2536,7 @@ public class CardFactoryUtil {
}
if (target.getKeyword() != null) {
- ArrayList list = target.getKeyword();
+ final ArrayList list = target.getKeyword();
String kw = "";
for (int i = 0; i < list.size(); i++) {
@@ -2554,7 +2576,7 @@ public class CardFactoryUtil {
}
if (kw.equals("Protection from colored spells")
- && (card.isInstant() || card.isSorcery() || card.isAura()) && isColored(card)) {
+ && (card.isInstant() || card.isSorcery() || card.isAura()) && CardFactoryUtil.isColored(card)) {
return true;
}
@@ -2575,8 +2597,8 @@ public class CardFactoryUtil {
}
if (kw.startsWith("Protection:")) { // uses isValid
- String characteristic = kw.split(":")[1];
- String[] characteristics = characteristic.split(",");
+ final String characteristic = kw.split(":")[1];
+ final String[] characteristics = characteristic.split(",");
if (card.isValid(characteristics, card.getController(), card)) {
return true;
}
@@ -2624,6 +2646,7 @@ public class CardFactoryUtil {
final String equipmentName = e;
CardList list = new CardList(c.getEquippedBy());
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.getName().equals(equipmentName);
}
@@ -2645,7 +2668,7 @@ public class CardFactoryUtil {
*/
public static CardList getExternalZoneActivationCards(final Player player) {
- List sb = new ArrayList(3);
+ final List sb = new ArrayList(3);
sb.add(Constant.Zone.Graveyard);
sb.add(Constant.Zone.Exile);
sb.add(Constant.Zone.Library);
@@ -2653,8 +2676,9 @@ public class CardFactoryUtil {
CardList cl = player.getCardsIn(sb);
cl.addAll(AllZone.getStackZone().getCards());
cl = cl.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return activateFromExternalZones(c, player);
+ return CardFactoryUtil.activateFromExternalZones(c, player);
}
});
return cl;
@@ -2672,7 +2696,7 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean activateFromExternalZones(final Card c, final Player player) {
- PlayerZone zone = AllZone.getZoneOf(c);
+ final PlayerZone zone = AllZone.getZoneOf(c);
if (zone.is(Constant.Zone.Graveyard)) {
if (c.hasFlashback() || c.hasUnearth()) {
return true;
@@ -2684,8 +2708,8 @@ public class CardFactoryUtil {
return true;
}
- for (SpellAbility sa : c.getSpellAbility()) {
- Zone restrictZone = sa.getRestrictions().getZone();
+ for (final SpellAbility sa : c.getSpellAbility()) {
+ final Zone restrictZone = sa.getRestrictions().getZone();
if (zone.is(restrictZone)) {
return true;
}
@@ -2731,7 +2755,7 @@ public class CardFactoryUtil {
* @return an array of {@link java.lang.String} objects.
*/
public static String[] parseMath(final String[] l) {
- String[] m = { "none" };
+ final String[] m = { "none" };
if (l.length > 1) {
m[0] = l[1];
}
@@ -2759,20 +2783,20 @@ public class CardFactoryUtil {
}
final String[] l = s.split("/");
- final String[] m = parseMath(l);
+ final String[] m = CardFactoryUtil.parseMath(l);
int n = 0;
// count valid cards on the battlefield
if (l[0].contains("Valid")) {
- String restrictions = l[0].replace("Valid ", "");
+ final String restrictions = l[0].replace("Valid ", "");
final String[] rest = restrictions.split(",");
CardList cardsonbattlefield = AllZoneUtil.getCardsIn(Zone.Battlefield);
cardsonbattlefield = cardsonbattlefield.getValidCards(rest, players.get(0), source);
n = cardsonbattlefield.size();
- return doXMath(n, m, source);
+ return CardFactoryUtil.doXMath(n, m, source);
}
final String[] sq;
@@ -2780,52 +2804,54 @@ public class CardFactoryUtil {
if (sq[0].contains("CardsInHand")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Hand).size(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Hand).size(), m, source);
}
}
if (sq[0].contains("CardsInLibrary")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Library).size(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Library).size(), m, source);
}
}
if (sq[0].contains("CardsInGraveyard")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Graveyard).size(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Graveyard).size(), m, source);
}
}
if (sq[0].contains("LandsInGraveyard")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Graveyard).getType("Land").size(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Graveyard).getType("Land").size(), m,
+ source);
}
}
if (sq[0].contains("CreaturesInPlay")) {
if (players.size() > 0) {
- return doXMath(AllZoneUtil.getCreaturesInPlay(players.get(0)).size(), m, source);
+ return CardFactoryUtil.doXMath(AllZoneUtil.getCreaturesInPlay(players.get(0)).size(), m, source);
}
}
if (sq[0].contains("CardsInPlay")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Battlefield).size(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Battlefield).size(), m, source);
}
}
if (sq[0].contains("LifeTotal")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getLife(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getLife(), m, source);
}
}
if (sq[0].contains("TopOfLibraryCMC")) {
if (players.size() > 0) {
- return doXMath(players.get(0).getCardsIn(Zone.Library, 1).getTotalConvertedManaCost(), m, source);
+ return CardFactoryUtil.doXMath(players.get(0).getCardsIn(Zone.Library, 1).getTotalConvertedManaCost(),
+ m, source);
}
}
- return doXMath(n, m, source);
+ return CardFactoryUtil.doXMath(n, m, source);
}
/**
@@ -2845,8 +2871,8 @@ public class CardFactoryUtil {
try {
num = Integer.valueOf(amount);
- } catch (NumberFormatException e) {
- num = xCount(hostCard, hostCard.getSVar(amount).split("\\$")[1]);
+ } catch (final NumberFormatException e) {
+ num = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(amount).split("\\$")[1]);
}
return num;
@@ -2867,35 +2893,35 @@ public class CardFactoryUtil {
public static int xCount(final Card c, final String s) {
int n = 0;
- Player cardController = c.getController();
- Player oppController = cardController.getOpponent();
+ final Player cardController = c.getController();
+ final Player oppController = cardController.getOpponent();
final String[] l = s.split("/");
- final String[] m = parseMath(l);
+ final String[] m = CardFactoryUtil.parseMath(l);
// count total number of aura enchanting card that aura is attached to
if (l[0].contains("AllAurasEnchanting")) {
int numAuras = 0;
- Card aura = c.getEnchantingCard();
+ final Card aura = c.getEnchantingCard();
if (aura != null) {
numAuras = aura.getEnchantedBy().size();
}
- return doXMath(numAuras, m, c);
+ return CardFactoryUtil.doXMath(numAuras, m, c);
}
// accept straight numbers
if (l[0].contains("Number$")) {
- String number = l[0].replace("Number$", "");
+ final String number = l[0].replace("Number$", "");
if (number.equals("ChosenNumber")) {
- return doXMath(c.getChosenNumber(), m, c);
+ return CardFactoryUtil.doXMath(c.getChosenNumber(), m, c);
} else {
- return doXMath(Integer.parseInt(number), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(number), m, c);
}
}
// Manapool
if (l[0].contains("ManaPool")) {
- String color = l[0].split(":")[1];
+ final String color = l[0].split(":")[1];
return AllZone.getHumanPlayer().getManaPool().getAmountOfColor(color);
}
@@ -2909,7 +2935,7 @@ public class CardFactoryUtil {
n = cardsonbattlefield.size();
- return doXMath(n, m, c);
+ return CardFactoryUtil.doXMath(n, m, c);
}
if (l[0].contains("ImprintedCardPower")) {
@@ -2924,9 +2950,9 @@ public class CardFactoryUtil {
}
if (l[0].contains("GreatestPowerYouControl")) {
- CardList list = AllZoneUtil.getCreaturesInPlay(c.getController());
+ final CardList list = AllZoneUtil.getCreaturesInPlay(c.getController());
int highest = 0;
- for (Card crd : list) {
+ for (final Card crd : list) {
if (crd.getNetAttack() > highest) {
highest = crd.getNetAttack();
}
@@ -2935,8 +2961,8 @@ public class CardFactoryUtil {
}
if (l[0].contains("RememberedSumPower")) {
- CardList list = new CardList();
- for (Object o : c.getRemembered()) {
+ final CardList list = new CardList();
+ for (final Object o : c.getRemembered()) {
if (o instanceof Card) {
list.add(AllZoneUtil.getCardState((Card) o));
}
@@ -2948,7 +2974,7 @@ public class CardFactoryUtil {
sq = l[0].split("\\.");
if (sq[0].contains("xPaid")) {
- return doXMath(c.getXManaCostPaid(), m, c);
+ return CardFactoryUtil.doXMath(c.getXManaCostPaid(), m, c);
}
if (sq[0].contains("xLifePaid")) {
@@ -2966,11 +2992,11 @@ public class CardFactoryUtil {
}
if (sq[0].equals("StormCount")) {
- return doXMath(AllZone.getStack().getCardsCastThisTurn().size() - 1, m, c);
+ return CardFactoryUtil.doXMath(AllZone.getStack().getCardsCastThisTurn().size() - 1, m, c);
}
if (sq[0].equals("DamageDoneThisTurn")) {
- return doXMath(c.getDamageDoneThisTurn(), m, c);
+ return CardFactoryUtil.doXMath(c.getDamageDoneThisTurn(), m, c);
}
CardList someCards = new CardList();
@@ -2979,13 +3005,13 @@ public class CardFactoryUtil {
// TriggeringObjects
if (sq[0].startsWith("Triggered")) {
- return doXMath((Integer) c.getTriggeringObject(sq[0].substring(9)), m, c);
+ return CardFactoryUtil.doXMath((Integer) c.getTriggeringObject(sq[0].substring(9)), m, c);
}
// Count$Domain
if (sq[0].contains("Domain")) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
- String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" };
+ final String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" };
for (int i = 0; i < basic.length; i++) {
if (!someCards.getType(basic[i]).isEmpty()) {
@@ -2993,15 +3019,15 @@ public class CardFactoryUtil {
}
}
- return doXMath(n, m, c);
+ return CardFactoryUtil.doXMath(n, m, c);
}
// Count$YourLifeTotal
if (sq[0].contains("YourLifeTotal")) {
if (cardController.isComputer()) {
- return doXMath(AllZone.getComputerPlayer().getLife(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getComputerPlayer().getLife(), m, c);
} else if (cardController.isHuman()) {
- return doXMath(AllZone.getHumanPlayer().getLife(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getHumanPlayer().getLife(), m, c);
}
return 0;
@@ -3010,9 +3036,9 @@ public class CardFactoryUtil {
// Count$OppLifeTotal
if (sq[0].contains("OppLifeTotal")) {
if (oppController.isComputer()) {
- return doXMath(AllZone.getComputerPlayer().getLife(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getComputerPlayer().getLife(), m, c);
} else if (oppController.isHuman()) {
- return doXMath(AllZone.getHumanPlayer().getLife(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getHumanPlayer().getLife(), m, c);
}
return 0;
@@ -3021,9 +3047,9 @@ public class CardFactoryUtil {
// Count$YourPoisonCounters
if (sq[0].contains("YourPoisonCounters")) {
if (cardController.isComputer()) {
- return doXMath(AllZone.getComputerPlayer().getPoisonCounters(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getComputerPlayer().getPoisonCounters(), m, c);
} else if (cardController.isHuman()) {
- return doXMath(AllZone.getHumanPlayer().getPoisonCounters(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getHumanPlayer().getPoisonCounters(), m, c);
}
return 0;
@@ -3032,9 +3058,9 @@ public class CardFactoryUtil {
// Count$OppPoisonCounters
if (sq[0].contains("OppPoisonCounters")) {
if (oppController.isComputer()) {
- return doXMath(AllZone.getComputerPlayer().getPoisonCounters(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getComputerPlayer().getPoisonCounters(), m, c);
} else if (oppController.isHuman()) {
- return doXMath(AllZone.getHumanPlayer().getPoisonCounters(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getHumanPlayer().getPoisonCounters(), m, c);
}
return 0;
@@ -3042,12 +3068,12 @@ public class CardFactoryUtil {
// Count$OppDamageThisTurn
if (sq[0].contains("OppDamageThisTurn")) {
- return doXMath(c.getController().getOpponent().getAssignedDamage(), m, c);
+ return CardFactoryUtil.doXMath(c.getController().getOpponent().getAssignedDamage(), m, c);
}
// Count$YourDamageThisTurn
if (sq[0].contains("YourDamageThisTurn")) {
- return doXMath(c.getController().getAssignedDamage(), m, c);
+ return CardFactoryUtil.doXMath(c.getController().getAssignedDamage(), m, c);
}
// Count$HighestLifeTotal
@@ -3062,8 +3088,8 @@ public class CardFactoryUtil {
// Count$TopOfLibraryCMC
if (sq[0].contains("TopOfLibraryCMC")) {
- CardList topcard = cardController.getCardsIn(Zone.Library, 1);
- return doXMath(topcard.getTotalConvertedManaCost(), m, c);
+ final CardList topcard = cardController.getCardsIn(Zone.Library, 1);
+ return CardFactoryUtil.doXMath(topcard.getTotalConvertedManaCost(), m, c);
}
// Count$EnchantedControllerCreatures
@@ -3081,49 +3107,55 @@ public class CardFactoryUtil {
// Count$Chroma.
if (sq[0].contains("Chroma")) {
- return doXMath(getNumberOfManaSymbolsControlledByColor(sq[1], cardController), m, c);
+ return CardFactoryUtil.doXMath(
+ CardFactoryUtil.getNumberOfManaSymbolsControlledByColor(sq[1], cardController), m, c);
}
// Count$Hellbent..
if (sq[0].contains("Hellbent")) {
if (cardController.hasHellbent()) {
- return doXMath(Integer.parseInt(sq[1]), m, c); // Hellbent
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); // Hellbent
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c); // not Hellbent
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); // not
+ // Hellbent
}
}
// Count$Metalcraft..
if (sq[0].contains("Metalcraft")) {
if (cardController.hasMetalcraft()) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
}
}
if (sq[0].contains("Threshold")) {
if (cardController.hasThreshold()) {
- return doXMath(Integer.parseInt(sq[1]), m, c); // Have Threshold
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); // Have
+ // Threshold
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c); // not Threshold
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); // not
+ // Threshold
}
}
if (sq[0].contains("Landfall")) {
if (cardController.hasLandfall()) {
- return doXMath(Integer.parseInt(sq[1]), m, c); // Have Landfall
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); // Have
+ // Landfall
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c); // not Landfall
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); // not
+ // Landfall
}
}
if (sq[0].contains("GraveyardWithGE20Cards")) {
if (Math.max(AllZone.getHumanPlayer().getZone(Zone.Graveyard).size(),
AllZone.getComputerPlayer().getZone(Zone.Graveyard).size()) >= 20) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
}
}
@@ -3133,58 +3165,61 @@ public class CardFactoryUtil {
CardList cl = c.getDevoured();
cl = cl.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card cdev) {
return cdev.isValid(validDevoured.split(","), csource.getController(), csource);
}
});
- return doXMath(cl.size(), m, c);
+ return CardFactoryUtil.doXMath(cl.size(), m, c);
}
// Count$CardPower
if (sq[0].contains("CardPower")) {
- return doXMath(c.getNetAttack(), m, c);
+ return CardFactoryUtil.doXMath(c.getNetAttack(), m, c);
}
// Count$CardToughness
if (sq[0].contains("CardToughness")) {
- return doXMath(c.getNetDefense(), m, c);
+ return CardFactoryUtil.doXMath(c.getNetDefense(), m, c);
}
// Count$CardPowerPlusToughness
if (sq[0].contains("CardSumPT")) {
- return doXMath((c.getNetAttack() + c.getNetDefense()), m, c);
+ return CardFactoryUtil.doXMath((c.getNetAttack() + c.getNetDefense()), m, c);
}
// Count$CardManaCost
if (sq[0].contains("CardManaCost")) {
- return doXMath(CardUtil.getConvertedManaCost(c), m, c);
+ return CardFactoryUtil.doXMath(CardUtil.getConvertedManaCost(c), m, c);
}
// Count$ChosenNumber
if (sq[0].contains("ChosenNumber")) {
- return doXMath(c.getChosenNumber(), m, c);
+ return CardFactoryUtil.doXMath(c.getChosenNumber(), m, c);
}
// Count$CardCounters.
if (sq[0].contains("CardCounters")) {
- return doXMath(c.getCounters(Counters.getType(sq[1])), m, c);
+ return CardFactoryUtil.doXMath(c.getCounters(Counters.getType(sq[1])), m, c);
}
// Count$TimesKicked
if (sq[0].contains("TimesKicked")) {
- return doXMath(c.getMultiKickerMagnitude(), m, c);
+ return CardFactoryUtil.doXMath(c.getMultiKickerMagnitude(), m, c);
}
if (sq[0].contains("NumCounters")) {
- int num = c.getCounters(Counters.getType(sq[1]));
- return doXMath(num, m, c);
+ final int num = c.getCounters(Counters.getType(sq[1]));
+ return CardFactoryUtil.doXMath(num, m, c);
}
if (sq[0].contains("NumBlockingMe")) {
- return doXMath(AllZone.getCombat().getBlockers(c).size(), m, c);
+ return CardFactoryUtil.doXMath(AllZone.getCombat().getBlockers(c).size(), m, c);
}
// Count$IfMainPhase.. // 7/10
if (sq[0].contains("IfMainPhase")) {
- String cPhase = AllZone.getPhase().getPhase();
+ final String cPhase = AllZone.getPhase().getPhase();
if ((cPhase.equals(Constant.Phase.Main1) || cPhase.equals(Constant.Phase.Main2))
&& AllZone.getPhase().getPlayerTurn().equals(cardController)) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c); // not Main Phase
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); // not
+ // Main
+ // Phase
}
}
@@ -3194,9 +3229,9 @@ public class CardFactoryUtil {
has &= AllZoneUtil.isCardInPlay("Scepter of Empires", c.getController());
has &= AllZoneUtil.isCardInPlay("Throne of Empires", c.getController());
if (has) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
}
}
@@ -3204,7 +3239,7 @@ public class CardFactoryUtil {
// or
// Count$ThisTurnEntered
if (sq[0].contains("ThisTurnEntered")) {
- String[] workingCopy = l[0].split(" ");
+ final String[] workingCopy = l[0].split(" ");
Zone destination, origin;
String validFilter;
@@ -3217,17 +3252,17 @@ public class CardFactoryUtil {
validFilter = workingCopy[2];
}
- CardList res = CardUtil.getThisTurnEntered(destination, origin, validFilter, c);
+ final CardList res = CardUtil.getThisTurnEntered(destination, origin, validFilter, c);
- return doXMath(res.size(), m, c);
+ return CardFactoryUtil.doXMath(res.size(), m, c);
}
// Count$ThisTurnCast
// Count$LastTurnCast
if (sq[0].contains("ThisTurnCast") || sq[0].contains("LastTurnCast")) {
- String[] workingCopy = l[0].split(" ");
- String validFilter = workingCopy[1];
+ final String[] workingCopy = l[0].split(" ");
+ final String validFilter = workingCopy[1];
CardList res;
@@ -3237,17 +3272,17 @@ public class CardFactoryUtil {
res = CardUtil.getLastTurnCast(validFilter, c);
}
- int ret = doXMath(res.size(), m, c);
+ final int ret = CardFactoryUtil.doXMath(res.size(), m, c);
return ret;
}
// Count$Morbid..
if (sq[0].startsWith("Morbid")) {
- CardList res = CardUtil.getThisTurnEntered(Zone.Graveyard, Zone.Battlefield, "Creature", c);
+ final CardList res = CardUtil.getThisTurnEntered(Zone.Graveyard, Zone.Battlefield, "Creature", c);
if (res.size() > 0) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
}
}
@@ -3262,77 +3297,77 @@ public class CardFactoryUtil {
boolean OF = false, OY = false, OH = false;
if (sq[0].contains("YouCtrl")) {
- if (MF == false) {
+ if (!MF) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
MF = true;
}
}
if (sq[0].contains("InYourYard")) {
- if (MY == false) {
+ if (!MY) {
someCards.addAll(cardController.getCardsIn(Zone.Graveyard));
MY = true;
}
}
if (sq[0].contains("InYourLibrary")) {
- if (MY == false) {
+ if (!MY) {
someCards.addAll(cardController.getCardsIn(Zone.Library));
MY = true;
}
}
if (sq[0].contains("InYourHand")) {
- if (MH == false) {
+ if (!MH) {
someCards.addAll(cardController.getCardsIn(Zone.Hand));
MH = true;
}
}
if (sq[0].contains("OppCtrl")) {
- if (OF == false) {
+ if (!OF) {
someCards.addAll(oppController.getCardsIn(Zone.Battlefield));
OF = true;
}
}
if (sq[0].contains("InOppYard")) {
- if (OY == false) {
+ if (!OY) {
someCards.addAll(oppController.getCardsIn(Zone.Graveyard));
OY = true;
}
}
if (sq[0].contains("InOppHand")) {
- if (OH == false) {
+ if (!OH) {
someCards.addAll(oppController.getCardsIn(Zone.Hand));
OH = true;
}
}
if (sq[0].contains("OnBattlefield")) {
- if (MF == false) {
+ if (!MF) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
}
- if (OF == false) {
+ if (!OF) {
someCards.addAll(oppController.getCardsIn(Zone.Battlefield));
}
}
if (sq[0].contains("InAllYards")) {
- if (MY == false) {
+ if (!MY) {
someCards.addAll(cardController.getCardsIn(Zone.Graveyard));
}
- if (OY == false) {
+ if (!OY) {
someCards.addAll(oppController.getCardsIn(Zone.Graveyard));
}
}
if (sq[0].contains("InAllHands")) {
- if (MH == false) {
+ if (!MH) {
someCards.addAll(cardController.getCardsIn(Zone.Hand));
}
- if (OH == false) {
+ if (!OH) {
someCards.addAll(oppController.getCardsIn(Zone.Hand));
}
}
@@ -3342,6 +3377,7 @@ public class CardFactoryUtil {
// "Clerics you control" - Count$TypeYouCtrl.Cleric
if (sq[0].contains("Type")) {
someCards = someCards.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
if (c.isType(sq[1])) {
return true;
@@ -3360,6 +3396,7 @@ public class CardFactoryUtil {
}
someCards = someCards.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
if (c.getName().equals(sq[1])) {
return true;
@@ -3404,6 +3441,7 @@ public class CardFactoryUtil {
if (sq[0].contains("Multicolor")) {
someCards = someCards.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return (CardUtil.getColors(c).size() > 1);
}
@@ -3412,6 +3450,7 @@ public class CardFactoryUtil {
if (sq[0].contains("Monocolor")) {
someCards = someCards.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return (CardUtil.getColors(c).size() == 1);
}
@@ -3421,9 +3460,9 @@ public class CardFactoryUtil {
// Count$CardMulticolor..
if (sq[0].contains("CardMulticolor")) {
if (CardUtil.getColors(c).size() > 1) {
- return doXMath(Integer.parseInt(sq[1]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
- return doXMath(Integer.parseInt(sq[2]), m, c);
+ return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
}
}
@@ -3438,12 +3477,12 @@ public class CardFactoryUtil {
}
}
- return doXMath(mmc, m, c);
+ return CardFactoryUtil.doXMath(mmc, m, c);
}
n = someCards.size();
- return doXMath(n, m, c);
+ return CardFactoryUtil.doXMath(n, m, c);
}
private static int doXMath(final int num, final String m, final Card c) {
@@ -3451,15 +3490,15 @@ public class CardFactoryUtil {
return num;
}
- String[] s = m.split("\\.");
+ final String[] s = m.split("\\.");
int secondaryNum = 0;
try {
if (s.length == 2) {
secondaryNum = Integer.parseInt(s[1]);
}
- } catch (Exception e) {
- secondaryNum = xCount(c, c.getSVar(s[1]));
+ } catch (final Exception e) {
+ secondaryNum = CardFactoryUtil.xCount(c, c.getSVar(s[1]));
}
if (s[0].contains("Plus")) {
@@ -3505,7 +3544,7 @@ public class CardFactoryUtil {
return num;
}
- return doXMath(num, m[0], c);
+ return CardFactoryUtil.doXMath(num, m[0], c);
}
/**
@@ -3528,8 +3567,8 @@ public class CardFactoryUtil {
if (string.startsWith("Amount")) {
if (string.contains(".")) {
- String[] splitString = string.split("\\.", 2);
- return doXMath(paidList.size(), splitString[1], source);
+ final String[] splitString = string.split("\\.", 2);
+ return CardFactoryUtil.doXMath(paidList.size(), splitString[1], source);
} else {
return paidList.size();
}
@@ -3545,13 +3584,13 @@ public class CardFactoryUtil {
if (l.length > 1) {
m[0] = l[1];
}
- CardList list = paidList.getValidCards(valid, source.getController(), source);
- return doXMath(list.size(), m, source);
+ final CardList list = paidList.getValidCards(valid, source.getController(), source);
+ return CardFactoryUtil.doXMath(list.size(), m, source);
}
int tot = 0;
- for (Card c : paidList) {
- tot += xCount(c, string);
+ for (final Card c : paidList) {
+ tot += CardFactoryUtil.xCount(c, string);
}
return tot;
@@ -3569,7 +3608,7 @@ public class CardFactoryUtil {
* @return a {@link forge.gui.input.Input} object.
*/
public static Input input_UntapUpToNType(final int n, final String type) {
- Input untap = new Input() {
+ final Input untap = new Input() {
private static final long serialVersionUID = -2167059918040912025L;
int stop = n;
@@ -3583,16 +3622,16 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (card.isType(type) && zone.is(Constant.Zone.Battlefield)) {
card.untap();
- count++;
- if (count == stop) {
- stop();
+ this.count++;
+ if (this.count == this.stop) {
+ this.stop();
}
}
} // selectCard()
@@ -3616,12 +3655,12 @@ public class CardFactoryUtil {
return "";
}
- Map map = new HashMap();
+ final Map map = new HashMap();
- for (Card c : list) {
- ArrayList typeList = c.getType();
+ for (final Card c : list) {
+ final ArrayList typeList = c.getType();
- for (String var : typeList) {
+ for (final String var : typeList) {
if (CardUtil.isACreatureType(var)) {
if (!map.containsKey(var)) {
map.put(var, 1);
@@ -3635,8 +3674,8 @@ public class CardFactoryUtil {
int max = 0;
String maxType = "";
- for (Entry entry : map.entrySet()) {
- String type = entry.getKey();
+ for (final Entry entry : map.entrySet()) {
+ final String type = entry.getKey();
// Log.debug(type + " - " + entry.getValue());
if (max < entry.getValue()) {
@@ -3659,12 +3698,12 @@ public class CardFactoryUtil {
*/
public static String getMostProminentColor(final CardList list) {
- Map map = new HashMap();
+ final Map map = new HashMap();
- for (Card c : list) {
- ArrayList colorList = CardUtil.getColors(c);
+ for (final Card c : list) {
+ final ArrayList colorList = CardUtil.getColors(c);
- for (String color : colorList) {
+ for (final String color : colorList) {
if (color.equals("colorless")) {
// nothing to do
} else if (!map.containsKey(color)) {
@@ -3678,8 +3717,8 @@ public class CardFactoryUtil {
int max = 0;
String maxColor = "";
- for (Entry entry : map.entrySet()) {
- String color = entry.getKey();
+ for (final Entry entry : map.entrySet()) {
+ final String color = entry.getKey();
Log.debug(color + " - " + entry.getValue());
if (max < entry.getValue()) {
@@ -3705,19 +3744,20 @@ public class CardFactoryUtil {
public static String getPropagandaCost(final Card c) {
int cost = 0;
- CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
- for (Card card : list) {
+ final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ for (final Card card : list) {
if (card.hasStartOfKeyword("Creatures can't attack unless their controller pays")) {
- int keywordPosition = card.getKeywordPosition("Creatures can't attack unless their controller pays");
- String parse = card.getKeyword().get(keywordPosition).toString();
- String[] k = parse.split(":");
+ final int keywordPosition = card
+ .getKeywordPosition("Creatures can't attack unless their controller pays");
+ final String parse = card.getKeyword().get(keywordPosition).toString();
+ final String[] k = parse.split(":");
- String[] restrictions = k[1].split(",");
+ final String[] restrictions = k[1].split(",");
if (!c.isValid(restrictions, card.getController(), card)) {
continue;
}
- String costString = k[2];
+ final String costString = k[2];
if (costString.equals("X")) {
cost += CardFactoryUtil.xCount(card, card.getSVar("X"));
} else if (costString.equals("Y")) {
@@ -3728,7 +3768,7 @@ public class CardFactoryUtil {
}
}
- String s = Integer.toString(cost);
+ final String s = Integer.toString(cost);
return s;
}
@@ -3745,8 +3785,9 @@ public class CardFactoryUtil {
public static int getUsableManaSources(final Player player) {
CardList list = player.getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- for (Ability_Mana am : c.getAIPlayableMana()) {
+ for (final Ability_Mana am : c.getAIPlayableMana()) {
if (am.canPlay()) {
return true;
}
@@ -3768,8 +3809,8 @@ public class CardFactoryUtil {
* @return a {@link forge.CardList} object.
*/
public static CardList makeTokenSaproling(final Player controller) {
- return makeToken("Saproling", "G 1 1 Saproling", controller, "G", new String[] { "Creature", "Saproling" }, 1,
- 1, new String[] { "" });
+ return CardFactoryUtil.makeToken("Saproling", "G 1 1 Saproling", controller, "G", new String[] { "Creature",
+ "Saproling" }, 1, 1, new String[] { "" });
}
/**
@@ -3798,8 +3839,8 @@ public class CardFactoryUtil {
public static CardList makeToken(final String name, final String imageName, final Player controller,
final String manaCost, final String[] types, final int baseAttack, final int baseDefense,
final String[] intrinsicKeywords) {
- CardList list = new CardList();
- Card c = new Card();
+ final CardList list = new CardList();
+ final Card c = new Card();
c.setName(name);
c.setImageName(imageName);
@@ -3811,14 +3852,14 @@ public class CardFactoryUtil {
c.addColor(manaCost);
c.setToken(true);
- for (String t : types) {
+ for (final String t : types) {
c.addType(t);
}
c.setBaseAttack(baseAttack);
c.setBaseDefense(baseDefense);
- for (String kw : intrinsicKeywords) {
+ for (final String kw : intrinsicKeywords) {
if (kw.startsWith("HIDDEN")) {
c.addExtrinsicKeyword(kw);
} else {
@@ -3826,7 +3867,7 @@ public class CardFactoryUtil {
}
}
- int multiplier = AllZoneUtil.getTokenDoublersMagnitude(controller);
+ final int multiplier = AllZoneUtil.getTokenDoublersMagnitude(controller);
// TODO - does this need to set
// PlayerZone_ComesIntoPlay.SimultaneousEntry like Rite of Replication
// does?
@@ -3852,23 +3893,23 @@ public class CardFactoryUtil {
* @return a {@link forge.CardList} object.
*/
public static CardList copyTokens(final CardList tokenList) {
- CardList list = new CardList();
+ final CardList list = new CardList();
for (int tokenAdd = 0; tokenAdd < tokenList.size(); tokenAdd++) {
- Card thisToken = tokenList.getCard(tokenAdd);
+ final Card thisToken = tokenList.getCard(tokenAdd);
- ArrayList tal = thisToken.getType();
- String[] tokenTypes = new String[tal.size()];
+ final ArrayList tal = thisToken.getType();
+ final String[] tokenTypes = new String[tal.size()];
tal.toArray(tokenTypes);
- ArrayList kal = thisToken.getIntrinsicKeyword();
- String[] tokenKeywords = new String[kal.size()];
+ final ArrayList kal = thisToken.getIntrinsicKeyword();
+ final String[] tokenKeywords = new String[kal.size()];
kal.toArray(tokenKeywords);
- CardList tokens = makeToken(thisToken.getName(), thisToken.getImageName(), thisToken.getController(),
- thisToken.getManaCost(), tokenTypes, thisToken.getBaseAttack(), thisToken.getBaseDefense(),
- tokenKeywords);
+ final CardList tokens = CardFactoryUtil.makeToken(thisToken.getName(), thisToken.getImageName(),
+ thisToken.getController(), thisToken.getManaCost(), tokenTypes, thisToken.getBaseAttack(),
+ thisToken.getBaseDefense(), tokenKeywords);
- for (Card token : tokens) {
+ for (final Card token : tokens) {
token.setColor(thisToken.getColor());
}
@@ -3888,24 +3929,25 @@ public class CardFactoryUtil {
* @return a {@link java.util.ArrayList} object.
*/
public static ArrayList getBushidoEffects(final Card c) {
- ArrayList keywords = c.getKeyword();
- ArrayList list = new ArrayList();
+ final ArrayList keywords = c.getKeyword();
+ final ArrayList list = new ArrayList();
final Card crd = c;
- for (String kw : keywords) {
+ for (final String kw : keywords) {
if (kw.contains("Bushido")) {
- String[] parse = kw.split(" ");
- String s = parse[1];
+ final String[] parse = kw.split(" ");
+ final String s = parse[1];
final int magnitude = Integer.parseInt(s);
- Ability ability = new Ability(c, "0") {
+ final Ability ability = new Ability(c, "0") {
@Override
public void resolve() {
final Command untilEOT = new Command() {
private static final long serialVersionUID = 3014846051064254493L;
+ @Override
public void execute() {
if (AllZoneUtil.isCardInPlay(crd)) {
crd.addTempAttackBoost(-1 * magnitude);
@@ -3920,7 +3962,7 @@ public class CardFactoryUtil {
crd.addTempDefenseBoost(magnitude);
}
};
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(c);
sb.append(" - (Bushido) gets +");
sb.append(magnitude);
@@ -3947,12 +3989,13 @@ public class CardFactoryUtil {
public static int getNeededXDamage(final SpellAbility ability) {
// when targeting a creature, make sure the AI won't overkill on X
// damage
- Card target = ability.getTargetCard();
+ final Card target = ability.getTargetCard();
int neededDamage = -1;
- Card c = ability.getSourceCard();
+ final Card c = ability.getSourceCard();
- if (target != null && c.getText().contains("deals X damage to target") && !c.getName().equals("Death Grasp")) {
+ if ((target != null) && c.getText().contains("deals X damage to target")
+ && !c.getName().equals("Death Grasp")) {
neededDamage = target.getNetDefense() - target.getDamage();
}
@@ -3973,8 +4016,8 @@ public class CardFactoryUtil {
* @return the worst land found based on the description above
*/
public static Card getWorstLand(final Player player) {
- CardList lands = AllZoneUtil.getPlayerLandsInPlay(player);
- return getWorstLand(lands);
+ final CardList lands = AllZoneUtil.getPlayerLandsInPlay(player);
+ return CardFactoryUtil.getWorstLand(lands);
} // end getWorstLand
/**
@@ -3990,7 +4033,7 @@ public class CardFactoryUtil {
Card worstLand = null;
// first, check for tapped, basic lands
for (int i = 0; i < lands.size(); i++) {
- Card tmp = lands.get(i);
+ final Card tmp = lands.get(i);
if (tmp.isTapped() && tmp.isBasicLand()) {
worstLand = tmp;
}
@@ -3998,7 +4041,7 @@ public class CardFactoryUtil {
// next, check for tapped, non-basic lands
if (worstLand == null) {
for (int i = 0; i < lands.size(); i++) {
- Card tmp = lands.get(i);
+ final Card tmp = lands.get(i);
if (tmp.isTapped()) {
worstLand = tmp;
}
@@ -4007,7 +4050,7 @@ public class CardFactoryUtil {
// next, untapped, basic lands
if (worstLand == null) {
for (int i = 0; i < lands.size(); i++) {
- Card tmp = lands.get(i);
+ final Card tmp = lands.get(i);
if (tmp.isUntapped() && tmp.isBasicLand()) {
worstLand = tmp;
}
@@ -4016,7 +4059,7 @@ public class CardFactoryUtil {
// next, untapped, non-basic lands
if (worstLand == null) {
for (int i = 0; i < lands.size(); i++) {
- Card tmp = lands.get(i);
+ final Card tmp = lands.get(i);
if (tmp.isUntapped()) {
worstLand = tmp;
}
@@ -4040,7 +4083,7 @@ public class CardFactoryUtil {
return null;
}
- int index = random.nextInt(list.size());
+ final int index = CardFactoryUtil.random.nextInt(list.size());
return list.get(index);
}
@@ -4064,11 +4107,11 @@ public class CardFactoryUtil {
final String cost, final long timeStamp) {
c.setBaseAttack(0);
c.setBaseDefense(0);
- for (String r : removeTypes) {
+ for (final String r : removeTypes) {
c.removeType(r);
}
- for (String k : removeKeywords) {
+ for (final String k : removeKeywords) {
c.removeIntrinsicKeyword(k);
}
@@ -4101,13 +4144,13 @@ public class CardFactoryUtil {
c.setBaseAttack(attack);
c.setBaseDefense(defense);
- for (String r : addTypes) {
+ for (final String r : addTypes) {
// if the card doesn't have that type, add it
if (!c.isType(r)) {
c.addType(r);
}
}
- for (String k : addKeywords) {
+ for (final String k : addKeywords) {
// if the card doesn't have that keyword, add it (careful about
// stackable keywords)
if (!c.getIntrinsicKeyword().contains(k)) {
@@ -4120,7 +4163,7 @@ public class CardFactoryUtil {
cost = "0";
}
- long timestamp = c.addColor(cost, c, false, true);
+ final long timestamp = c.addColor(cost, c, false, true);
return timestamp;
}
@@ -4136,12 +4179,12 @@ public class CardFactoryUtil {
final Player player = c.getController();
// > 0 because land amount isn't incremented until after playLandEffects
- boolean extraLand = player.getNumLandsPlayed() > 0;
+ final boolean extraLand = player.getNumLandsPlayed() > 0;
if (extraLand) {
- CardList fastbonds = player.getCardsIn(Zone.Battlefield, "Fastbond");
+ final CardList fastbonds = player.getCardsIn(Zone.Battlefield, "Fastbond");
for (final Card f : fastbonds) {
- SpellAbility ability = new Ability(f, "0") {
+ final SpellAbility ability = new Ability(f, "0") {
@Override
public void resolve() {
f.getController().addDamage(1, f);
@@ -4165,9 +4208,9 @@ public class CardFactoryUtil {
* @return a boolean.
*/
public static boolean isNegativeCounter(final Counters c) {
- return c == Counters.AGE || c == Counters.BLAZE || c == Counters.BRIBERY || c == Counters.DOOM
- || c == Counters.ICE || c == Counters.M1M1 || c == Counters.M0M2 || c == Counters.M0M1
- || c == Counters.TIME;
+ return (c == Counters.AGE) || (c == Counters.BLAZE) || (c == Counters.BRIBERY) || (c == Counters.DOOM)
+ || (c == Counters.ICE) || (c == Counters.M1M1) || (c == Counters.M0M2) || (c == Counters.M0M1)
+ || (c == Counters.TIME);
}
/**
@@ -4274,15 +4317,15 @@ public class CardFactoryUtil {
* @return a {@link forge.Card} object.
*/
public static Card copyStats(final Object o) {
- Card sim = (Card) o;
- Card c = new Card();
+ final Card sim = (Card) o;
+ final Card c = new Card();
- copyCharacteristics(sim, c);
+ CardFactoryUtil.copyCharacteristics(sim, c);
if (sim.hasAlternateState()) {
c.addAlternateState();
c.changeState();
sim.changeState();
- copyCharacteristics(sim, c);
+ CardFactoryUtil.copyCharacteristics(sim, c);
c.changeState();
sim.changeState();
}
@@ -4346,7 +4389,7 @@ public class CardFactoryUtil {
// TODO - kicker costs can only be mana right now i think?
// TODO - this kicker only works for pemanents. maybe we can create an
// optional cost class for buyback, kicker, that type of thing
- int kicker = CardFactoryUtil.hasKeyword(card, "Kicker");
+ final int kicker = CardFactoryUtil.hasKeyword(card, "Kicker");
if (kicker != -1) {
final SpellAbility kickedSpell = new Spell(card) {
private static final long serialVersionUID = -1598664196463358630L;
@@ -4357,26 +4400,26 @@ public class CardFactoryUtil {
AllZone.getGameAction().moveToPlay(card);
}
};
- String parse = card.getKeyword().get(kicker).toString();
+ final String parse = card.getKeyword().get(kicker).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String kickerCost = k[1];
- ManaCost mc = new ManaCost(card.getManaCost());
+ final ManaCost mc = new ManaCost(card.getManaCost());
mc.combineManaCost(kickerCost);
kickedSpell.setKickerAbility(true);
kickedSpell.setManaCost(mc.toString());
kickedSpell.setAdditionalManaCost(kickerCost);
- StringBuilder desc = new StringBuilder();
+ final StringBuilder desc = new StringBuilder();
desc.append("Kicker ").append(kickerCost).append(" (You may pay an additional ");
desc.append(kickerCost).append(" as you cast this spell.)");
kickedSpell.setDescription(desc.toString());
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" (Kicked)");
kickedSpell.setStackDescription(sb.toString());
@@ -4384,30 +4427,30 @@ public class CardFactoryUtil {
}
if (CardFactoryUtil.hasKeyword(card, "Multikicker") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Multikicker");
+ final int n = CardFactoryUtil.hasKeyword(card, "Multikicker");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
- String[] k = parse.split("kicker ");
+ final String parse = card.getKeyword().get(n).toString();
+ final String[] k = parse.split("kicker ");
- SpellAbility sa = card.getSpellAbility()[0];
+ final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsMultiKicker(true);
sa.setMultiKickerManaCost(k[1]);
}
}
if (CardFactoryUtil.hasKeyword(card, "Replicate") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Replicate");
+ final int n = CardFactoryUtil.hasKeyword(card, "Replicate");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
- String[] k = parse.split("cate ");
+ final String parse = card.getKeyword().get(n).toString();
+ final String[] k = parse.split("cate ");
- SpellAbility sa = card.getSpellAbility()[0];
+ final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsReplicate(true);
sa.setReplicateManaCost(k[1]);
}
}
- int evokeKeyword = CardFactoryUtil.hasKeyword(card, "Evoke");
+ final int evokeKeyword = CardFactoryUtil.hasKeyword(card, "Evoke");
if (evokeKeyword != -1) {
final SpellAbility evokedSpell = new Spell(card) {
private static final long serialVersionUID = -1598664196463358630L;
@@ -4426,22 +4469,22 @@ public class CardFactoryUtil {
return super.canPlayAI();
}
};
- String parse = card.getKeyword().get(evokeKeyword).toString();
+ final String parse = card.getKeyword().get(evokeKeyword).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String evokedCost = k[1];
evokedSpell.setManaCost(evokedCost);
- StringBuilder desc = new StringBuilder();
+ final StringBuilder desc = new StringBuilder();
desc.append("Evoke ").append(evokedCost);
desc.append(" (You may cast this spell for its evoke cost. ");
desc.append("If you do, when it enters the battlefield, sacrifice it.)");
evokedSpell.setDescription(desc.toString());
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" (Evoked)");
evokedSpell.setStackDescription(sb.toString());
@@ -4449,78 +4492,78 @@ public class CardFactoryUtil {
}
if (CardFactoryUtil.hasKeyword(card, "Cycling") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Cycling");
+ final int n = CardFactoryUtil.hasKeyword(card, "Cycling");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String manacost = k[1];
- card.addSpellAbility(ability_cycle(card, manacost));
+ card.addSpellAbility(CardFactoryUtil.abilityCycle(card, manacost));
}
} // Cycling
while (CardFactoryUtil.hasKeyword(card, "TypeCycling") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "TypeCycling");
+ final int n = CardFactoryUtil.hasKeyword(card, "TypeCycling");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String type = k[1];
final String manacost = k[2];
- card.addSpellAbility(ability_typecycle(card, manacost, type));
+ card.addSpellAbility(CardFactoryUtil.abilityTypecycle(card, manacost, type));
}
} // TypeCycling
if (CardFactoryUtil.hasKeyword(card, "Flashback") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Flashback");
+ final int n = CardFactoryUtil.hasKeyword(card, "Flashback");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
// card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
card.setFlashback(true);
- card.addSpellAbility(ability_Flashback(card, k[1]));
+ card.addSpellAbility(CardFactoryUtil.abilityFlashback(card, k[1]));
}
} // flashback
if (CardFactoryUtil.hasKeyword(card, "Transmute") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Transmute");
+ final int n = CardFactoryUtil.hasKeyword(card, "Transmute");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String manacost = k[1];
- card.addSpellAbility(ability_transmute(card, manacost));
+ card.addSpellAbility(CardFactoryUtil.abilityTransmute(card, manacost));
}
} // transmute
// Sol's Soulshift fix
int shiftPos = CardFactoryUtil.hasKeyword(card, "Soulshift");
while (shiftPos != -1) {
- int n = shiftPos;
- String parse = card.getKeyword().get(n).toString();
+ final int n = shiftPos;
+ final String parse = card.getKeyword().get(n).toString();
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String manacost = k[1];
- card.addDestroyCommand(ability_Soulshift(card, manacost));
+ card.addDestroyCommand(CardFactoryUtil.abilitySoulshift(card, manacost));
shiftPos = CardFactoryUtil.hasKeyword(card, "Soulshift", n + 1);
} // Soulshift
if (CardFactoryUtil.hasKeyword(card, "Echo") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Echo");
+ final int n = CardFactoryUtil.hasKeyword(card, "Echo");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
// card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String manacost = k[1];
card.setEchoCost(manacost);
@@ -4529,6 +4572,7 @@ public class CardFactoryUtil {
private static final long serialVersionUID = -7913835645603984242L;
+ @Override
public void execute() {
card.addIntrinsicKeyword("(Echo unpaid)");
}
@@ -4539,10 +4583,10 @@ public class CardFactoryUtil {
} // echo
if (CardFactoryUtil.hasKeyword(card, "HandSize") != -1) {
- String toParse = card.getKeyword().get(CardFactoryUtil.hasKeyword(card, "HandSize"));
+ final String toParse = card.getKeyword().get(CardFactoryUtil.hasKeyword(card, "HandSize"));
card.removeIntrinsicKeyword(toParse);
- String[] parts = toParse.split(" ");
+ final String[] parts = toParse.split(" ");
final String mode = parts[1];
final int amount;
if (parts[2].equals("INF")) {
@@ -4557,6 +4601,7 @@ public class CardFactoryUtil {
entersPlay = new Command() {
private static final long serialVersionUID = 98743547743456L;
+ @Override
public void execute() {
card.setSVar("HSStamp", "" + Player.getHandSizeStamp());
if (target.equals("Self") || target.equals("All")) {
@@ -4575,6 +4620,7 @@ public class CardFactoryUtil {
leavesPlay = new Command() {
private static final long serialVersionUID = -6843545358873L;
+ @Override
public void execute() {
if (target.equals("Self") || target.equals("All")) {
card.getController().removeHandSizeOperation(Integer.parseInt(card.getSVar("HSStamp")));
@@ -4589,6 +4635,7 @@ public class CardFactoryUtil {
controllerChanges = new Command() {
private static final long serialVersionUID = 778987998465463L;
+ @Override
public void execute() {
Log.debug("HandSize", "Control changed: " + card.getController());
if (card.getController().isHuman()) {
@@ -4614,21 +4661,21 @@ public class CardFactoryUtil {
if (CardFactoryUtil.hasKeyword(card, "Suspend") != -1) {
// Suspend::
- int n = CardFactoryUtil.hasKeyword(card, "Suspend");
+ final int n = CardFactoryUtil.hasKeyword(card, "Suspend");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
card.setSuspend(true);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final int timeCounters = Integer.parseInt(k[1]);
final String cost = k[2];
- card.addSpellAbility(ability_suspend(card, cost, timeCounters));
+ card.addSpellAbility(CardFactoryUtil.abilitySuspend(card, cost, timeCounters));
}
} // Suspend
if (card.getManaCost().contains("X")) {
- SpellAbility sa = card.getSpellAbility()[0];
+ final SpellAbility sa = card.getSpellAbility()[0];
sa.setIsXCost(true);
if (card.getManaCost().startsWith("X X")) {
@@ -4643,7 +4690,7 @@ public class CardFactoryUtil {
String color = "1";
while (cardnameSpot != -1) {
if (cardnameSpot != -1) {
- String parse = card.getKeyword().get(cardnameSpot).toString();
+ final String parse = card.getKeyword().get(cardnameSpot).toString();
card.removeIntrinsicKeyword(parse);
color += " "
+ Input_PayManaCostUtil.getShortColorString(parse.replace("CARDNAME is ", "").replace(".",
@@ -4655,63 +4702,63 @@ public class CardFactoryUtil {
}
if (CardFactoryUtil.hasKeyword(card, "Fading") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Fading");
+ final int n = CardFactoryUtil.hasKeyword(card, "Fading");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final int power = Integer.parseInt(k[1]);
- card.addComesIntoPlayCommand(fading(card, power));
+ card.addComesIntoPlayCommand(CardFactoryUtil.fading(card, power));
}
} // Fading
if (CardFactoryUtil.hasKeyword(card, "Vanishing") != -1) {
- int n = CardFactoryUtil.hasKeyword(card, "Vanishing");
+ final int n = CardFactoryUtil.hasKeyword(card, "Vanishing");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final int power = Integer.parseInt(k[1]);
- card.addComesIntoPlayCommand(vanishing(card, power));
+ card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
}
} // Vanishing
// AddCost
if (!card.getSVar("FullCost").equals("")) {
- SpellAbility[] abilities = card.getSpellAbility();
- if (abilities.length > 0 && abilities[0].isSpell()) {
- String altCost = card.getSVar("FullCost");
- Cost abCost = new Cost(altCost, card.getName(), abilities[0].isAbility());
+ final SpellAbility[] abilities = card.getSpellAbility();
+ if ((abilities.length > 0) && abilities[0].isSpell()) {
+ final String altCost = card.getSVar("FullCost");
+ final Cost abCost = new Cost(altCost, card.getName(), abilities[0].isAbility());
abilities[0].setPayCosts(abCost);
}
}
// AltCost
if (!card.getSVar("AltCost").equals("")) {
- SpellAbility[] abilities = card.getSpellAbility();
- if (abilities.length > 0 && abilities[0].isSpell()) {
+ final SpellAbility[] abilities = card.getSpellAbility();
+ if ((abilities.length > 0) && abilities[0].isSpell()) {
String altCost = card.getSVar("AltCost");
- HashMap mapParams = new HashMap();
+ final HashMap mapParams = new HashMap();
String altCostDescription = "";
- String[] altCosts = altCost.split("\\|");
+ final String[] altCosts = altCost.split("\\|");
for (int aCnt = 0; aCnt < altCosts.length; aCnt++) {
altCosts[aCnt] = altCosts[aCnt].trim();
}
- for (int i = 0; i < altCosts.length; i++) {
- String[] aa = altCosts[i].split("\\$");
+ for (final String altCost2 : altCosts) {
+ final String[] aa = altCost2.split("\\$");
for (int aaCnt = 0; aaCnt < aa.length; aaCnt++) {
aa[aaCnt] = aa[aaCnt].trim();
}
if (aa.length != 2) {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("StaticEffectFactory Parsing Error: Split length of ");
- sb.append(altCosts[i]).append(" in ").append(card.getName()).append(" is not 2.");
+ sb.append(altCost2).append(" in ").append(card.getName()).append(" is not 2.");
throw new RuntimeException(sb.toString());
}
@@ -4724,13 +4771,13 @@ public class CardFactoryUtil {
altCostDescription = mapParams.get("Description");
}
- SpellAbility sa = abilities[0];
- SpellAbility altCostSA = sa.copy();
+ final SpellAbility sa = abilities[0];
+ final SpellAbility altCostSA = sa.copy();
- Cost abCost = new Cost(altCost, card.getName(), altCostSA.isAbility());
+ final Cost abCost = new Cost(altCost, card.getName(), altCostSA.isAbility());
altCostSA.setPayCosts(abCost);
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
if (!altCostDescription.equals("")) {
sb.append(altCostDescription);
@@ -4739,7 +4786,7 @@ public class CardFactoryUtil {
sb.append(" rather than pay ").append(card.getName()).append("'s mana cost.");
}
- SpellAbility_Restriction restriction = new SpellAbility_Restriction();
+ final SpellAbility_Restriction restriction = new SpellAbility_Restriction();
restriction.setRestrictions(mapParams);
if (!mapParams.containsKey("ActivationZone")) {
restriction.setZone(Constant.Zone.Hand);
@@ -4757,11 +4804,11 @@ public class CardFactoryUtil {
}
if (card.hasStartOfKeyword("Haunt")) {
- int hauntPos = card.getKeywordPosition("Haunt");
- String[] splitKeyword = card.getKeyword().get(hauntPos).split(":");
- String hauntSVarName = splitKeyword[1];
- String abilityDescription = splitKeyword[2];
- String hauntAbilityDescription = abilityDescription.substring(0, 1).toLowerCase()
+ final int hauntPos = card.getKeywordPosition("Haunt");
+ final String[] splitKeyword = card.getKeyword().get(hauntPos).split(":");
+ final String hauntSVarName = splitKeyword[1];
+ final String abilityDescription = splitKeyword[2];
+ final String hauntAbilityDescription = abilityDescription.substring(0, 1).toLowerCase()
+ abilityDescription.substring(1);
String hauntDescription;
if (card.isCreature()) {
@@ -4775,15 +4822,15 @@ public class CardFactoryUtil {
// First, create trigger that runs when the haunter goes to the
// graveyard
- Trigger haunterDies = forge.card.trigger.TriggerHandler
- .parseTrigger(
- "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank",
- card, true);
+ final Trigger haunterDies = forge.card.trigger.TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | "
+ + "ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank",
+ card, true);
final Ability haunterDies_Work = new Ability(card, "0") {
@Override
public void resolve() {
- getTargetCard().addHauntedBy(card);
+ this.getTargetCard().addHauntedBy(card);
AllZone.getGameAction().exile(card);
}
};
@@ -4803,22 +4850,22 @@ public class CardFactoryUtil {
if (!zone.is(Constant.Zone.Battlefield) || !c.isCreature()) {
return;
}
- if (canTarget(card, c)) {
+ if (CardFactoryUtil.canTarget(card, c)) {
haunterDies_Work.setTargetCard(c);
AllZone.getStack().add(haunterDies_Work);
- stop();
+ this.stop();
} else {
AllZone.getDisplay().showMessage("Cannot target this card (Shroud? Protection?).");
}
}
};
- Ability haunterDies_Setup = new Ability(card, "0") {
+ final Ability haunterDies_Setup = new Ability(card, "0") {
@Override
public void resolve() {
- CardList creats = AllZoneUtil.getCreaturesInPlay();
+ final CardList creats = AllZoneUtil.getCreaturesInPlay();
for (int i = 0; i < creats.size(); i++) {
- if (!canTarget(card, creats.get(i))) {
+ if (!CardFactoryUtil.canTarget(card, creats.get(i))) {
creats.remove(i);
i--;
}
@@ -4833,7 +4880,7 @@ public class CardFactoryUtil {
AllZone.getInputControl().setInput(target);
} else {
// AI choosing what to haunt
- CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
+ final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
if (oppCreats.size() != 0) {
haunterDies_Work.setTargetCard(CardFactoryUtil.AI_getWorstCreature(oppCreats));
} else {
@@ -4848,24 +4895,25 @@ public class CardFactoryUtil {
// Second, create the trigger that runs when the haunted creature
// dies
- Trigger hauntedDies = forge.card.trigger.TriggerHandler.parseTrigger(
- "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.HauntedBy | Execute$ "
- + hauntSVarName + " | TriggerDescription$ " + hauntDescription, card, true);
+ final Trigger hauntedDies = forge.card.trigger.TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | "
+ + "ValidCard$ Creature.HauntedBy | Execute$ " + hauntSVarName + " | TriggerDescription$ "
+ + hauntDescription, card, true);
// Third, create the trigger that runs when the haunting creature
// enters the battlefield
- Trigger haunterETB = forge.card.trigger.TriggerHandler.parseTrigger(
+ final Trigger haunterETB = forge.card.trigger.TriggerHandler.parseTrigger(
"Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ " + hauntSVarName
+ " | Secondary$ True | TriggerDescription$ " + hauntDescription, card, true);
// Fourth, create a trigger that removes the haunting status if the
// haunter leaves the exile
- Trigger haunterUnExiled = forge.card.trigger.TriggerHandler
- .parseTrigger(
- "Mode$ ChangesZone | Origin$ Exile | Destination$ Any | ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank",
- card, true);
+ final Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Exile | Destination$ Any | "
+ + "ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank",
+ card, true);
- Ability haunterUnExiled_Work = new Ability(card, "0") {
+ final Ability haunterUnExiledWork = new Ability(card, "0") {
@Override
public void resolve() {
if (card.getHaunting() != null) {
@@ -4875,19 +4923,19 @@ public class CardFactoryUtil {
}
};
- haunterUnExiled.setOverridingAbility(haunterUnExiled_Work);
+ haunterUnExiled.setOverridingAbility(haunterUnExiledWork);
// Fifth, add all triggers and abilities to the card.
if (card.isCreature()) {
card.addTrigger(haunterETB);
card.addTrigger(haunterDies);
} else {
- AbilityFactory af = new AbilityFactory();
- String abString = card.getSVar(hauntSVarName).replace("AB$", "SP$")
+ final AbilityFactory af = new AbilityFactory();
+ final String abString = card.getSVar(hauntSVarName).replace("AB$", "SP$")
.replace("Cost$ 0", "Cost$ " + card.getManaCost())
+ " | SpellDescription$ " + abilityDescription;
- SpellAbility sa = af.getAbility(abString, card);
+ final SpellAbility sa = af.getAbility(abString, card);
card.addSpellAbility(sa);
}
@@ -4896,10 +4944,14 @@ public class CardFactoryUtil {
}
if (card.hasKeyword("Provoke")) {
- String actualTrigger = "Mode$ Attacks | ValidCard$ Card.Self | OptionalDecider$ You | Execute$ ProvokeAbility | Secondary$ True | TriggerDescription$ When this attacks, you may have target creature defending player controls untap and block it if able.";
- String abString = "DB$ MustBlock | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Select target creature defending player controls | SubAbility$ DBUntap";
- String dbString = "DB$ Untap | Defined$ Targeted";
- Trigger parsedTrigger = TriggerHandler.parseTrigger(actualTrigger, card, false);
+ final String actualTrigger = "Mode$ Attacks | ValidCard$ Card.Self | "
+ + "OptionalDecider$ You | Execute$ ProvokeAbility | Secondary$ True | TriggerDescription$ "
+ + "When this attacks, you may have target creature defending player "
+ + "controls untap and block it if able.";
+ final String abString = "DB$ MustBlock | ValidTgts$ Creature.YouDontCtrl | "
+ + "TgtPrompt$ Select target creature defending player controls | SubAbility$ DBUntap";
+ final String dbString = "DB$ Untap | Defined$ Targeted";
+ final Trigger parsedTrigger = TriggerHandler.parseTrigger(actualTrigger, card, false);
card.addTrigger(parsedTrigger);
card.setSVar("ProvokeAbility", abString);
card.setSVar("DBUntap", dbString);
@@ -4908,14 +4960,14 @@ public class CardFactoryUtil {
if (card.hasKeyword("Epic")) {
final SpellAbility origSA = card.getSpellAbilities().get(0);
- SpellAbility newSA = new Spell(card, origSA.getPayCosts(), origSA.getTarget()) {
+ final SpellAbility newSA = new Spell(card, origSA.getPayCosts(), origSA.getTarget()) {
private static final long serialVersionUID = -7934420043356101045L;
@Override
public void resolve() {
// Create Epic emblem
- Card eff = new Card();
+ final Card eff = new Card();
eff.setName(card.toString() + " Epic");
eff.addType("Effect"); // Or Emblem
eff.setToken(true); // Set token to true, so when leaving
@@ -4926,10 +4978,12 @@ public class CardFactoryUtil {
eff.setColor(card.getColor());
eff.setImmutable(true);
- eff.addStaticAbility("Mode$ CantBeCast | ValidCard$ Card | Caster$ You | Description$ For the rest of the game, you can't cast spells.");
+ eff.addStaticAbility("Mode$ CantBeCast | ValidCard$ Card | Caster$ You "
+ + "| Description$ For the rest of the game, you can't cast spells.");
- Trigger copyTrigger = forge.card.trigger.TriggerHandler.parseTrigger(
- "Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerDescription$ At the beginning of each of your upkeeps, copy "
+ final Trigger copyTrigger = forge.card.trigger.TriggerHandler.parseTrigger(
+ "Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerDescription$ "
+ + "At the beginning of each of your upkeeps, copy "
+ card.toString() + " except for its epic ability.", card, false);
copyTrigger.setOverridingAbility(origSA);
@@ -4971,7 +5025,7 @@ public class CardFactoryUtil {
* @return a int.
*/
public static final int hasKeyword(final Card c, final String k) {
- ArrayList a = c.getKeyword();
+ final ArrayList a = c.getKeyword();
for (int i = 0; i < a.size(); i++) {
if (a.get(i).toString().startsWith(k)) {
return i;
@@ -4996,7 +5050,7 @@ public class CardFactoryUtil {
* @return a int.
*/
static final int hasKeyword(final Card c, final String k, final int startPos) {
- ArrayList a = c.getKeyword();
+ final ArrayList a = c.getKeyword();
for (int i = startPos; i < a.size(); i++) {
if (a.get(i).toString().startsWith(k)) {
return i;
@@ -5024,6 +5078,7 @@ public class CardFactoryUtil {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 203335252453049234L;
+ @Override
public void execute() {
// it enters the battlefield this way, and should not fire
// triggers
@@ -5035,8 +5090,9 @@ public class CardFactoryUtil {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 6436821515525468682L;
+ @Override
public void execute() {
- CardList lands = AllZoneUtil.getPlayerLandsInPlay(card.getController());
+ final CardList lands = AllZoneUtil.getPlayerLandsInPlay(card.getController());
lands.remove(card);
if (!(lands.size() <= 2)) {
// it enters the battlefield this way, and should not
@@ -5046,9 +5102,10 @@ public class CardFactoryUtil {
}
});
}
- if (hasKeyword(card, "CARDNAME enters the battlefield tapped unless you control a") != -1) {
- int n = hasKeyword(card, "CARDNAME enters the battlefield tapped unless you control a");
- String parse = card.getKeyword().get(n).toString();
+ if (CardFactoryUtil.hasKeyword(card, "CARDNAME enters the battlefield tapped unless you control a") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card,
+ "CARDNAME enters the battlefield tapped unless you control a");
+ final String parse = card.getKeyword().get(n).toString();
String splitString;
if (parse.contains(" or a ")) {
@@ -5062,15 +5119,16 @@ public class CardFactoryUtil {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 403635232455049834L;
+ @Override
public void execute() {
- CardList clICtrl = card.getOwner().getCardsIn(Zone.Battlefield);
+ final CardList clICtrl = card.getOwner().getCardsIn(Zone.Battlefield);
boolean fnd = false;
for (int i = 0; i < clICtrl.size(); i++) {
- Card c = clICtrl.get(i);
- for (int j = 0; j < types.length; j++) {
- if (c.isType(types[j].trim())) {
+ final Card c = clICtrl.get(i);
+ for (final String type : types) {
+ if (c.isType(type.trim())) {
fnd = true;
}
}
@@ -5084,10 +5142,11 @@ public class CardFactoryUtil {
}
});
}
- if (hasKeyword(card, "Sunburst") != -1) {
- Command sunburstCIP = new Command() {
+ if (CardFactoryUtil.hasKeyword(card, "Sunburst") != -1) {
+ final Command sunburstCIP = new Command() {
private static final long serialVersionUID = 1489845860231758299L;
+ @Override
public void execute() {
if (card.isCreature()) {
card.addCounter(Counters.P1P1, card.getSunburstValue());
@@ -5098,9 +5157,10 @@ public class CardFactoryUtil {
}
};
- Command sunburstLP = new Command() {
+ final Command sunburstLP = new Command() {
private static final long serialVersionUID = -7564420917490677427L;
+ @Override
public void execute() {
card.setSunburstValue(0);
}
@@ -5112,11 +5172,12 @@ public class CardFactoryUtil {
// Enforce the "World rule"
if (card.isType("World")) {
- Command intoPlay = new Command() {
+ final Command intoPlay = new Command() {
private static final long serialVersionUID = 6536398032388958127L;
+ @Override
public void execute() {
- CardList cardsInPlay = AllZoneUtil.getCardsIn(Zone.Battlefield).getType("World");
+ final CardList cardsInPlay = AllZoneUtil.getCardsIn(Zone.Battlefield).getType("World");
cardsInPlay.remove(card);
for (int i = 0; i < cardsInPlay.size(); i++) {
AllZone.getGameAction().sacrificeDestroy(cardsInPlay.get(i));
@@ -5126,84 +5187,85 @@ public class CardFactoryUtil {
card.addComesIntoPlayCommand(intoPlay);
}
- if (hasKeyword(card, "Morph") != -1) {
- int n = hasKeyword(card, "Morph");
+ if (CardFactoryUtil.hasKeyword(card, "Morph") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Morph");
if (n != -1) {
card.setPrevIntrinsicKeyword(card.getIntrinsicKeyword());
card.setPrevType(card.getType());
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
card.setCanMorph(true);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final Cost cost = new Cost(k[1], cardName, true);
- int attack = card.getBaseAttack();
- int defense = card.getBaseDefense();
+ final int attack = card.getBaseAttack();
+ final int defense = card.getBaseDefense();
- String orgManaCost = card.getManaCost();
+ final String orgManaCost = card.getManaCost();
- card.addSpellAbility(ability_Morph_Up(card, cost, orgManaCost, attack, defense));
- card.addSpellAbility(ability_Morph_Down(card));
+ card.addSpellAbility(CardFactoryUtil.abilityMorphUp(card, cost, orgManaCost, attack, defense));
+ card.addSpellAbility(CardFactoryUtil.abilityMorphDown(card));
}
} // Morph
- if (hasKeyword(card, "Unearth") != -1) {
- int n = hasKeyword(card, "Unearth");
+ if (CardFactoryUtil.hasKeyword(card, "Unearth") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Unearth");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
// card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String manacost = k[1];
- card.addSpellAbility(ability_Unearth(card, manacost));
+ card.addSpellAbility(CardFactoryUtil.abilityUnearth(card, manacost));
card.setUnearth(true);
}
} // unearth
- if (hasKeyword(card, "Madness") != -1) {
- int n = hasKeyword(card, "Madness");
+ if (CardFactoryUtil.hasKeyword(card, "Madness") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Madness");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
// card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
card.setMadness(true);
card.setMadnessCost(k[1]);
}
} // madness
- if (hasKeyword(card, "Devour") != -1) {
- int n = hasKeyword(card, "Devour");
+ if (CardFactoryUtil.hasKeyword(card, "Devour") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Devour");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
// card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
final String magnitude = k[1];
final int multiplier = Integer.parseInt(magnitude);
// final String player = card.getController();
final int[] numCreatures = new int[1];
- Command intoPlay = new Command() {
+ final Command intoPlay = new Command() {
private static final long serialVersionUID = -7530312713496897814L;
+ @Override
public void execute() {
- CardList creats = AllZoneUtil.getCreaturesInPlay(card.getController());
+ final CardList creats = AllZoneUtil.getCreaturesInPlay(card.getController());
creats.remove(card);
// System.out.println("Creats size: " + creats.size());
card.clearDevoured();
if (card.getController().isHuman()) {
if (creats.size() > 0) {
- List selection = GuiUtils.getChoicesOptional("Select creatures to sacrifice",
- creats.toArray());
+ final List selection = GuiUtils.getChoicesOptional(
+ "Select creatures to sacrifice", creats.toArray());
numCreatures[0] = selection.size();
for (int m = 0; m < selection.size(); m++) {
@@ -5216,8 +5278,8 @@ public class CardFactoryUtil {
else {
int count = 0;
for (int i = 0; i < creats.size(); i++) {
- Card c = creats.get(i);
- if (c.getNetAttack() <= 1 && c.getNetAttack() + c.getNetDefense() <= 3) {
+ final Card c = creats.get(i);
+ if ((c.getNetAttack() <= 1) && ((c.getNetAttack() + c.getNetDefense()) <= 3)) {
card.addDevoured(c);
AllZone.getGameAction().sacrifice(c);
count++;
@@ -5227,7 +5289,7 @@ public class CardFactoryUtil {
}
numCreatures[0] = count;
}
- int totalCounters = numCreatures[0] * multiplier;
+ final int totalCounters = numCreatures[0] * multiplier;
card.addCounter(Counters.P1P1, totalCounters);
@@ -5237,16 +5299,17 @@ public class CardFactoryUtil {
}
} // Devour
- if (hasKeyword(card, "Modular") != -1) {
- int n = hasKeyword(card, "Modular");
+ if (CardFactoryUtil.hasKeyword(card, "Modular") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Modular");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
final int m = Integer.parseInt(parse.substring(8));
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 339412525059881775L;
+ @Override
public void execute() {
card.addCounter(Counters.P1P1, m);
}
@@ -5255,25 +5318,27 @@ public class CardFactoryUtil {
final SpellAbility ability = new Ability(card, "0") {
@Override
public void resolve() {
- Card card2 = this.getTargetCard();
- card2.addCounter(Counters.P1P1, getSourceCard().getCounters(Counters.P1P1));
+ final Card card2 = this.getTargetCard();
+ card2.addCounter(Counters.P1P1, this.getSourceCard().getCounters(Counters.P1P1));
} // resolve()
};
card.addDestroyCommand(new Command() {
private static final long serialVersionUID = 304026662487997331L;
+ @Override
public void execute() {
// Target as Modular is Destroyed
if (card.getController().isComputer()) {
CardList choices = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
choices = choices.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isCreature() && c.isArtifact();
}
});
if (choices.size() != 0) {
- ability.setTargetCard(AI_getBestCreature(choices));
+ ability.setTargetCard(CardFactoryUtil.AI_getBestCreature(choices));
if (ability.getTargetCard() != null) {
ability.setStackDescription("Put " + card.getCounters(Counters.P1P1)
@@ -5283,7 +5348,7 @@ public class CardFactoryUtil {
}
}
} else {
- AllZone.getInputControl().setInput(modularInput(ability, card));
+ AllZone.getInputControl().setInput(CardFactoryUtil.modularInput(ability, card));
}
}
});
@@ -5296,18 +5361,22 @@ public class CardFactoryUtil {
* WARNING: must keep this keyword processing before etbCounter keyword
* processing.
*/
- if (hasKeyword(card, "Graft") != -1) {
- int n = hasKeyword(card, "Graft");
+ if (CardFactoryUtil.hasKeyword(card, "Graft") != -1) {
+ final int n = CardFactoryUtil.hasKeyword(card, "Graft");
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
final int m = Integer.parseInt(parse.substring(6));
- String abStr = "AB$ MoveCounter | Cost$ 0 | Source$ Self | Defined$ TriggeredCard | CounterType$ P1P1 | CounterNum$ 1";
+ final String abStr = "AB$ MoveCounter | Cost$ 0 | Source$ Self | "
+ + "Defined$ TriggeredCard | CounterType$ P1P1 | CounterNum$ 1";
card.setSVar("GraftTrig", abStr);
- String trigStr = "Mode$ ChangesZone | ValidCard$ Creature.Other | Origin$ Any | Destination$ Battlefield";
- trigStr += " | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ GraftTrig | TriggerDescription$ ";
- trigStr += "Whenever another creature enters the battlefield, you may move a +1/+1 counter from this creature onto it.";
+ String trigStr = "Mode$ ChangesZone | ValidCard$ Creature.Other | "
+ + "Origin$ Any | Destination$ Battlefield";
+ trigStr += " | TriggerZones$ Battlefield | OptionalDecider$ You | "
+ + "Execute$ GraftTrig | TriggerDescription$ ";
+ trigStr += "Whenever another creature enters the battlefield, you "
+ + "may move a +1/+1 counter from this creature onto it.";
final Trigger myTrigger = TriggerHandler.parseTrigger(trigStr, card, true);
card.addTrigger(myTrigger);
@@ -5316,18 +5385,19 @@ public class CardFactoryUtil {
}
- int etbCounter = hasKeyword(card, "etbCounter"); // etbCounter:CounterType:CounterAmount:Condition:Description
+ final int etbCounter = CardFactoryUtil.hasKeyword(card, "etbCounter");
+ // etbCounter:CounterType:CounterAmount:Condition:Description
// enters the battlefield with CounterAmount of CounterType
if (etbCounter != -1) {
- String parse = card.getKeyword().get(etbCounter).toString();
+ final String parse = card.getKeyword().get(etbCounter).toString();
card.removeIntrinsicKeyword(parse);
- String[] p = parse.split(":");
+ final String[] p = parse.split(":");
final Counters counter = Counters.valueOf(p[1]);
final String numCounters = p[2];
final String condition = p.length > 3 ? p[3] : "";
- StringBuilder sb = new StringBuilder(card.getSpellText());
+ final StringBuilder sb = new StringBuilder(card.getSpellText());
if (sb.length() != 0) {
sb.append("\n");
}
@@ -5351,11 +5421,12 @@ public class CardFactoryUtil {
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = -2292898970576123040L;
+ @Override
public void execute() {
if (GameActionUtil.specialConditionsMet(card, condition)) {
int toAdd = -1;
if (numCounters.equals("X")) {
- toAdd = xCount(card, card.getSVar("X"));
+ toAdd = CardFactoryUtil.xCount(card, card.getSVar("X"));
} else {
toAdd = Integer.parseInt(numCounters);
}
@@ -5367,13 +5438,14 @@ public class CardFactoryUtil {
}); // ComesIntoPlayCommand
} // if etbCounter
- int bloodthirst = hasKeyword(card, "Bloodthirst");
+ final int bloodthirst = CardFactoryUtil.hasKeyword(card, "Bloodthirst");
if (bloodthirst != -1) {
final String numCounters = card.getKeyword().get(bloodthirst).split(" ")[1];
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = -1849308549161972508L;
+ @Override
public void execute() {
if (card.getController().getOpponent().getAssignedDamage() > 0) {
int toAdd = -1;
@@ -5389,11 +5461,12 @@ public class CardFactoryUtil {
});
} // bloodthirst
- int storm = card.getKeywordAmount("Storm");
+ final int storm = card.getKeywordAmount("Storm");
for (int i = 0; i < storm; i++) {
- StringBuilder trigScript = new StringBuilder(
+ final StringBuilder trigScript = new StringBuilder(
"Mode$ SpellCast | ValidCard$ Card.Self | Execute$ Storm "
- + "| TriggerDescription$ Storm (When you cast this spell, copy it for each spell cast before it this turn.)");
+ + "| TriggerDescription$ Storm (When you cast this spell, "
+ + "copy it for each spell cast before it this turn.)");
card.setSVar("Storm", "AB$CopySpell | Cost$ 0 | Defined$ TriggeredSpellAbility | Amount$ StormCount");
card.setSVar("StormCount", "Count$StormCount");
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java b/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java
index 8e3dd7cdd7d..3f01ff23c44 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java
@@ -191,7 +191,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Gilder Bairn")) {
Cost abCost = new Cost("2 GU Untap", cardName, true);
- Target tgt = new Target(card, "Select target permanent.", new String[] {"Permanent"});
+ Target tgt = new Target(card, "Select target permanent.", new String[] { "Permanent" });
final Ability_Activated a1 = new Ability_Activated(card, abCost, tgt) {
private static final long serialVersionUID = -1847685865277129366L;
@@ -203,9 +203,9 @@ public class CardFactory_Creatures {
return;
} else if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
// zerker clean up:
- for (Counters c_1 : Counters.values()) {
- if (c.getCounters(c_1) > 0) {
- c.addCounter(c_1, c.getCounters(c_1));
+ for (Counters c1 : Counters.values()) {
+ if (c.getCounters(c1) > 0) {
+ c.addCounter(c1, c.getCounters(c1));
}
}
}
@@ -248,7 +248,7 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
String choice = "";
- String[] choices = {"3/3", "2/2 with flying", "1/6 with defender"};
+ String[] choices = { "3/3", "2/2 with flying", "1/6 with defender" };
if (card.getController().isHuman()) {
choice = GuiUtils.getChoice("Choose one", choices);
@@ -438,8 +438,8 @@ public class CardFactory_Creatures {
}
};
- ability.setStackDescription(
- "When Sleeper Agent enters the battlefield, target opponent gains control of it.");
+ ability.setStackDescription("When Sleeper Agent enters the battlefield, "
+ + "target opponent gains control of it.");
Command intoPlay = new Command() {
private static final long serialVersionUID = -3934471871041458847L;
@@ -509,8 +509,7 @@ public class CardFactory_Creatures {
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (card.isArtifact() && zone.is(Constant.Zone.Battlefield)
- && card.getController().isHuman())
- {
+ && card.getController().isHuman()) {
ability.setTargetCard(card);
AllZone.getStack().add(ability);
stop();
@@ -527,8 +526,8 @@ public class CardFactory_Creatures {
} else { // computer
Object o = getArt.execute();
- if (o != null)// should never happen, but just in case
- {
+ // should never happen, but just in case
+ if (o != null) {
ability.setTargetCard((Card) o);
AllZone.getStack().addSimultaneousStackEntry(ability);
@@ -828,8 +827,8 @@ public class CardFactory_Creatures {
color[0] = Constant.Color.White;
int max = list.getKeywordsContain(color[0]).size();
- String[] colors = {Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
- Constant.Color.Green};
+ String[] colors = { Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
+ Constant.Color.Green };
for (String c : colors) {
int cmp = list.getKeywordsContain(c).size();
if (cmp > max) {
@@ -867,8 +866,8 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
CardList cl = CardFactoryUtil.makeToken("Stangg Twin", "RG 3 4 Stangg Twin", card.getController(),
- "R G", new String[] {"Legendary", "Creature", "Human", "Warrior" }, 3, 4,
- new String[] {""});
+ "R G", new String[] { "Legendary", "Creature", "Human", "Warrior" }, 3, 4,
+ new String[] { "" });
cl.get(0).addLeavesPlayCommand(new Command() {
private static final long serialVersionUID = 3367390368512271319L;
@@ -881,9 +880,9 @@ public class CardFactory_Creatures {
});
}
};
- ability.setStackDescription(
- "When Stangg enters the battlefield, if Stangg is on the battlefield, "
- + "put a legendary 3/4 red and green Human Warrior creature token named Stangg Twin onto the battlefield.");
+ ability.setStackDescription("When Stangg enters the battlefield, if Stangg is on the battlefield, "
+ + "put a legendary 3/4 red and green Human Warrior creature token "
+ + "named Stangg Twin onto the battlefield.");
card.addComesIntoPlayCommand(new Command() {
private static final long serialVersionUID = 6667896040611028600L;
@@ -951,10 +950,10 @@ public class CardFactory_Creatures {
}; // SpellAbility
card.addSpellAbility(ability);
- ability.setDescription(
- "W U B R G: You may play target Elemental card from your graveyard without paying its mana cost.");
- ability.setStackDescription(
- "Horde of Notions - play Elemental card from graveyard without paying its mana cost.");
+ ability.setDescription("W U B R G: You may play target Elemental card from "
+ + "your graveyard without paying its mana cost.");
+ ability.setStackDescription("Horde of Notions - play Elemental card from "
+ + "graveyard without paying its mana cost.");
ability.setBeforePayMana(new Input_PayManaCost(ability));
} // *************** END ************ END **************************
@@ -983,14 +982,12 @@ public class CardFactory_Creatures {
};
card.addSpellAbility(copyTokens1);
- copyTokens1
- .setDescription(abCost
- + "For each creature token you control, "
- + "put a token that's a copy of that creature onto the battlefield.");
+ copyTokens1.setDescription(abCost + "For each creature token you control, "
+ + "put a token that's a copy of that creature onto the battlefield.");
StringBuilder sb = new StringBuilder();
- sb.append(card.getName())
- .append(" - For each creature token you control, "
- + "put a token that's a copy of that creature onto the battlefield.");
+ sb.append(card.getName()).append(
+ " - For each creature token you control, "
+ + "put a token that's a copy of that creature onto the battlefield.");
copyTokens1.setStackDescription(sb.toString());
} // *************** END ************ END **************************
@@ -1003,7 +1000,7 @@ public class CardFactory_Creatures {
public void resolve() {
int lifeGain = 0;
if (card.getController().isHuman()) {
- String[] choices = {"white", "blue", "black", "red", "green"};
+ String[] choices = { "white", "blue", "black", "red", "green" };
Object o = GuiUtils.getChoiceOptional("Select Color: ", choices);
Log.debug("Treva, the Renewer", "Color:" + o);
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor((String) o);
@@ -1023,7 +1020,7 @@ public class CardFactory_Creatures {
return false;
}
}; // ability2
- // card.clearSpellAbility();
+ // card.clearSpellAbility();
card.addSpellAbility(ability2);
StringBuilder sb2 = new StringBuilder();
@@ -1161,7 +1158,7 @@ public class CardFactory_Creatures {
if (damageableWolves.size() == 0) {
// can't damage
- // anything
+ // anything
return;
}
@@ -1223,8 +1220,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Shifting Wall") || cardName.equals("Maga, Traitor to Mortals")
|| cardName.equals("Feral Hydra") || cardName.equals("Krakilin") || cardName.equals("Ivy Elemental")
- || cardName.equals("Lightning Serpent"))
- {
+ || cardName.equals("Lightning Serpent")) {
SpellAbility spell = new Spell_Permanent(card) {
private static final long serialVersionUID = 7708945715867177172L;
@@ -1252,13 +1248,13 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
- int XCounters = card.getXManaCostPaid();
+ int xCounters = card.getXManaCostPaid();
Card c = AllZone.getGameAction().moveToPlay(getSourceCard());
- if (XCounters >= 5) {
- XCounters = 2 * XCounters;
+ if (xCounters >= 5) {
+ xCounters = 2 * xCounters;
}
- c.addCounter(Counters.P1P1, XCounters);
+ c.addCounter(Counters.P1P1, xCounters);
}
};
// Do not remove SpellAbilities created by AbilityFactory or
@@ -1313,8 +1309,7 @@ public class CardFactory_Creatures {
int total = card.getCounters(Counters.P1P1);
if (getTargetCard() != null) {
if (AllZoneUtil.isCardInPlay(getTargetCard())
- && CardFactoryUtil.canTarget(card, getTargetCard()))
- {
+ && CardFactoryUtil.canTarget(card, getTargetCard())) {
getTargetCard().addDamage(total, card);
}
} else {
@@ -1329,11 +1324,11 @@ public class CardFactory_Creatures {
StringBuilder sb = new StringBuilder();
sb.append(abCost + "Remove all +1/+1 counters from " + cardName + ": " + cardName);
sb.append(" deals damage to target creature or player equal to the "
- + "number of +1/+1 counters removed this way.");
+ + "number of +1/+1 counters removed this way.");
ability2.setDescription(sb.toString());
ability2.setStackDescription("Molten Hydra deals damage to number of "
- + "+1/+1 counters on it to target creature or player.");
+ + "+1/+1 counters on it to target creature or player.");
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -1370,8 +1365,8 @@ public class CardFactory_Creatures {
if (c.isAura()) {
- String[] enchantThisType = {""};
- String[] message = {""};
+ String[] enchantThisType = { "" };
+ String[] message = { "" };
// The type following "Enchant" maybe
// upercase or lowercase, cardsfolder
@@ -1379,13 +1374,12 @@ public class CardFactory_Creatures {
// Note that I am being overly cautious.
if (c.hasKeyword("Enchant creature without flying")
- || c.hasKeyword("Enchant Creature without flying"))
- {
+ || c.hasKeyword("Enchant Creature without flying")) {
enchantThisType[0] = "Creature.withoutFlying";
message[0] = "Select a creature without flying";
} else if (c.hasKeyword("Enchant creature with converted mana cost 2 or less")
- || c.hasKeyword("Enchant Creature with converted mana cost 2 or less"))
- {
+ || c.hasKeyword("Enchant Creature with "
+ + "converted mana cost 2 or less")) {
enchantThisType[0] = "Creature.cmcLE2";
message[0] = "Select a creature with converted mana cost 2 or less";
} else if (c.hasKeyword("Enchant red or green creature")) {
@@ -1394,8 +1388,8 @@ public class CardFactory_Creatures {
} else if (c.hasKeyword("Enchant tapped creature")) {
enchantThisType[0] = "Creature.tapped";
message[0] = "Select a tapped creature";
- } else if (c.hasKeyword("Enchant creature") || c.hasKeyword("Enchant Creature"))
- {
+ } else if (c.hasKeyword("Enchant creature")
+ || c.hasKeyword("Enchant Creature")) {
enchantThisType[0] = "Creature";
message[0] = "Select a creature";
} else if (c.hasKeyword("Enchant wall") || c.hasKeyword("Enchant Wall")) {
@@ -1408,8 +1402,8 @@ public class CardFactory_Creatures {
} else if (c.hasKeyword("Enchant land") || c.hasKeyword("Enchant Land")) {
enchantThisType[0] = "Land";
message[0] = "Select a land";
- } else if (c.hasKeyword("Enchant artifact") || c.hasKeyword("Enchant Artifact"))
- {
+ } else if (c.hasKeyword("Enchant artifact")
+ || c.hasKeyword("Enchant Artifact")) {
enchantThisType[0] = "Artifact";
message[0] = "Select an artifact";
} else if (c.hasKeyword("Enchant enchantment")
@@ -1457,8 +1451,8 @@ public class CardFactory_Creatures {
}); // Input()
} // if we were able to match the
- // selected aura with our list of
- // criteria
+ // selected aura with our list of
+ // criteria
} // If enchantment selected is an aura
} // If an enchantment is selected
} // If there are enchantments in library
@@ -1562,7 +1556,7 @@ public class CardFactory_Creatures {
public void execute() {
ability.setStackDescription("Kinsbaile Borderguard enters "
- + "the battlefield with a +1/+1 counter on it for each other Kithkin you control.");
+ + "the battlefield with a +1/+1 counter on it for each other Kithkin you control.");
AllZone.getStack().addSimultaneousStackEntry(ability);
}
@@ -1578,7 +1572,7 @@ public class CardFactory_Creatures {
public void makeToken() {
CardFactoryUtil.makeToken("Kithkin Soldier", "W 1 1 Kithkin Soldier", card.getController(), "W",
- new String[] {"Creature", "Kithkin", "Soldier"}, 1, 1, new String[] {""});
+ new String[] { "Creature", "Kithkin", "Soldier" }, 1, 1, new String[] { "" });
}
};
@@ -1587,7 +1581,7 @@ public class CardFactory_Creatures {
public void execute() {
ability2.setStackDescription("When Kinsbaile Borderguard "
- + "is put into a graveyard from play, put a 1/1 white "
+ + "is put into a graveyard from play, put a 1/1 white "
+ "Kithkin Soldier creature token onto the battlefield for each counter on it.");
AllZone.getStack().addSimultaneousStackEntry(ability2);
@@ -1656,8 +1650,7 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Gnarlid Pack") || cardName.equals("Apex Hawks") || cardName.equals("Enclave Elite")
|| cardName.equals("Quag Vampires") || cardName.equals("Skitter of Lizards")
- || cardName.equals("Joraga Warcaller"))
- {
+ || cardName.equals("Joraga Warcaller")) {
final Ability_Static ability = new Ability_Static(card, "0") {
@Override
public void resolve() {
@@ -1888,7 +1881,7 @@ public class CardFactory_Creatures {
public void resolve() {
AllZone.getInputControl().setInput(new Input() {
private static final long serialVersionUID = 6150236529653275947L;
- CardList revealed = new CardList();
+ private CardList revealed = new CardList();
@Override
public void showMessage() {
@@ -1943,8 +1936,7 @@ public class CardFactory_Creatures {
} // resolve()
}; // SpellAbility
- ability.setDescription(abCost
- + "Reveal any number of artifact cards in your hand. "
+ ability.setDescription(abCost + "Reveal any number of artifact cards in your hand. "
+ "Add 2 to your mana pool for each card revealed this way.");
ability.setStackDescription(cardName + " - Reveal any number of artifact cards in your hand.");
card.addSpellAbility(ability);
@@ -2022,9 +2014,9 @@ public class CardFactory_Creatures {
// here, we add the ability to the stack since it's
// triggered.
StringBuilder sb = new StringBuilder();
- sb.append(card.getName())
- .append(" - tap up to 5 permanents target player controls. "
- + "Target player skips his or her next untap step.");
+ sb.append(card.getName()).append(
+ " - tap up to 5 permanents target player controls. "
+ + "Target player skips his or her next untap step.");
ability.setStackDescription(sb.toString());
AllZone.getStack().add(ability);
stop();
@@ -2157,8 +2149,7 @@ public class CardFactory_Creatures {
private static final long serialVersionUID = 7680692311339496770L;
public void execute() {
- sacOrSac.setStackDescription("When "
- + cardName
+ sacOrSac.setStackDescription("When " + cardName
+ " enters the battlefield, sacrifice it unless you "
+ "sacrifice any number of creatures with total power 12 or greater.");
AllZone.getStack().addSimultaneousStackEntry(sacOrSac);
@@ -2173,8 +2164,7 @@ public class CardFactory_Creatures {
else if (cardName.equals("Clone") || cardName.equals("Vesuvan Doppelganger")
|| cardName.equals("Quicksilver Gargantuan") || cardName.equals("Jwari Shapeshifter")
|| cardName.equals("Phyrexian Metamorph") || cardName.equals("Phantasmal Image")
- || cardName.equals("Body Double"))
- {
+ || cardName.equals("Body Double")) {
final CardFactoryInterface cfact = cf;
final Card[] copyTarget = new Card[1];
final Card[] cloned = new Card[1];
@@ -2259,9 +2249,9 @@ public class CardFactory_Creatures {
if (cardName.equals("Vesuvan Doppelganger")) {
cloned[0].addExtrinsicKeyword("At the beginning of your upkeep, "
- + "you may have this creature become a copy of target creature "
+ + "you may have this creature become a copy of target creature "
+ "except it doesn't copy that creature's color. "
- + "If you do, this creature gains this ability.");
+ + "If you do, this creature gains this ability.");
cloned[0].addColor("U", cloned[0], false, true);
} else if (cardName.equals("Quicksilver Gargantuan")) {
cloned[0].setBaseDefense(7);
@@ -2269,7 +2259,7 @@ public class CardFactory_Creatures {
} else if (cardName.equals("Phantasmal Image")) {
StringBuilder trigScript = new StringBuilder(
"Mode$ BecomesTarget | ValidTarget$ Card.Self | "
- + "TriggerZones$ Battlefield | Execute$ ");
+ + "TriggerZones$ Battlefield | Execute$ ");
StringBuilder svarName = new StringBuilder("TrigSac");
// Couple of hoops to jump through to make sure no
// svar is overwritten.
@@ -2284,9 +2274,8 @@ public class CardFactory_Creatures {
}
}
trigScript.append(svarName.toString());
- trigScript
- .append(" | TriggerDescription$ When this creature "
- + "becomes the target of a spell or ability, sacrifice it.");
+ trigScript.append(" | TriggerDescription$ When this creature "
+ + "becomes the target of a spell or ability, sacrifice it.");
cloned[0].addTrigger(forge.card.trigger.TriggerHandler.parseTrigger(trigScript.toString(),
card, true));
cloned[0].setSVar(svarName.toString(), "AB$Sacrifice | Cost$ 0 | Defined$ Self");
@@ -2320,8 +2309,7 @@ public class CardFactory_Creatures {
@Override
public void selectCard(final Card c, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield)
- && (c.isCreature() || (cardName.equals("Phyrexian Metamorph") && c.isArtifact())))
- {
+ && (c.isCreature() || (cardName.equals("Phyrexian Metamorph") && c.isArtifact()))) {
if (cardName.equals("Jwari Shapeshifter") && !c.isType("Ally")) {
return;
}
@@ -2392,7 +2380,7 @@ public class CardFactory_Creatures {
if (!revealed.isEmpty()) {
GuiUtils.getChoice("Revealed at random", revealed.toArray());
} else {
- GuiUtils.getChoice("Revealed at random", new String[] {"Nothing to reveal"});
+ GuiUtils.getChoice("Revealed at random", new String[] { "Nothing to reveal" });
}
for (Card c : revealed) {
@@ -2432,7 +2420,7 @@ public class CardFactory_Creatures {
private static final long serialVersionUID = -8926850792424930054L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return false;
}
@@ -2514,8 +2502,7 @@ public class CardFactory_Creatures {
}; // SpellAbility
card.addSpellAbility(ability);
- ability.setDescription(abCost
- + "Put a -1/-1 counter on target creature. "
+ ability.setDescription(abCost + "Put a -1/-1 counter on target creature. "
+ "Then if that creature's toughness is 1 or greater, regenerate it.");
StringBuilder sb = new StringBuilder();
@@ -2525,16 +2512,14 @@ public class CardFactory_Creatures {
// *************** START *********** START **************************
else if (cardName.equals("Awakener Druid")) {
- final long[] timeStamp = {0};
+ final long[] timeStamp = { 0 };
- Trigger myTrig = TriggerHandler
- .parseTrigger(
- "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
- + "ValidCard$ Card.Self | TriggerDescription$ "
- + "When CARDNAME enters the battlefield, target Forest "
- + "becomes a 4/5 green Treefolk creature for as long as CARDNAME is on the "
- + "battlefield. It's still a land.",
- card, true);
+ Trigger myTrig = TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
+ + "ValidCard$ Card.Self | TriggerDescription$ "
+ + "When CARDNAME enters the battlefield, target Forest "
+ + "becomes a 4/5 green Treefolk creature for as long as CARDNAME is on the "
+ + "battlefield. It's still a land.", card, true);
Target myTarget = new Target(card, "Choose target forest.", "Land.Forest".split(","), "1", "1");
final SpellAbility awaken = new Ability(card, "0") {
@Override
@@ -2543,18 +2528,18 @@ public class CardFactory_Creatures {
return;
}
final Card c = getTarget().getTargetCards().get(0);
- String[] types = {"Creature", "Treefolk"};
+ String[] types = { "Creature", "Treefolk" };
String[] keywords = {};
timeStamp[0] = CardFactoryUtil.activateManland(c, 4, 5, types, keywords, "G");
final Command onleave = new Command() {
private static final long serialVersionUID = -6004932214386L;
- long stamp = timeStamp[0];
- Card tgt = c;
+ private long stamp = timeStamp[0];
+ private Card tgt = c;
public void execute() {
- String[] types = {"Creature", "Treefolk"};
- String[] keywords = {""};
+ String[] types = { "Creature", "Treefolk" };
+ String[] keywords = { "" };
CardFactoryUtil.revertManland(tgt, types, keywords, "G", stamp);
}
};
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Equipment.java b/src/main/java/forge/card/cardFactory/CardFactory_Equipment.java
index 88febe1491e..c42e1679fe1 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Equipment.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Equipment.java
@@ -43,7 +43,7 @@ class CardFactory_Equipment {
* @return a int.
*/
public static int shouldEquip(final Card c) {
- ArrayList a = c.getKeyword();
+ final ArrayList a = c.getKeyword();
for (int i = 0; i < a.size(); i++) {
// Keyword renamed to eqPump, was VanillaEquipment
@@ -69,25 +69,26 @@ class CardFactory_Equipment {
// *************** START *********** START **************************
if (cardName.equals("Umbral Mantle")) {
- Cost abCost = new Cost("0", cardName, true);
- Target target = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
+ final Cost abCost = new Cost("0", cardName, true);
+ final Target target = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final Ability_Activated equip = new Ability_Activated(card, abCost, target) {
private static final long serialVersionUID = -6122939616068165612L;
@Override
public void resolve() {
- if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
- if (crd.equals(getTargetCard())) {
+ final Card crd = card.getEquipping().get(0);
+ if (crd.equals(this.getTargetCard())) {
return;
}
card.unEquipCard(crd);
}
- card.equipCard(getTargetCard());
+ card.equipCard(this.getTargetCard());
}
}
@@ -95,15 +96,16 @@ class CardFactory_Equipment {
public boolean canPlayAI() {
return false;
}
- };// equip ability
+ }; // equip ability
equip.setType("Extrinsic");
final Ability untapboost = new Ability(card, "3") {
- Command EOT(final Card c) {
+ Command eot(final Card c) {
return new Command() {
private static final long serialVersionUID = -8840812331316327448L;
+ @Override
public void execute() {
if (AllZoneUtil.isCardInPlay(getSourceCard())) {
c.addTempAttackBoost(-2);
@@ -116,49 +118,51 @@ class CardFactory_Equipment {
@Override
public void resolve() {
- getSourceCard().addTempAttackBoost(2);
- getSourceCard().addTempDefenseBoost(2);
- AllZone.getEndOfTurn().addUntil(EOT(getSourceCard()));
+ this.getSourceCard().addTempAttackBoost(2);
+ this.getSourceCard().addTempDefenseBoost(2);
+ AllZone.getEndOfTurn().addUntil(this.eot(this.getSourceCard()));
}
@Override
public boolean canPlay() {
- return (getSourceCard().isTapped() && !getSourceCard().hasSickness() && super.canPlay());
+ return (this.getSourceCard().isTapped() && !this.getSourceCard().hasSickness() && super.canPlay());
}
- };// equiped creature's ability
+ }; // equiped creature's ability
untapboost.makeUntapAbility();
- Command onEquip = new Command() {
+ final Command onEquip = new Command() {
private static final long serialVersionUID = -4784079305541955698L;
+ @Override
public void execute() {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
+ final Card crd = card.getEquipping().get(0);
- StringBuilder sbDesc = new StringBuilder();
+ final StringBuilder sbDesc = new StringBuilder();
sbDesc.append("3, Untap: ").append(crd).append(" gets +2/+2 until end of turn");
untapboost.setDescription(sbDesc.toString());
- StringBuilder sbStack = new StringBuilder();
+ final StringBuilder sbStack = new StringBuilder();
sbStack.append(crd).append(" - +2/+2 until EOT");
untapboost.setStackDescription(sbStack.toString());
crd.addSpellAbility(untapboost);
}
- }// execute()
- };// Command
+ } // execute()
+ }; // Command
- Command onUnEquip = new Command() {
+ final Command onUnEquip = new Command() {
private static final long serialVersionUID = -3427116314295067303L;
+ @Override
public void execute() {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
+ final Card crd = card.getEquipping().get(0);
crd.removeSpellAbility(untapboost);
}
- }// execute()
- };// Command
+ } // execute()
+ }; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
equip.getRestrictions().setSorcerySpeed(true);
@@ -180,17 +184,18 @@ class CardFactory_Equipment {
// not changed
@Override
public void resolve() {
- if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
- if (crd.equals(getTargetCard())) {
+ final Card crd = card.getEquipping().get(0);
+ if (crd.equals(this.getTargetCard())) {
return;
}
card.unEquipCard(crd);
}
- card.equipCard(getTargetCard());
+ card.equipCard(this.getTargetCard());
}
}
@@ -204,20 +209,21 @@ class CardFactory_Equipment {
// not changed
@Override
public boolean canPlayAI() {
- return getCreature().size() != 0 && !card.isEquipping() && super.canPlayAI();
+ return (this.getCreature().size() != 0) && !card.isEquipping() && super.canPlayAI();
}
// not changed
@Override
public void chooseTargetAI() {
- Card target = CardFactoryUtil.AI_getBestCreature(getCreature());
- setTargetCard(target);
+ final Card target = CardFactoryUtil.AI_getBestCreature(this.getCreature());
+ this.setTargetCard(target);
}
// not changed
CardList getCreature() {
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return CardFactoryUtil.AI_doesCreatureAttack(c) && CardFactoryUtil.canTarget(card, c)
&& (!c.hasKeyword("Defender"));
@@ -234,36 +240,38 @@ class CardFactory_Equipment {
}
return list;
- }// getCreature()
- };// equip ability
+ } // getCreature()
+ }; // equip ability
- Command onEquip = new Command() {
+ final Command onEquip = new Command() {
private static final long serialVersionUID = -5356474407155702171L;
+ @Override
public void execute() {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
- int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
+ final Card crd = card.getEquipping().get(0);
+ final int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
crd.addSemiPermanentAttackBoost(pump);
crd.addSemiPermanentDefenseBoost(pump);
}
- }// execute()
- };// Command
+ } // execute()
+ }; // Command
- Command onUnEquip = new Command() {
+ final Command onUnEquip = new Command() {
private static final long serialVersionUID = 5196262972986079207L;
+ @Override
public void execute() {
if (card.isEquipping()) {
- Card crd = card.getEquipping().get(0);
- int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
+ final Card crd = card.getEquipping().get(0);
+ final int pump = CardUtil.getConvertedManaCost(crd.getManaCost());
crd.addSemiPermanentAttackBoost(-pump);
crd.addSemiPermanentDefenseBoost(-pump);
}
- }// execute()
- };// Command
+ } // execute()
+ }; // Command
equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip));
@@ -281,7 +289,7 @@ class CardFactory_Equipment {
@Override
public void resolve() {
if (card.getEquipping().size() != 0) {
- Card equipping = card.getEquipping().get(0);
+ final Card equipping = card.getEquipping().get(0);
if (equipping.isType("Vampire")) {
equipping.addCounter(Counters.P1P1, 2);
} else {
@@ -291,10 +299,12 @@ class CardFactory_Equipment {
}
};
- final Trigger myTrigger = TriggerHandler
- .parseTrigger(
- "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ TrigOverride | TriggerDescription$ Whenever a creature is put into a graveyard from the battlefield, put a +1/+1 counter on equipped creature. If equipped creature is a Vampire, put two +1/+1 counters on it instead.",
- card, true);
+ final Trigger myTrigger = TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | "
+ + "ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ TrigOverride | "
+ + "TriggerDescription$ Whenever a creature is put into a "
+ + "graveyard from the battlefield, put a +1/+1 counter on equipped creature. "
+ + "If equipped creature is a Vampire, put two +1/+1 counters on it instead.", card, true);
myTrigger.setOverridingAbility(triggeredAbility);
card.addTrigger(myTrigger);
@@ -313,16 +323,17 @@ class CardFactory_Equipment {
AllZone.getDisplay().showMessage(card + " - Select target creature you control to attach");
ButtonUtil.disableAll();
if (list.size() == 0) {
- stop();
+ this.stop();
}
}
@Override
public void selectCard(final Card c, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield, card.getController()) && c.isCreature()
- && CardFactoryUtil.canTarget(card, c)) {
+ && CardFactoryUtil.canTarget(card, c))
+ {
card.equipCard(c);
- stop();
+ this.stop();
}
}
@@ -332,15 +343,16 @@ class CardFactory_Equipment {
@Override
public void resolve() {
AllZone.getInputControl().setInput(in);
- }// resolve()
+ } // resolve()
}; // comesIntoPlayAbility
- Command intoPlay = new Command() {
+ final Command intoPlay = new Command() {
private static final long serialVersionUID = 2985015252466920757L;
+ @Override
public void execute() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("When Piston Sledge enters the battlefield, attach it to target creature you control.");
comesIntoPlayAbility.setStackDescription(sb.toString());
@@ -350,15 +362,15 @@ class CardFactory_Equipment {
};
card.addComesIntoPlayCommand(intoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
- if (shouldEquip(card) != -1) {
- int n = shouldEquip(card);
+ if (CardFactory_Equipment.shouldEquip(card) != -1) {
+ final int n = CardFactory_Equipment.shouldEquip(card);
if (n != -1) {
- String parse = card.getKeyword().get(n).toString();
+ final String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
- String[] k = parse.split(":");
+ final String[] k = parse.split(":");
String tmpCost;
tmpCost = k[0].substring(6);
String keywordsUnsplit = "";
@@ -370,13 +382,12 @@ class CardFactory_Equipment {
int power = 0;
int tough = 0;
- String[] ptk = k[1].split("/");
-
- if (ptk.length == 1) // keywords in first cell
- {
+ final String[] ptk = k[1].split("/");
+ // keywords in first cell
+ if (ptk.length == 1) {
keywordsUnsplit = ptk[0];
- } else // parse the power/toughness boosts in first two cells
- {
+ } else {
+ // parse the power/toughness boosts in first two cells
for (int i = 0; i < 2; i++) {
if (ptk[i].matches("[\\+\\-][0-9]")) {
ptk[i] = ptk[i].replace("+", "");
@@ -394,7 +405,7 @@ class CardFactory_Equipment {
if (keywordsUnsplit.length() > 0) // then there is at least one
// extrinsic keyword to assign
{
- String[] tempKwds = keywordsUnsplit.split("&");
+ final String[] tempKwds = keywordsUnsplit.split("&");
extrinsicKeywords = new String[tempKwds.length];
for (int i = 0; i < tempKwds.length; i++) {
@@ -407,7 +418,7 @@ class CardFactory_Equipment {
card.addUnEquipCommand(CardFactoryUtil.eqPump_unEquip(card, power, tough, extrinsicKeywords, abCost));
}
- }// eqPump (was VanillaEquipment)
+ } // eqPump (was VanillaEquipment)
if (card.hasKeyword("Living Weapon")) {
card.removeIntrinsicKeyword("Living Weapon");
@@ -415,14 +426,14 @@ class CardFactory_Equipment {
@Override
public void resolve() {
- String[] types = new String[] { "Creature", "Germ" };
- String[] keywords = new String[0];
- CardList germs = CardFactoryUtil.makeToken("Germ", "B 0 0 Germ", card.getController(), "B", types,
- 1, 1, keywords);
+ final String[] types = new String[] { "Creature", "Germ" };
+ final String[] keywords = new String[0];
+ final CardList germs = CardFactoryUtil.makeToken("Germ", "B 0 0 Germ", card.getController(), "B",
+ types, 1, 1, keywords);
card.equipCard(germs.get(0));
- for (Card c : germs) {
+ for (final Card c : germs) {
c.setBaseAttack(0);
c.setBaseDefense(0);
}
@@ -430,10 +441,12 @@ class CardFactory_Equipment {
};
- final Trigger etbTrigger = TriggerHandler
- .parseTrigger(
- "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigOverriding | TriggerDescription$ Living Weapon (When this Equipment enters the battlefield, put a 0/0 black Germ creature token onto the battlefield, then attach this to it.)",
- card, true);
+ final Trigger etbTrigger = TriggerHandler.parseTrigger(
+ "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | "
+ + "ValidCard$ Card.Self | Execute$ TrigOverriding | TriggerDescription$ "
+ + "Living Weapon (When this Equipment enters the battlefield, "
+ + "put a 0/0 black Germ creature token onto the battlefield, then attach this to it.)",
+ card, true);
etbTrigger.setOverridingAbility(etbAbility);
card.addTrigger(etbTrigger);
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Instants.java b/src/main/java/forge/card/cardFactory/CardFactory_Instants.java
index ea3a4c15130..54faab5ebec 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Instants.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Instants.java
@@ -53,7 +53,7 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
if (cardName.equals("Sprout Swarm")) {
- final SpellAbility spell_one = new Spell(card) {
+ final SpellAbility spellOne = new Spell(card) {
private static final long serialVersionUID = -609007714604161377L;
@Override
@@ -67,34 +67,34 @@ public class CardFactory_Instants {
}
}; // SpellAbility
- final SpellAbility spell_two = new Spell(card) {
+ final SpellAbility spellTwo = new Spell(card) {
private static final long serialVersionUID = -1387385820860395676L;
@Override
public void resolve() {
CardFactoryUtil.makeTokenSaproling(card.getController());
// return card to the hand
- PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
+ final PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, card);
}
}; // SpellAbility
- spell_one.setManaCost("1 G");
- spell_two.setManaCost("4 G");
- spell_two.setAdditionalManaCost("3");
+ spellOne.setManaCost("1 G");
+ spellTwo.setManaCost("4 G");
+ spellTwo.setAdditionalManaCost("3");
- spell_one.setDescription("Put a 1/1 green Saproling token onto the battlefield.");
- spell_two
- .setDescription("Buyback 3 (You may pay an additional 3 as you cast this spell. If you do, put this card into your hand as it resolves.)");
+ spellOne.setDescription("Put a 1/1 green Saproling token onto the battlefield.");
+ spellTwo.setDescription("Buyback 3 (You may pay an additional 3 as you cast this spell. "
+ + "If you do, put this card into your hand as it resolves.)");
- spell_one.setStackDescription("Sprout Swarm - Put a 1/1 green Saproling token onto the battlefield");
- spell_two
- .setStackDescription("Sprout Swarm - Buyback, Put a 1/1 green Saproling token onto the battlefield");
+ spellOne.setStackDescription("Sprout Swarm - Put a 1/1 green Saproling token onto the battlefield");
+ spellTwo.setStackDescription("Sprout Swarm - Buyback, Put a 1/1 green "
+ + "Saproling token onto the battlefield");
- spell_two.setIsBuyBackAbility(true);
+ spellTwo.setIsBuyBackAbility(true);
- card.addSpellAbility(spell_one);
- card.addSpellAbility(spell_two);
+ card.addSpellAbility(spellOne);
+ card.addSpellAbility(spellTwo);
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -108,149 +108,144 @@ public class CardFactory_Instants {
Card choice = null;
// check for no cards in hand on resolve
- PlayerZone library = card.getController().getZone(Constant.Zone.Library);
- PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
+ final PlayerZone library = card.getController().getZone(Constant.Zone.Library);
+ final PlayerZone hand = card.getController().getZone(Constant.Zone.Hand);
// PlayerZone Grave =
// card.getController().getZone(Constant.Zone.Graveyard);
- CardList cards = new CardList();
+ final CardList cards = new CardList();
if (library.size() == 0) {
JOptionPane.showMessageDialog(null, "No more cards in library.", "",
JOptionPane.INFORMATION_MESSAGE);
return;
}
- int Count = 5;
+ int count = 5;
if (library.size() < 5) {
- Count = library.size();
+ count = library.size();
}
- for (int i = 0; i < Count; i++) {
+ for (int i = 0; i < count; i++) {
cards.add(library.get(i));
}
- CardList Pile1 = new CardList();
- CardList Pile2 = new CardList();
+ final CardList pile1 = new CardList();
+ final CardList pile2 = new CardList();
boolean stop = false;
- int Pile1CMC = 0;
- int Pile2CMC = 0;
+ int pile1CMC = 0;
+ int pile2CMC = 0;
- GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray());
+ GuiUtils.getChoice("Revealing top " + count + " cards of library: ", cards.toArray());
// Human chooses
if (card.getController().isComputer()) {
- for (int i = 0; i < Count; i++) {
- if (stop == false) {
+ for (int i = 0; i < count; i++) {
+ if (!stop) {
choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ",
cards.toArray());
if (choice != null) {
- Pile1.add(choice);
+ pile1.add(choice);
cards.remove(choice);
- Pile1CMC = Pile1CMC + CardUtil.getConvertedManaCost(choice);
+ pile1CMC = pile1CMC + CardUtil.getConvertedManaCost(choice);
} else {
stop = true;
}
}
}
- for (int i = 0; i < Count; i++) {
- if (!Pile1.contains(library.get(i))) {
- Pile2.add(library.get(i));
- Pile2CMC = Pile2CMC + CardUtil.getConvertedManaCost(library.get(i));
+ for (int i = 0; i < count; i++) {
+ if (!pile1.contains(library.get(i))) {
+ pile2.add(library.get(i));
+ pile2CMC = pile2CMC + CardUtil.getConvertedManaCost(library.get(i));
}
}
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("You have spilt the cards into the following piles" + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
- for (int i = 0; i < Pile1.size(); i++) {
- sb.append(Pile1.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile1.size(); i++) {
+ sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
- for (int i = 0; i < Pile2.size(); i++) {
- sb.append(Pile2.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile2.size(); i++) {
+ sb.append(pile2.get(i).getName() + "\r\n");
}
JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE);
- if (Pile1CMC >= Pile2CMC) {
- JOptionPane
- .showMessageDialog(
- null,
- "Computer adds the first pile to its hand and puts the second pile into the graveyard",
- "", JOptionPane.INFORMATION_MESSAGE);
- for (int i = 0; i < Pile1.size(); i++) {
- AllZone.getGameAction().moveTo(hand, Pile1.get(i));
+ if (pile1CMC >= pile2CMC) {
+ JOptionPane.showMessageDialog(null, "Computer adds the first pile to its hand "
+ + "and puts the second pile into the graveyard", "",
+ JOptionPane.INFORMATION_MESSAGE);
+ for (int i = 0; i < pile1.size(); i++) {
+ AllZone.getGameAction().moveTo(hand, pile1.get(i));
}
- for (int i = 0; i < Pile2.size(); i++) {
- AllZone.getGameAction().moveToGraveyard(Pile2.get(i));
+ for (int i = 0; i < pile2.size(); i++) {
+ AllZone.getGameAction().moveToGraveyard(pile2.get(i));
}
} else {
- JOptionPane
- .showMessageDialog(
- null,
- "Computer adds the second pile to its hand and puts the first pile into the graveyard",
- "", JOptionPane.INFORMATION_MESSAGE);
- for (int i = 0; i < Pile2.size(); i++) {
- AllZone.getGameAction().moveTo(hand, Pile2.get(i));
+ JOptionPane.showMessageDialog(null, "Computer adds the second pile to its hand and "
+ + "puts the first pile into the graveyard", "", JOptionPane.INFORMATION_MESSAGE);
+ for (int i = 0; i < pile2.size(); i++) {
+ AllZone.getGameAction().moveTo(hand, pile2.get(i));
}
- for (int i = 0; i < Pile1.size(); i++) {
- AllZone.getGameAction().moveToGraveyard(Pile1.get(i));
+ for (int i = 0; i < pile1.size(); i++) {
+ AllZone.getGameAction().moveToGraveyard(pile1.get(i));
}
}
- } else// Computer chooses (It picks the highest converted
- // mana cost card and 1 random card.)
- {
+ } else {
+ // Computer chooses (It picks the highest converted
+ // mana cost card and 1 random card.)
Card biggest = null;
biggest = library.get(0);
- for (int i = 0; i < Count; i++) {
+ for (int i = 0; i < count; i++) {
if (CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil
.getConvertedManaCost(biggest.getManaCost())) {
biggest = cards.get(i);
}
}
- Pile1.add(biggest);
+ pile1.add(biggest);
cards.remove(biggest);
if (cards.size() > 0) {
- Card Random = CardUtil.getRandom(cards.toArray());
- Pile1.add(Random);
+ final Card random = CardUtil.getRandom(cards.toArray());
+ pile1.add(random);
}
- for (int i = 0; i < Count; i++) {
- if (!Pile1.contains(library.get(i))) {
- Pile2.add(library.get(i));
+ for (int i = 0; i < count; i++) {
+ if (!pile1.contains(library.get(i))) {
+ pile2.add(library.get(i));
}
}
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Choose a pile to add to your hand: " + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
- for (int i = 0; i < Pile1.size(); i++) {
- sb.append(Pile1.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile1.size(); i++) {
+ sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
- for (int i = 0; i < Pile2.size(); i++) {
- sb.append(Pile2.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile2.size(); i++) {
+ sb.append(pile2.get(i).getName() + "\r\n");
}
- Object[] possibleValues = { "Pile 1", "Pile 2" };
- Object q = JOptionPane.showOptionDialog(null, sb, "Fact or Fiction",
+ final Object[] possibleValues = { "Pile 1", "Pile 2" };
+ final Object q = JOptionPane.showOptionDialog(null, sb, "Fact or Fiction",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, possibleValues,
possibleValues[0]);
if (q.equals(0)) {
- for (int i = 0; i < Pile1.size(); i++) {
- AllZone.getGameAction().moveTo(hand, Pile1.get(i));
+ for (int i = 0; i < pile1.size(); i++) {
+ AllZone.getGameAction().moveTo(hand, pile1.get(i));
}
- for (int i = 0; i < Pile2.size(); i++) {
- AllZone.getGameAction().moveToGraveyard(Pile2.get(i));
+ for (int i = 0; i < pile2.size(); i++) {
+ AllZone.getGameAction().moveToGraveyard(pile2.get(i));
}
} else {
- for (int i = 0; i < Pile2.size(); i++) {
- AllZone.getGameAction().moveTo(hand, Pile2.get(i));
+ for (int i = 0; i < pile2.size(); i++) {
+ AllZone.getGameAction().moveTo(hand, pile2.get(i));
}
- for (int i = 0; i < Pile1.size(); i++) {
- AllZone.getGameAction().moveToGraveyard(Pile1.get(i));
+ for (int i = 0; i < pile1.size(); i++) {
+ AllZone.getGameAction().moveToGraveyard(pile1.get(i));
}
}
}
- Pile1.clear();
- Pile2.clear();
+ pile1.clear();
+ pile2.clear();
} // resolve()
@Override
public boolean canPlayAI() {
- CardList cards = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
+ final CardList cards = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
return cards.size() >= 10;
}
}; // SpellAbility
@@ -260,25 +255,25 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Echoing Decay")) {
- Cost cost = new Cost(card.getManaCost(), cardName, false);
- Target tgt = new Target(card, "C");
+ final Cost cost = new Cost(card.getManaCost(), cardName, false);
+ final Target tgt = new Target(card, "C");
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = 3154935854257358023L;
@Override
public boolean canPlayAI() {
- CardList c = getCreature();
+ final CardList c = this.getCreature();
if (c.isEmpty()) {
return false;
} else {
- setTargetCard(c.get(0));
+ this.setTargetCard(c.get(0));
return true;
}
} // canPlayAI()
CardList getCreature() {
- CardList out = new CardList();
- CardList list = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
+ final CardList out = new CardList();
+ final CardList list = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
list.shuffle();
for (int i = 0; i < list.size(); i++) {
@@ -289,8 +284,8 @@ public class CardFactory_Instants {
// in case human player only has a few creatures in play,
// target anything
- if (out.isEmpty() && 0 < CardFactoryUtil.AI_getHumanCreature(2, card, true).size()
- && 3 > CardFactoryUtil.AI_getHumanCreature(card, true).size()) {
+ if (out.isEmpty() && (0 < CardFactoryUtil.AI_getHumanCreature(2, card, true).size())
+ && (3 > CardFactoryUtil.AI_getHumanCreature(card, true).size())) {
out.addAll(CardFactoryUtil.AI_getHumanCreature(2, card, true));
CardListUtil.sortFlying(out);
}
@@ -299,8 +294,9 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
- final Card c = getTargetCard();
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
+ final Card c = this.getTargetCard();
c.addTempAttackBoost(-2);
c.addTempDefenseBoost(-2);
@@ -308,6 +304,7 @@ public class CardFactory_Instants {
AllZone.getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 1327455269456577020L;
+ @Override
public void execute() {
c.addTempAttackBoost(2);
c.addTempDefenseBoost(2);
@@ -317,10 +314,10 @@ public class CardFactory_Instants {
// get all creatures
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
- list = list.getName(getTargetCard().getName());
- list.remove(getTargetCard());
+ list = list.getName(this.getTargetCard().getName());
+ list.remove(this.getTargetCard());
- if (!getTargetCard().isFaceDown()) {
+ if (!this.getTargetCard().isFaceDown()) {
for (int i = 0; i < list.size(); i++) {
final Card crd = list.get(i);
@@ -330,6 +327,7 @@ public class CardFactory_Instants {
AllZone.getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 5151337777143949221L;
+ @Override
public void execute() {
crd.addTempAttackBoost(2);
crd.addTempDefenseBoost(2);
@@ -349,15 +347,15 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Hidetsugu's Second Rite")) {
- Target t = new Target(card, "Select target player", "Player");
- Cost cost = new Cost("3 R", cardName, false);
+ final Target t = new Target(card, "Select target player", "Player");
+ final Cost cost = new Cost("3 R", cardName, false);
final SpellAbility spell = new Spell(card, cost, t) {
private static final long serialVersionUID = 176857775451818523L;
@Override
public void resolve() {
- if (getTargetPlayer().getLife() == 10) {
- getTargetPlayer().addDamage(10, card);
+ if (this.getTargetPlayer().getLife() == 10) {
+ this.getTargetPlayer().addDamage(10, card);
}
}
@@ -381,51 +379,53 @@ public class CardFactory_Instants {
@Override
public boolean canPlayAI() {
- CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
- return 4 < AllZone.getPhase().getTurn() && 0 < human.size();
+ final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
+ return (4 < AllZone.getPhase().getTurn()) && (0 < human.size());
}
@Override
public void chooseTargetAI() {
- CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
- setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
+ final CardList human = CardFactoryUtil.AI_getHumanCreature(card, true);
+ this.setTargetCard(CardFactoryUtil.AI_getBestCreature(human));
}
@Override
public void resolve() {
// if target card is not in play, just quit
- if (!AllZoneUtil.isCardInPlay(getTargetCard()) || !CardFactoryUtil.canTarget(card, getTargetCard())) {
+ if (!AllZoneUtil.isCardInPlay(this.getTargetCard())
+ || !CardFactoryUtil.canTarget(card, this.getTargetCard())) {
return;
}
// get all permanents
- CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
- CardList sameName = all.getName(getTargetCard().getName());
+ CardList sameName = all.getName(this.getTargetCard().getName());
sameName = sameName.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return !c.isFaceDown();
}
});
- if (!getTargetCard().isFaceDown()) {
+ if (!this.getTargetCard().isFaceDown()) {
// bounce all permanents with the same name
for (int i = 0; i < sameName.size(); i++) {
if (sameName.get(i).isToken()) {
AllZone.getGameAction().exile(sameName.get(i));
} else {
- PlayerZone hand = sameName.get(i).getOwner().getZone(Constant.Zone.Hand);
+ final PlayerZone hand = sameName.get(i).getOwner().getZone(Constant.Zone.Hand);
AllZone.getGameAction().moveTo(hand, sameName.get(i));
}
} // for
} // if (!isFaceDown())
else {
- PlayerZone hand = getTargetCard().getOwner().getZone(Constant.Zone.Hand);
- AllZone.getGameAction().moveTo(hand, getTargetCard());
+ final PlayerZone hand = this.getTargetCard().getOwner().getZone(Constant.Zone.Hand);
+ AllZone.getGameAction().moveTo(hand, this.getTargetCard());
}
} // resolve()
}; // SpellAbility
- Input target = new Input() {
+ final Input target = new Input() {
private static final long serialVersionUID = -3978705328511825933L;
@Override
@@ -436,19 +436,20 @@ public class CardFactory_Instants {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
public void selectCard(final Card card, final PlayerZone zone) {
- if (!card.isLand() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(spell, card)) {
+ if (!card.isLand() && zone.is(Constant.Zone.Battlefield)
+ && CardFactoryUtil.canTarget(spell, card)) {
spell.setTargetCard(card);
if (this.isFree()) {
this.setFree(false);
AllZone.getStack().add(spell);
- stop();
+ this.stop();
} else {
- stopSetNext(new Input_PayManaCost(spell));
+ this.stopSetNext(new Input_PayManaCost(spell));
}
}
}
@@ -468,22 +469,22 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- Player player = card.getController();
+ final Player player = card.getController();
if (player.isHuman()) {
- humanResolve();
+ this.humanResolve();
} else {
- computerResolve();
+ this.computerResolve();
}
player.shuffle();
}
public void humanResolve() {
- CardList libraryList = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
- CardList selectedCards = new CardList();
+ final CardList libraryList = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
+ final CardList selectedCards = new CardList();
Object o = GuiUtils.getChoiceOptional("Select first card", libraryList.toArray());
if (o != null) {
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
libraryList.remove(c1);
selectedCards.add(c1);
} else {
@@ -491,7 +492,7 @@ public class CardFactory_Instants {
}
o = GuiUtils.getChoiceOptional("Select second card", libraryList.toArray());
if (o != null) {
- Card c2 = (Card) o;
+ final Card c2 = (Card) o;
libraryList.remove(c2);
selectedCards.add(c2);
} else {
@@ -499,7 +500,7 @@ public class CardFactory_Instants {
}
o = GuiUtils.getChoiceOptional("Select third card", libraryList.toArray());
if (o != null) {
- Card c3 = (Card) o;
+ final Card c3 = (Card) o;
libraryList.remove(c3);
selectedCards.add(c3);
} else {
@@ -507,19 +508,19 @@ public class CardFactory_Instants {
}
// comp randomly selects one of the three cards
- Card choice = selectedCards.get(MyRandom.random.nextInt(2));
+ final Card choice = selectedCards.get(MyRandom.random.nextInt(2));
selectedCards.remove(choice);
AllZone.getGameAction().moveToHand(choice);
- for (Card trash : selectedCards) {
+ for (final Card trash : selectedCards) {
AllZone.getGameAction().moveToGraveyard(trash);
}
}
public void computerResolve() {
- CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
- CardList selectedCards = new CardList();
+ final CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
+ final CardList selectedCards = new CardList();
// pick best creature
Card c = CardFactoryUtil.AI_getBestCreature(list);
@@ -545,21 +546,21 @@ public class CardFactory_Instants {
// NOTE: Using getChoiceOptional() results in a null error
// when you click on Cancel.
- Object o = GuiUtils.getChoice("Select card to give to computer", selectedCards.toArray());
+ final Object o = GuiUtils.getChoice("Select card to give to computer", selectedCards.toArray());
- Card choice = (Card) o;
+ final Card choice = (Card) o;
selectedCards.remove(choice);
AllZone.getGameAction().moveToHand(choice);
- for (Card trash : selectedCards) {
+ for (final Card trash : selectedCards) {
AllZone.getGameAction().moveToGraveyard(trash);
}
}
@Override
public boolean canPlay() {
- CardList library = card.getController().getCardsIn(Zone.Library);
+ final CardList library = card.getController().getCardsIn(Zone.Library);
return library.size() >= 3;
}
@@ -625,10 +626,10 @@ public class CardFactory_Instants {
/*
* Return all artifacts target player owns to his or her hand.
*/
- Target t = new Target(card, "Select target player", "Player");
- Cost cost = new Cost("1 U", cardName, false);
+ final Target t = new Target(card, "Select target player", "Player");
+ final Cost cost = new Cost("1 U", cardName, false);
- SpellAbility spell = new Spell(card, cost, t) {
+ final SpellAbility spell = new Spell(card, cost, t) {
private static final long serialVersionUID = -4098702062413878046L;
@Override
@@ -640,17 +641,17 @@ public class CardFactory_Instants {
@Override
public void chooseTargetAI() {
- setTargetPlayer(AllZone.getHumanPlayer());
+ this.setTargetPlayer(AllZone.getHumanPlayer());
} // chooseTargetAI()
@Override
public void resolve() {
- Player player = getTargetPlayer();
+ final Player player = this.getTargetPlayer();
CardList artifacts = AllZoneUtil.getCardsIn(Zone.Battlefield);
artifacts = artifacts.getType("Artifact");
for (int i = 0; i < artifacts.size(); i++) {
- Card thisArtifact = artifacts.get(i);
+ final Card thisArtifact = artifacts.get(i);
if (thisArtifact.getOwner().equals(player)) {
// moveToHand handles tokens
AllZone.getGameAction().moveToHand(thisArtifact);
@@ -660,56 +661,56 @@ public class CardFactory_Instants {
};
card.addSpellAbility(spell);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Suffer the Past")) {
- Cost cost = new Cost("X B", cardName, false);
- Target tgt = new Target(card, "Select a Player", "Player");
+ final Cost cost = new Cost("X B", cardName, false);
+ final Target tgt = new Target(card, "Select a Player", "Player");
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = 1168802375190293222L;
@Override
public void resolve() {
- Player tPlayer = getTargetPlayer();
- Player player = card.getController();
+ final Player tPlayer = this.getTargetPlayer();
+ final Player player = card.getController();
final int max = card.getXManaCostPaid();
- CardList graveList = tPlayer.getCardsIn(Zone.Graveyard);
- int X = Math.min(max, graveList.size());
+ final CardList graveList = tPlayer.getCardsIn(Zone.Graveyard);
+ final int x = Math.min(max, graveList.size());
if (player.isHuman()) {
- for (int i = 0; i < X; i++) {
- Object o = GuiUtils.getChoice("Remove from game", graveList.toArray());
+ for (int i = 0; i < x; i++) {
+ final Object o = GuiUtils.getChoice("Remove from game", graveList.toArray());
if (o == null) {
break;
}
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
graveList.remove(c1); // remove from the display
// list
AllZone.getGameAction().exile(c1);
}
} else { // Computer
// Random random = MyRandom.random;
- for (int j = 0; j < X; j++) {
+ for (int j = 0; j < x; j++) {
// int index = random.nextInt(X-j);
AllZone.getGameAction().exile(graveList.get(j));
}
}
- tPlayer.loseLife(X, card);
- player.gainLife(X, card);
+ tPlayer.loseLife(x, card);
+ player.gainLife(x, card);
card.setXManaCostPaid(0);
}
@Override
public void chooseTargetAI() {
- setTargetPlayer(AllZone.getHumanPlayer());
+ this.setTargetPlayer(AllZone.getHumanPlayer());
} // chooseTargetAI()
@Override
public boolean canPlayAI() {
- CardList graveList = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
+ final CardList graveList = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
final int maxX = ComputerUtil.getAvailableMana().size() - 1;
return (maxX >= 3) && (graveList.size() > 0);
@@ -726,21 +727,21 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- Player player = card.getController();
- CardList libList = player.getCardsIn(Zone.Library);
+ final Player player = card.getController();
+ final CardList libList = player.getCardsIn(Zone.Library);
final String[] input = new String[1];
input[0] = JOptionPane.showInputDialog(null, "Which card?", "Pick card",
JOptionPane.QUESTION_MESSAGE);
for (int i = 0; i < 7; i++) {
- Card c = libList.get(i);
+ final Card c = libList.get(i);
AllZone.getGameAction().exile(c);
}
- int max = libList.size();
+ final int max = libList.size();
int stop = 0;
for (int i = 0; i < max; i++) {
- Card c = libList.get(i);
+ final Card c = libList.get(i);
if (c.getName().equals(input[0])) {
if (stop == 0) {
AllZone.getGameAction().moveToHand(c);
@@ -755,8 +756,8 @@ public class CardFactory_Instants {
@Override
public boolean canPlay() {
- CardList libList = card.getController().getCardsIn(Zone.Library);
- return libList.size() > 6 && super.canPlay();
+ final CardList libList = card.getController().getCardsIn(Zone.Library);
+ return (libList.size() > 6) && super.canPlay();
}
@Override
@@ -765,7 +766,9 @@ public class CardFactory_Instants {
}
}; // SpellAbility
- spell.setStackDescription("Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way");
+ spell.setStackDescription("Name a card. Exile the top six cards of your library, "
+ + "then reveal cards from the top of your library until you reveal the named card. "
+ + "Put that card into your hand and exile all other cards revealed this way");
card.addSpellAbility(spell);
} // *************** END ************ END **************************
@@ -797,15 +800,15 @@ public class CardFactory_Instants {
public void resolve() {
// this needs to get a list of opponents creatures and set
// the siren flag
- Player player = card.getController();
- Player opponent = player.getOpponent();
- CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
- for (Card creature : creatures) {
+ final Player player = card.getController();
+ final Player opponent = player.getOpponent();
+ final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
+ for (final Card creature : creatures) {
// skip walls, skip creatures with summoning sickness
// also skip creatures with haste if they came onto the
// battlefield this turn
if ((!creature.isWall() && !creature.hasSickness())
- || (creature.hasKeyword("Haste") && creature.getTurnInZone() != 1)) {
+ || (creature.hasKeyword("Haste") && (creature.getTurnInZone() != 1))) {
creature.setSirenAttackOrDestroy(true);
// System.out.println("Siren's Call - setting flag for "+creature.getName());
}
@@ -813,11 +816,11 @@ public class CardFactory_Instants {
final SpellAbility destroy = new Ability(card, "0") {
@Override
public void resolve() {
- Player player = card.getController();
- Player opponent = player.getOpponent();
- CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
+ final Player player = card.getController();
+ final Player opponent = player.getOpponent();
+ final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
- for (Card creature : creatures) {
+ for (final Card creature : creatures) {
// System.out.println("Siren's Call - EOT - "+creature.getName()
// +" flag: "+creature.getSirenAttackOrDestroy());
// System.out.println("Siren's Call - EOT - "+creature.getName()
@@ -833,14 +836,16 @@ public class CardFactory_Instants {
}
}
};
- Command atEOT = new Command() {
+ final Command atEOT = new Command() {
private static final long serialVersionUID = 5369528776959445848L;
+ @Override
public void execute() {
- StringBuilder sb = new StringBuilder();
- sb.append(card)
- .append(" - At the beginning of the next end step, destroy all non-Wall creatures that player controls that didn't attack this turn. ");
- sb.append("Ignore this effect for each creature the player didn't control continuously since the beginning of the turn.");
+ final StringBuilder sb = new StringBuilder();
+ sb.append(card).append(" - At the beginning of the next end step, ");
+ sb.append("destroy all non-Wall creatures that player controls that didn't ");
+ sb.append("attack this turn. Ignore this effect for each creature the player ");
+ sb.append("didn't control continuously since the beginning of the turn.");
destroy.setDescription(sb.toString());
destroy.setStackDescription(sb.toString());
@@ -851,7 +856,7 @@ public class CardFactory_Instants {
} // resolve
}; // SpellAbility
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - All creatures that can attack must do so or be destroyed.");
spell.setStackDescription(sb.toString());
@@ -862,7 +867,7 @@ public class CardFactory_Instants {
else if (cardName.equals("Telling Time")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 2626878556107707854L;
- String[] prompt = new String[] { "Put a card into your hand", "Put a card on top of library",
+ private String[] prompt = new String[] { "Put a card into your hand", "Put a card on top of library",
"Put a card on bottom of library" };
@Override
@@ -872,15 +877,15 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- PlayerZone lib = card.getController().getZone(Constant.Zone.Library);
- CardList choices = new CardList();
- for (int i = 0; i < 3 && lib.size() > 0; i++) {
+ final PlayerZone lib = card.getController().getZone(Constant.Zone.Library);
+ final CardList choices = new CardList();
+ for (int i = 0; (i < 3) && (lib.size() > 0); i++) {
choices.add(lib.get(i));
}
- for (int i = 0; i < 3 && !choices.isEmpty(); i++) {
- Object o = GuiUtils.getChoice(prompt[i], choices.toArray());
- Card c1 = (Card) o;
+ for (int i = 0; (i < 3) && !choices.isEmpty(); i++) {
+ final Object o = GuiUtils.getChoice(this.prompt[i], choices.toArray());
+ final Card c1 = (Card) o;
if (i == 0) {
AllZone.getGameAction().moveToHand(c1);
} else if (i == 1) {
@@ -895,7 +900,7 @@ public class CardFactory_Instants {
};
card.addSpellAbility(spell);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Remove Enchantments")) {
@@ -910,10 +915,11 @@ public class CardFactory_Instants {
@Override
public void resolve() {
final Player you = card.getController();
- CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments);
- CardList toReturn = ens.filter(new CardListFilter() {
+ final CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments);
+ final CardList toReturn = ens.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- Card enchanting = c.getEnchantingCard();
+ final Card enchanting = c.getEnchantingCard();
if (enchanting != null) {
if ((enchanting.isAttacking() && enchanting.getController().isPlayer(you.getOpponent()))
@@ -925,11 +931,11 @@ public class CardFactory_Instants {
return (c.getOwner().isPlayer(you) && c.getController().isPlayer(you));
}
});
- for (Card c : toReturn) {
+ for (final Card c : toReturn) {
AllZone.getGameAction().moveToHand(c);
}
- for (Card c : ens) {
+ for (final Card c : ens) {
if (!toReturn.contains(c)) {
AllZone.getGameAction().destroy(c);
}
@@ -949,27 +955,28 @@ public class CardFactory_Instants {
* creature has infect, Burn the Impure deals 3 damage to that
* creature's controller.
*/
- Cost abCost = new Cost("1 R", cardName, false);
+ final Cost abCost = new Cost("1 R", cardName, false);
final SpellAbility spell = new Spell(card, abCost, new Target(card, "TgtC")) {
private static final long serialVersionUID = -3069135027502686218L;
- int damage = 3;
+ private int damage = 3;
@Override
public void chooseTargetAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
creatures = creatures.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return c.getNetAttack() <= damage && !c.hasKeyword("Indestructible");
+ return (c.getNetAttack() <= damage) && !c.hasKeyword("Indestructible");
}
});
- CardList infect = creatures.getKeyword("Infect");
+ final CardList infect = creatures.getKeyword("Infect");
if (infect.size() > 0) {
- Card c = CardFactoryUtil.AI_getBestCreature(infect);
- setTargetCard(c);
+ final Card c = CardFactoryUtil.AI_getBestCreature(infect);
+ this.setTargetCard(c);
} else {
- Card c = CardFactoryUtil.AI_getBestCreature(creatures);
- setTargetCard(c);
+ final Card c = CardFactoryUtil.AI_getBestCreature(creatures);
+ this.setTargetCard(c);
}
} // chooseTargetAI()
@@ -978,8 +985,9 @@ public class CardFactory_Instants {
public boolean canPlayAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
creatures = creatures.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return c.getNetAttack() <= damage && !c.hasKeyword("Indestructible");
+ return (c.getNetAttack() <= damage) && !c.hasKeyword("Indestructible");
}
});
return creatures.size() > 0;
@@ -987,9 +995,10 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
- Card c = getTargetCard();
- c.addDamage(damage, card);
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
+ final Card c = this.getTargetCard();
+ c.addDamage(this.damage, card);
if (c.hasKeyword("Infect")) {
c.getController().addDamage(3, card);
}
@@ -997,7 +1006,7 @@ public class CardFactory_Instants {
}
}; // SpellAbility
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append(cardName);
sb.append(" deals 3 damage to target creature. If that creature has infect, ");
sb.append(cardName);
@@ -1014,8 +1023,8 @@ public class CardFactory_Instants {
* of the chosen type target player controls, or untap all tapped
* permanents of that type that player controls.
*/
- Cost abCost = new Cost("2 U U", cardName, false);
- Target target = new Target(card, "Select target player", "Player".split(","));
+ final Cost abCost = new Cost("2 U U", cardName, false);
+ final Target target = new Target(card, "Select target player", "Player".split(","));
final SpellAbility spell = new Spell(card, abCost, target) {
private static final long serialVersionUID = -2175586347805121896L;
@@ -1026,16 +1035,16 @@ public class CardFactory_Instants {
@Override
public void resolve() {
- String[] choices = new String[] { "Artifact", "Creature", "Land" };
- Object o = GuiUtils.getChoice("Select permanent type", choices);
- String cardType = (String) o;
- CardList list = getTargetPlayer().getCardsIn(Zone.Battlefield).getType(cardType);
+ final String[] choices = new String[] { "Artifact", "Creature", "Land" };
+ final Object o = GuiUtils.getChoice("Select permanent type", choices);
+ final String cardType = (String) o;
+ final CardList list = this.getTargetPlayer().getCardsIn(Zone.Battlefield).getType(cardType);
- String[] tapOrUntap = new String[] { "Tap", "Untap" };
- Object z = GuiUtils.getChoice("Tap or Untap?", tapOrUntap);
- boolean tap = (z.equals("Tap")) ? true : false;
+ final String[] tapOrUntap = new String[] { "Tap", "Untap" };
+ final Object z = GuiUtils.getChoice("Tap or Untap?", tapOrUntap);
+ final boolean tap = (z.equals("Tap")) ? true : false;
- for (Card c : list) {
+ for (final Card c : list) {
if (tap) {
c.tap();
} else {
@@ -1050,19 +1059,19 @@ public class CardFactory_Instants {
// *************** START *********** START **************************
else if (cardName.equals("Wing Puncture")) {
- Target t2 = new Target(card, "Select target creature with flying", "Creature.withFlying".split(","));
+ final Target t2 = new Target(card, "Select target creature with flying", "Creature.withFlying".split(","));
final Ability_Sub sub = new Ability_Sub(card, t2) {
private static final long serialVersionUID = 4618047889975691050L;
@Override
- public boolean chkAI_Drawback() {
+ public boolean chkAIDrawback() {
return false;
}
@Override
public void resolve() {
- Card myc = this.getParent().getTargetCard();
- Card tgt = getTargetCard();
+ final Card myc = this.getParent().getTargetCard();
+ final Card tgt = this.getTargetCard();
if (AllZoneUtil.isCardInPlay(myc) && AllZoneUtil.isCardInPlay(tgt)) {
if (CardFactoryUtil.canTarget(card, myc) && CardFactoryUtil.canTarget(card, tgt)) {
tgt.addDamage(myc.getNetAttack(), myc);
@@ -1076,8 +1085,8 @@ public class CardFactory_Instants {
}
};
- Cost abCost = new Cost("G", cardName, false);
- Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
+ final Cost abCost = new Cost("G", cardName, false);
+ final Target t1 = new Target(card, "Select target creature you control", "Creature.YouCtrl".split(","));
final SpellAbility spell = new Spell(card, abCost, t1) {
private static final long serialVersionUID = 8964235807056739219L;
@@ -1092,7 +1101,8 @@ public class CardFactory_Instants {
}
};
spell.setSubAbility(sub);
- spell.setDescription("Target creature you control deals damage equal to its power to target creature with flying.");
+ spell.setDescription("Target creature you control deals damage "
+ + "equal to its power to target creature with flying.");
spell.setStackDescription(card
+ " - Creature you control deals damage equal to its power to creature with flying.");
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Lands.java b/src/main/java/forge/card/cardFactory/CardFactory_Lands.java
index e36df31bb1f..e4d2008c618 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Lands.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Lands.java
@@ -99,11 +99,11 @@ class CardFactory_Lands {
tapCard();
}
- }// if
+ } // if
else {
tapCard();
}
- }// execute()
+ } // execute()
private void tapCard() {
// it enters the battlefield this way, and should not fire
@@ -111,7 +111,7 @@ class CardFactory_Lands {
card.setTapped(true);
}
});
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Dark Depths")) {
@@ -174,7 +174,11 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(card);
}
};
- // ability.setDescription("Dark Depths enters the battlefield with ten ice counters on it.\r\n\r\n3: Remove an ice counter from Dark Depths.\r\n\r\nWhen Dark Depths has no ice counters on it, sacrifice it. If you do, put an indestructible legendary 20/20 black Avatar creature token with flying named Marit Lage onto the battlefield.");
+ // ability.setDescription("Dark Depths enters the battlefield with
+ //ten ice counters on it.\r\n\r\n3: Remove an ice counter from Dark Depths.
+ //\r\n\r\nWhen Dark Depths has no ice counters on it, sacrifice it.
+ //If you do, put an indestructible legendary 20/20 black Avatar creature token
+ //with flying named Marit Lage onto the battlefield.");
ability.setDescription("3: remove an Ice Counter.");
StringBuilder sb = new StringBuilder();
sb.append(card.getName()).append(" - remove an ice counter.");
@@ -183,7 +187,7 @@ class CardFactory_Lands {
card.addSpellAbility(ability);
sacrifice.setStackDescription("Sacrifice " + card.getName());
card.addSpellAbility(sacrifice);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Novijen, Heart of Progress")) {
@@ -201,7 +205,7 @@ class CardFactory_Lands {
Ability_Activated ability = new Ability_Activated(card, abCost, null) {
private static final long serialVersionUID = 1416258136308898492L;
- CardList inPlay = new CardList();
+ private CardList inPlay = new CardList();
@Override
public boolean canPlayAI() {
@@ -241,7 +245,7 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = -194247993330560188L;
- final Player player = card.getController();
+ private final Player player = card.getController();
public void execute() {
if (player.isHuman()) {
@@ -271,8 +275,8 @@ class CardFactory_Lands {
stop();
}
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped)
.size() < 2)) {
AllZone.getGameAction().sacrifice(card);
@@ -288,7 +292,7 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Kjeldoran Outpost") || cardName.equals("Balduvian Trading Post")
@@ -310,7 +314,7 @@ class CardFactory_Lands {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 6175830918425915833L;
- final Player player = card.getController();
+ private final Player player = card.getController();
public void execute() {
final CardList land = player.getCardsIn(Zone.Battlefield).getValidCards(type[0], player, card);
@@ -349,15 +353,15 @@ class CardFactory_Lands {
AllZone.getGameAction().sacrifice(c);
stop();
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Sheltered Valley")) {
@@ -379,13 +383,13 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Scorched Ruins")) {
final Command comesIntoPlay = new Command() {
private static final long serialVersionUID = 6175830918425915833L;
- final Player player = card.getController();
+ private final Player player = card.getController();
public void execute() {
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
@@ -438,15 +442,15 @@ class CardFactory_Lands {
stop();
}
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
// Lorwyn Dual Lands, and a couple Morningtide...
@@ -526,14 +530,14 @@ class CardFactory_Lands {
stop();
}
});
- }// execute()
+ } // execute()
private void revealCard(final Card c) {
JOptionPane.showMessageDialog(null, c.getController() + " reveals " + c.getName(), card.getName(),
JOptionPane.PLAIN_MESSAGE);
}
});
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START ************ START **************************
else if (cardName.equals("Calciform Pools") || cardName.equals("Dreadship Reef")
@@ -634,7 +638,8 @@ class CardFactory_Lands {
num[0] = Integer.parseInt(answer);
- String splitNum = (String) (GuiUtils.getChoiceOptional("Number of " + primary + " to add", choices));
+ String splitNum = (String) (GuiUtils.getChoiceOptional(
+ "Number of " + primary + " to add", choices));
if (splitNum == null) {
stop();
return;
@@ -654,7 +659,7 @@ class CardFactory_Lands {
addMana.setAfterPayMana(runtime);
card.addSpellAbility(addMana);
card.addSpellAbility(abMana);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Crosis's Catacombs") || cardName.equals("Darigaaz's Caldera")
@@ -701,15 +706,15 @@ class CardFactory_Lands {
AllZone.getGameAction().moveToHand(c);
stop();
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
AllZone.getInputControl().setInput(target);
}
}
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Coral Atoll") || cardName.equals("Dormant Volcano") || cardName.equals("Everglades")
@@ -762,13 +767,14 @@ class CardFactory_Lands {
AllZone.getGameAction().moveToHand(c);
stop();
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
AllZone.getInputControl().setInput(target);
}
}
};
- sacOrNo.setStackDescription("When CARDNAME enters the battlefield, sacrifice it unless you return an untapped "
+ sacOrNo.setStackDescription("When CARDNAME enters the battlefield, "
+ + "sacrifice it unless you return an untapped "
+ type[0] + " you control to its owner's hand.");
final Command comesIntoPlay = new Command() {
@@ -780,9 +786,9 @@ class CardFactory_Lands {
};
card.addComesIntoPlayCommand(comesIntoPlay);
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
return card;
}
-}// end class CardFactory_Lands
+} // end class CardFactory_Lands
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Planeswalkers.java b/src/main/java/forge/card/cardFactory/CardFactory_Planeswalkers.java
index dbecd7334e5..e1c324fecf6 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Planeswalkers.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Planeswalkers.java
@@ -65,27 +65,28 @@ public class CardFactory_Planeswalkers {
turn[0] = -1;
// ability2: target creature gets +3/+3 and flying until EOT
- Target target2 = new Target(card, "TgtC");
- Cost cost2 = new Cost("AddCounter<1/LOYALTY>", cardName, true);
+ final Target target2 = new Target(card, "TgtC");
+ final Cost cost2 = new Cost("AddCounter<1/LOYALTY>", cardName, true);
final SpellAbility ability2 = new Ability_Activated(card, cost2, target2) {
private static final long serialVersionUID = 6624768423224398603L;
@Override
public void resolve() {
turn[0] = AllZone.getPhase().getTurn();
- final Card c = getTargetCard();
+ final Card c = this.getTargetCard();
final Command eot = new Command() {
private static final long serialVersionUID = 94488363210770877L;
+ @Override
public void execute() {
if (AllZoneUtil.isCardInPlay(c)) {
c.addTempAttackBoost(-3);
c.addTempDefenseBoost(-3);
c.removeExtrinsicKeyword("Flying");
}
- }// execute()
- };// Command
+ } // execute()
+ }; // Command
if (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
c.addTempAttackBoost(3);
c.addTempDefenseBoost(3);
@@ -93,7 +94,7 @@ public class CardFactory_Planeswalkers {
AllZone.getEndOfTurn().addUntil(eot);
}
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
@@ -103,15 +104,15 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability2
+ } // canPlay()
+ }; // SpellAbility ability2
// ability3
- Cost cost3 = new Cost("SubCounter<8/LOYALTY>", cardName, true);
+ final Cost cost3 = new Cost("SubCounter<8/LOYALTY>", cardName, true);
final SpellAbility ability3 = new Ability_Activated(card, cost3, null) {
private static final long serialVersionUID = -830373718591602944L;
@@ -119,12 +120,13 @@ public class CardFactory_Planeswalkers {
public void resolve() {
turn[0] = AllZone.getPhase().getTurn();
- Card emblem = new Card();
+ final Card emblem = new Card();
// should we even name this permanent?
// emblem.setName("Elspeth Emblem");
emblem.addIntrinsicKeyword("Indestructible");
emblem.addIntrinsicKeyword("Shroud");
- emblem.addIntrinsicKeyword("Artifacts, creatures, enchantments, and lands you control are indestructible.");
+ emblem.addIntrinsicKeyword("Artifacts, creatures, enchantments, "
+ + "and lands you control are indestructible.");
emblem.setImmutable(true);
emblem.addType("Emblem");
emblem.addController(card.getController());
@@ -134,34 +136,36 @@ public class CardFactory_Planeswalkers {
// AllZone.getGameAction().checkStateEffects();
AllZone.getStaticEffects().rePopulateStateBasedList();
- for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
- Command com = GameActionUtil.commands.get(effect);
+ for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
+ final Command com = GameActionUtil.commands.get(effect);
com.execute();
}
}
@Override
public boolean canPlay() {
- return 8 <= card.getCounters(Counters.LOYALTY)
+ return (8 <= card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
@Override
public boolean canPlayAI() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isEmblem()
- && c.hasKeyword("Artifacts, creatures, enchantments, and lands you control are indestructible.");
+ && c.hasKeyword("Artifacts, creatures, enchantments, "
+ + "and lands you control are indestructible.");
}
});
- return list.size() == 0 && card.getCounters(Counters.LOYALTY) > 8;
+ return (list.size() == 0) && (card.getCounters(Counters.LOYALTY) > 8);
}
};
// ability 1: create white 1/1 token
- Cost cost1 = new Cost("AddCounter<1/LOYALTY>", cardName, true);
+ final Cost cost1 = new Cost("AddCounter<1/LOYALTY>", cardName, true);
final SpellAbility ability1 = new Ability_Activated(card, cost1, null) {
private static final long serialVersionUID = -6766888113766637596L;
@@ -184,11 +188,11 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability1
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
+ }; // SpellAbility ability1
ability1.setDescription("+1: Put a 1/1 white Soldier creature token onto the battlefield.");
ability1.setStackDescription(card + " - put a 1/1 white Soldier creature token onto the battlefield.");
@@ -199,9 +203,10 @@ public class CardFactory_Planeswalkers {
card.addSpellAbility(ability2);
- ability3.setDescription("-8: You get an emblem with \"Artifacts, creatures, enchantments, and lands you control are indestructible.\"");
- ability3.setStackDescription(card
- + " - You get an emblem with \"Artifacts, creatures, enchantments, and lands you control are indestructible.\"");
+ ability3.setDescription("-8: You get an emblem with \"Artifacts, "
+ + "creatures, enchantments, and lands you control are indestructible.\"");
+ ability3.setStackDescription(card + " - You get an emblem with \"Artifacts, creatures, enchantments, "
+ + "and lands you control are indestructible.\"");
card.addSpellAbility(ability3);
card.setSVars(card.getSVars());
@@ -221,15 +226,16 @@ public class CardFactory_Planeswalkers {
// ability2: Put a +1/+1 counter on each creature you control. Those
// creatures gain vigilance until end of turn.
final SpellAbility ability2 = new Ability(card, "0") {
- final Command untilEOT = new Command() {
+ private final Command untilEOT = new Command() {
private static final long serialVersionUID = -5436621445704076988L;
+ @Override
public void execute() {
- Player player = card.getController();
- CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
+ final Player player = card.getController();
+ final CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
for (int i = 0; i < creatures.size(); i++) {
- Card card = creatures.get(i);
+ final Card card = creatures.get(i);
card.removeExtrinsicKeyword("Vigilance");
}
}
@@ -240,16 +246,16 @@ public class CardFactory_Planeswalkers {
card.subtractCounter(Counters.LOYALTY, 1);
turn[0] = AllZone.getPhase().getTurn();
- Player player = card.getController();
- CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
+ final Player player = card.getController();
+ final CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
for (int i = 0; i < creatures.size(); i++) {
- Card card = creatures.get(i);
+ final Card card = creatures.get(i);
card.addCounter(Counters.P1P1, 1);
card.addExtrinsicKeyword("Vigilance");
}
- AllZone.getEndOfTurn().addUntil(untilEOT);
+ AllZone.getEndOfTurn().addUntil(this.untilEOT);
}
@Override
@@ -260,26 +266,26 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability2
+ } // canPlay()
+ }; // SpellAbility ability2
ability2.setBeforePayMana(new Input() {
private static final long serialVersionUID = 6373573398967821630L;
- int check = -1;
+ private int check = -1;
@Override
public void showMessage() {
- if (check != AllZone.getPhase().getTurn()) {
- check = AllZone.getPhase().getTurn();
+ if (this.check != AllZone.getPhase().getTurn()) {
+ this.check = AllZone.getPhase().getTurn();
turn[0] = AllZone.getPhase().getTurn();
AllZone.getStack().add(ability2);
}
- stop();
- }// showMessage()
+ this.stop();
+ } // showMessage()
});
// ability3
@@ -290,7 +296,7 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
// Create token
- int n = card.getController().getLife();
+ final int n = card.getController().getLife();
CardFactoryUtil.makeToken("Avatar", "W N N Avatar", card.getController(), "W", new String[] {
"Creature", "Avatar" }, n, n,
new String[] { "This creature's power and toughness are each equal to your life total" });
@@ -298,10 +304,10 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 6 <= card.getCounters(Counters.LOYALTY)
+ return (6 <= card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
@Override
public boolean canPlayAI() {
@@ -313,17 +319,17 @@ public class CardFactory_Planeswalkers {
ability3.setBeforePayMana(new Input() {
private static final long serialVersionUID = 7530960428366291386L;
- int check = -1;
+ private int check = -1;
@Override
public void showMessage() {
- if (check != AllZone.getPhase().getTurn()) {
- check = AllZone.getPhase().getTurn();
+ if (this.check != AllZone.getPhase().getTurn()) {
+ this.check = AllZone.getPhase().getTurn();
turn[0] = AllZone.getPhase().getTurn();
AllZone.getStack().add(ability3);
}
- stop();
- }// showMessage()
+ this.stop();
+ } // showMessage()
});
// ability 1: gain 2 life
@@ -348,42 +354,46 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability1
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
+ }; // SpellAbility ability1
ability1.setBeforePayMana(new Input() {
private static final long serialVersionUID = -7969603493514210825L;
- int check = -1;
+ private int check = -1;
@Override
public void showMessage() {
- if (check != AllZone.getPhase().getTurn()) {
- check = AllZone.getPhase().getTurn();
+ if (this.check != AllZone.getPhase().getTurn()) {
+ this.check = AllZone.getPhase().getTurn();
turn[0] = AllZone.getPhase().getTurn();
AllZone.getStack().add(ability1);
}
- stop();
- }// showMessage()
+ this.stop();
+ } // showMessage()
});
ability1.setDescription("+1: You gain 2 life.");
- StringBuilder stack1 = new StringBuilder();
+ final StringBuilder stack1 = new StringBuilder();
stack1.append("Ajani Goldmane - ").append(card.getController()).append(" gains 2 life");
ability1.setStackDescription(stack1.toString());
// ability1.setStackDescription("Ajani Goldmane - " +
// card.getController() + " gains 2 life");
card.addSpellAbility(ability1);
- ability2.setDescription("-1: Put a +1/+1 counter on each creature you control. Those creatures gain vigilance until end of turn.");
- ability2.setStackDescription("Ajani Goldmane - Put a +1/+1 counter on each creature you control. They get vigilance.");
+ ability2.setDescription("-1: Put a +1/+1 counter on each creature you control. "
+ + " Those creatures gain vigilance until end of turn.");
+ ability2.setStackDescription("Ajani Goldmane - Put a +1/+1 counter on each "
+ + "creature you control. They get vigilance.");
card.addSpellAbility(ability2);
- ability3.setDescription("-6: Put a white Avatar creature token onto the battlefield. It has \"This creature's power and toughness are each equal to your life total.\"");
- ability3.setStackDescription("Ajani Goldmane - Put a X/X white Avatar creature token onto the battlefield.");
+ ability3.setDescription("-6: Put a white Avatar creature token onto the battlefield. "
+ + "It has \"This creature's power and toughness are each equal to your life total.\"");
+ ability3.setStackDescription("Ajani Goldmane - Put a X/X white Avatar creature "
+ + "token onto the battlefield.");
card.addSpellAbility(ability3);
card.setSVars(card.getSVars());
@@ -407,14 +417,14 @@ public class CardFactory_Planeswalkers {
card.addCounterFromNonEffect(Counters.LOYALTY, 1);
turn[0] = AllZone.getPhase().getTurn();
- if (getTargetCard() != null) {
- if (AllZoneUtil.isCardInPlay(getTargetCard())
- && CardFactoryUtil.canTarget(card, getTargetCard())) {
- Card c = getTargetCard();
+ if (this.getTargetCard() != null) {
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
+ final Card c = this.getTargetCard();
c.addDamage(1, card);
}
} else {
- getTargetPlayer().addDamage(1, card);
+ this.getTargetPlayer().addDamage(1, card);
}
}
@@ -427,18 +437,18 @@ public class CardFactory_Planeswalkers {
}
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
- setTargetPlayer(AllZone.getHumanPlayer());
- setStackDescription("Chandra Nalaar - deals 1 damage to " + AllZone.getHumanPlayer());
+ this.setTargetPlayer(AllZone.getHumanPlayer());
+ this.setStackDescription("Chandra Nalaar - deals 1 damage to " + AllZone.getHumanPlayer());
return card.getCounters(Counters.LOYALTY) < 8;
}
- };// SpellAbility ability1
+ }; // SpellAbility ability1
- Input target1 = new Input() {
+ final Input target1 = new Input() {
private static final long serialVersionUID = 5263705146686766284L;
@Override
@@ -449,7 +459,7 @@ public class CardFactory_Planeswalkers {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
@@ -459,16 +469,16 @@ public class CardFactory_Planeswalkers {
ability1.setTargetCard(card);
// stopSetNext(new Input_PayManaCost(ability1));
AllZone.getStack().add(ability1);
- stop();
+ this.stop();
}
- }// selectCard()
+ } // selectCard()
@Override
public void selectPlayer(final Player player) {
ability1.setTargetPlayer(player);
// stopSetNext(new Input_PayManaCost(ability1));
AllZone.getStack().add(ability1);
- stop();
+ this.stop();
}
};
ability1.setBeforePayMana(target1);
@@ -485,10 +495,10 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
card.subtractCounter(Counters.LOYALTY, damage2[0]);
- getTargetCard().addDamage(damage2[0], card);
+ this.getTargetCard().addDamage(damage2[0], card);
damage2[0] = 0;
- }// resolve()
+ } // resolve()
@Override
public boolean canPlay() {
@@ -499,16 +509,16 @@ public class CardFactory_Planeswalkers {
}
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
return false;
}
- };// SpellAbility ability2
+ }; // SpellAbility ability2
- Input target2 = new Input() {
+ final Input target2 = new Input() {
private static final long serialVersionUID = -2160464080456452897L;
@Override
@@ -519,7 +529,7 @@ public class CardFactory_Planeswalkers {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
@@ -529,28 +539,28 @@ public class CardFactory_Planeswalkers {
} else if (c.isCreature()) {
turn[0] = AllZone.getPhase().getTurn();
- damage2[0] = getDamage();
+ damage2[0] = this.getDamage();
ability2.setTargetCard(c);
ability2.setStackDescription("Chandra Nalaar - deals damage to " + c);
AllZone.getStack().add(ability2);
- stop();
+ this.stop();
}
- }// selectCard()
+ } // selectCard()
int getDamage() {
- int size = card.getCounters(Counters.LOYALTY);
- Object[] choice = new Object[size];
+ final int size = card.getCounters(Counters.LOYALTY);
+ final Object[] choice = new Object[size];
for (int i = 0; i < choice.length; i++) {
choice[i] = Integer.valueOf(i + 1);
}
- Integer damage = (Integer) GuiUtils.getChoice("Select X", choice);
+ final Integer damage = (Integer) GuiUtils.getChoice("Select X", choice);
return damage.intValue();
}
- };// Input target
+ }; // Input target
ability2.setBeforePayMana(target2);
ability2.setDescription("-X: Chandra Nalaar deals X damage to target creature.");
card.addSpellAbility(ability2);
@@ -563,14 +573,14 @@ public class CardFactory_Planeswalkers {
card.subtractCounter(Counters.LOYALTY, 8);
turn[0] = AllZone.getPhase().getTurn();
- getTargetPlayer().addDamage(10, card);
+ this.getTargetPlayer().addDamage(10, card);
- CardList list = AllZoneUtil.getCreaturesInPlay(getTargetPlayer());
+ final CardList list = AllZoneUtil.getCreaturesInPlay(this.getTargetPlayer());
for (int i = 0; i < list.size(); i++) {
list.get(i).addDamage(10, card);
}
- }// resolve()
+ } // resolve()
@Override
public boolean canPlay() {
@@ -581,25 +591,25 @@ public class CardFactory_Planeswalkers {
}
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && 7 < card.getCounters(Counters.LOYALTY)
+ && (turn[0] != AllZone.getPhase().getTurn()) && (7 < card.getCounters(Counters.LOYALTY))
&& Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
- setTargetPlayer(AllZone.getHumanPlayer());
- StringBuilder sb = new StringBuilder();
+ this.setTargetPlayer(AllZone.getHumanPlayer());
+ final StringBuilder sb = new StringBuilder();
sb.append("Chandra Nalaar - deals 10 damage to ").append(AllZone.getHumanPlayer());
sb.append(" and each creature he or she controls.");
- setStackDescription(sb.toString());
+ this.setStackDescription(sb.toString());
// setStackDescription("Chandra Nalaar - deals 10 damage to "
// + AllZone.getHumanPlayer()
// + " and each creature he or she controls.");
return true;
}
- };// SpellAbility ability3
+ }; // SpellAbility ability3
- Input target3 = new Input() {
+ final Input target3 = new Input() {
private static final long serialVersionUID = -3014450919506364666L;
@Override
@@ -610,7 +620,7 @@ public class CardFactory_Planeswalkers {
@Override
public void selectButtonCancel() {
- stop();
+ this.stop();
}
@Override
@@ -619,7 +629,7 @@ public class CardFactory_Planeswalkers {
ability3.setTargetPlayer(player);
- StringBuilder stack3 = new StringBuilder();
+ final StringBuilder stack3 = new StringBuilder();
stack3.append("Chandra Nalaar - deals 10 damage to ").append(player);
stack3.append(" and each creature he or she controls.");
ability3.setStackDescription(stack3.toString());
@@ -628,11 +638,12 @@ public class CardFactory_Planeswalkers {
// + " and each creature he or she controls.");
AllZone.getStack().add(ability3);
- stop();
+ this.stop();
}
- };// Input target
+ }; // Input target
ability3.setBeforePayMana(target3);
- ability3.setDescription("-8: Chandra Nalaar deals 10 damage to target player and each creature he or she controls.");
+ ability3.setDescription("-8: Chandra Nalaar deals 10 damage to target "
+ + "player and each creature he or she controls.");
card.addSpellAbility(ability3);
// end ability3
@@ -659,27 +670,28 @@ public class CardFactory_Planeswalkers {
// only computer uses the stack
CardList tapped = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
tapped = tapped.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isArtifact() && c.isTapped() && CardFactoryUtil.canTarget(card, c);
}
});
- for (int i = 0; i < 2 && i < tapped.size(); i++) {
+ for (int i = 0; (i < 2) && (i < tapped.size()); i++) {
tapped.get(i).untap();
}
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
- return card.getCounters(Counters.LOYALTY) <= 6
+ return (card.getCounters(Counters.LOYALTY) <= 6)
&& AllZone.getPhase().getPhase().equals(Constant.Phase.Main2);
}
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
};
final Input targetArtifact = new Input() {
@@ -695,28 +707,28 @@ public class CardFactory_Planeswalkers {
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (c.isArtifact() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(card, c)) {
- count++;
+ this.count++;
c.untap();
}
// doesn't use the stack, its just easier this way
- if (count == 2) {
- count = 0;
+ if (this.count == 2) {
+ this.count = 0;
turn[0] = AllZone.getPhase().getTurn();
card.addCounterFromNonEffect(Counters.LOYALTY, 1);
- stop();
+ this.stop();
}
- }// selectCard()
- };// Input
+ } // selectCard()
+ }; // Input
- Input runtime1 = new Input() {
+ final Input runtime1 = new Input() {
private static final long serialVersionUID = 871304623687370615L;
@Override
public void showMessage() {
- stopSetNext(targetArtifact);
+ this.stopSetNext(targetArtifact);
}
- };// Input
+ }; // Input
ability1.setDescription("+1: Untap up to two target artifacts.");
ability1.setStackDescription("Tezzeret the Seeker - Untap two target artifacts.");
@@ -730,35 +742,36 @@ public class CardFactory_Planeswalkers {
public void resolve() {
turn[0] = AllZone.getPhase().getTurn();
- int size = card.getCounters(Counters.LOYALTY) + 1;
- Object[] choice = new Object[size];
+ final int size = card.getCounters(Counters.LOYALTY) + 1;
+ final Object[] choice = new Object[size];
for (int i = 0; i < choice.length; i++) {
choice[i] = Integer.valueOf(i);
}
- Integer damage = (Integer) GuiUtils.getChoice("Select X", choice);
+ final Integer damage = (Integer) GuiUtils.getChoice("Select X", choice);
final int dam = damage.intValue();
card.subtractCounter(Counters.LOYALTY, dam);
CardList list = card.getController().getCardsIn(Zone.Library);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) <= dam;
+ return c.isArtifact() && (CardUtil.getConvertedManaCost(c.getManaCost()) <= dam);
}
});
if (list.size() > 0) {
- Object o = GuiUtils.getChoiceOptional("Select artifact", list.toArray());
+ final Object o = GuiUtils.getChoiceOptional("Select artifact", list.toArray());
if (o != null) {
- Card c = (Card) o;
+ final Card c = (Card) o;
if (list.contains(c)) {
AllZone.getGameAction().moveToPlay(c);
}
}
}
- }// resolve()
+ } // resolve()
@Override
public boolean canPlay() {
@@ -769,18 +782,20 @@ public class CardFactory_Planeswalkers {
}
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
return false;
}
- };// SpellAbility ability2
- ability2.setDescription("-X: Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.");
- StringBuilder stack2 = new StringBuilder();
+ }; // SpellAbility ability2
+ ability2.setDescription("-X: Search your library for an artifact card with "
+ + "converted mana cost X or less and put it onto the battlefield. Then shuffle your library.");
+ final StringBuilder stack2 = new StringBuilder();
stack2.append(card.getName());
- stack2.append(" - Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.");
+ stack2.append(" - Search your library for an artifact card with converted "
+ + "mana cost X or less and put it onto the battlefield. Then shuffle your library.");
ability2.setStackDescription(stack2.toString());
card.addSpellAbility(ability2);
@@ -794,7 +809,8 @@ public class CardFactory_Planeswalkers {
CardList list = card.getController().getCardsIn(Zone.Battlefield);
list = list.getType("Artifact");
- CardList creatures = list.filter(new CardListFilter() {
+ final CardList creatures = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isCreature();
}
@@ -802,13 +818,13 @@ public class CardFactory_Planeswalkers {
final HashMap tempCardMap = new HashMap();
- for (Card creatureCard : creatures) {
- Card crd = copyStats(creatureCard);
+ for (final Card creatureCard : creatures) {
+ final Card crd = CardFactory_Planeswalkers.copyStats(creatureCard);
tempCardMap.put(creatureCard.getUniqueNumber(), crd);
// System.out.println("Just added:" + crd);
}
- for (Card c : list) {
+ for (final Card c : list) {
final Card[] art = new Card[1];
art[0] = c;
if (AllZoneUtil.isCardInPlay(art[0])) {
@@ -819,15 +835,16 @@ public class CardFactory_Planeswalkers {
final Command creatureUntilEOT = new Command() {
private static final long serialVersionUID = 5063161656920609389L;
+ @Override
public void execute() {
final int id = art[0].getUniqueNumber();
- Card tempCard = tempCardMap.get(id);
+ final Card tempCard = tempCardMap.get(id);
art[0].setBaseAttack(tempCard.getBaseAttack());
art[0].setBaseDefense(tempCard.getBaseDefense());
}
- };// Command
+ }; // Command
art[0].setBaseAttack(5);
art[0].setBaseDefense(5);
@@ -837,46 +854,48 @@ public class CardFactory_Planeswalkers {
final Command nonCreatureUntilEOT = new Command() {
private static final long serialVersionUID = 248122386218960073L;
+ @Override
public void execute() {
art[0].removeType("Creature");
art[0].setBaseAttack(0);
art[0].setBaseDefense(0);
}
- };// Command
+ }; // Command
art[0].addType("Creature");
art[0].setBaseAttack(5);
art[0].setBaseDefense(5);
AllZone.getEndOfTurn().addUntil(nonCreatureUntilEOT);
- }// noncreature artifact
+ } // noncreature artifact
}
- }// for
- }// resolve
+ } // for
+ } // resolve
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && card.getCounters(Counters.LOYALTY) >= 5
+ && (turn[0] != AllZone.getPhase().getTurn()) && (card.getCounters(Counters.LOYALTY) >= 5)
&& Phase.canCastSorcery(card.getController());
- }// canPlay()
+ } // canPlay()
@Override
public boolean canPlayAI() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
- return c.isArtifact() && (!c.isCreature() || (c.isCreature() && c.getBaseAttack() < 4))
+ return c.isArtifact() && (!c.isCreature() || (c.isCreature() && (c.getBaseAttack() < 4)))
&& !c.hasSickness();
}
});
- return list.size() > 4 && AllZone.getPhase().getPhase().equals("Main1")
- && card.getCounters(Counters.LOYALTY) > 5;
+ return (list.size() > 4) && AllZone.getPhase().getPhase().equals("Main1")
+ && (card.getCounters(Counters.LOYALTY) > 5);
}
};
ability3.setDescription("-5: Artifacts you control become 5/5 artifact creatures until end of turn.");
- StringBuilder stack3 = new StringBuilder();
+ final StringBuilder stack3 = new StringBuilder();
stack3.append(card.getName()).append(
" - Artifacts you control become 5/5 artifact creatures until end of turn.");
ability3.setStackDescription(stack3.toString());
@@ -886,15 +905,15 @@ public class CardFactory_Planeswalkers {
card.setSets(card.getSets());
return card;
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Jace, the Mind Sculptor")) {
final int[] turn = new int[1];
turn[0] = -1;
- Target t1 = new Target(card, "Select target player", "Player");
- Cost cost1 = new Cost("AddCounter<2/LOYALTY>", cardName, true);
+ final Target t1 = new Target(card, "Select target player", "Player");
+ final Cost cost1 = new Cost("AddCounter<2/LOYALTY>", cardName, true);
final SpellAbility ability1 = new Ability_Activated(card, cost1, t1) {
private static final long serialVersionUID = -986543400626807336L;
@@ -903,18 +922,18 @@ public class CardFactory_Planeswalkers {
public void resolve() {
turn[0] = AllZone.getPhase().getTurn();
// card.addCounterFromNonEffect(Counters.LOYALTY, 2);
- Player targetPlayer = getTargetPlayer();
+ final Player targetPlayer = this.getTargetPlayer();
- PlayerZone lib = targetPlayer.getZone(Constant.Zone.Library);
+ final PlayerZone lib = targetPlayer.getZone(Constant.Zone.Library);
if (lib.size() == 0) {
return;
}
- Card c = lib.get(0);
+ final Card c = lib.get(0);
if (card.getController().isHuman()) {
- StringBuilder question = new StringBuilder();
+ final StringBuilder question = new StringBuilder();
question.append("Put the card ").append(c).append(" on the bottom of the ");
question.append(c.getController()).append("'s library?");
@@ -922,12 +941,11 @@ public class CardFactory_Planeswalkers {
AllZone.getGameAction().moveToBottomOfLibrary(c);
}
- } else // compy
- {
- CardList land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
+ } else {
+ final CardList land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
- // TODO: improve this:
- if (land.size() > 4 && c.isLand()) {
+ // TODO improve this:
+ if ((land.size() > 4) && c.isLand()) {
} else {
AllZone.getGameAction().moveToBottomOfLibrary(c);
}
@@ -936,20 +954,22 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlayAI() {
- return card.getCounters(Counters.LOYALTY) < 12
- && AllZone.getHumanPlayer().getZone(Zone.Library).size() > 2;
+ return (card.getCounters(Counters.LOYALTY) < 12)
+ && (AllZone.getHumanPlayer().getZone(Zone.Library).size() > 2);
}
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
};
- ability1.setDescription("+2: Look at the top card of target player's library. You may put that card on the bottom of that player's library.");
- StringBuilder stack1 = new StringBuilder();
+ ability1.setDescription("+2: Look at the top card of target player's library. "
+ + "You may put that card on the bottom of that player's library.");
+ final StringBuilder stack1 = new StringBuilder();
stack1.append(card.getName())
- .append(" - Look at the top card of target player's library. You may put that card on the bottom of that player's library.");
+ .append(" - Look at the top card of target player's library. "
+ + "You may put that card on the bottom of that player's library.");
ability1.setStackDescription(stack1.toString());
ability1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
@@ -961,12 +981,11 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
card.getController().drawCards(3);
- Player player = card.getController();
- if (player.isHuman())
- {
- humanResolve();
- // else
- // computerResolve();
+ final Player player = card.getController();
+ if (player.isHuman()) {
+ this.humanResolve();
+ // else
+ // computerResolve();
}
}
@@ -974,9 +993,9 @@ public class CardFactory_Planeswalkers {
CardList putOnTop = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
if (putOnTop.size() > 0) {
- Object o = GuiUtils.getChoice("First card to put on top: ", putOnTop.toArray());
+ final Object o = GuiUtils.getChoice("First card to put on top: ", putOnTop.toArray());
if (o != null) {
- Card c1 = (Card) o;
+ final Card c1 = (Card) o;
putOnTop.remove(c1);
AllZone.getGameAction().moveToLibrary(c1);
}
@@ -985,9 +1004,9 @@ public class CardFactory_Planeswalkers {
putOnTop = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
if (putOnTop.size() > 0) {
- Object o = GuiUtils.getChoice("Second card to put on top: ", putOnTop.toArray());
+ final Object o = GuiUtils.getChoice("Second card to put on top: ", putOnTop.toArray());
if (o != null) {
- Card c2 = (Card) o;
+ final Card c2 = (Card) o;
putOnTop.remove(c2);
AllZone.getGameAction().moveToLibrary(c2);
}
@@ -1002,18 +1021,19 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
};
- ability2.setDescription("0: Draw three cards, then put two cards from your hand on top of your library in any order.");
- StringBuilder stack2 = new StringBuilder();
+ ability2.setDescription("0: Draw three cards, then put two cards from your "
+ + "hand on top of your library in any order.");
+ final StringBuilder stack2 = new StringBuilder();
stack2.append(card.getName()).append(
" - Draw three cards, then put two cards from your hand on top of your library in any order.");
ability2.setStackDescription(stack2.toString());
card.addSpellAbility(ability2);
- Cost cost = new Cost("SubCounter<1/LOYALTY>", cardName, true);
- Target target = new Target(card, "TgtC");
+ final Cost cost = new Cost("SubCounter<1/LOYALTY>", cardName, true);
+ final Target target = new Target(card, "TgtC");
final SpellAbility ability3 = new Ability_Activated(card, cost, target) {
private static final long serialVersionUID = -1113077473448818423L;
@@ -1023,10 +1043,11 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
// card.subtractCounter(Counters.LOYALTY, 1);
- if (AllZoneUtil.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
- AllZone.getGameAction().moveToHand(getTargetCard());
- }// if
- }// resolve()
+ if (AllZoneUtil.isCardInPlay(this.getTargetCard())
+ && CardFactoryUtil.canTarget(card, this.getTargetCard())) {
+ AllZone.getGameAction().moveToHand(this.getTargetCard());
+ } // if
+ } // resolve()
@Override
public boolean canPlayAI() {
@@ -1035,19 +1056,19 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return card.getCounters(Counters.LOYALTY) >= 1
+ return (card.getCounters(Counters.LOYALTY) >= 1)
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
}
};
ability3.setDescription("-1: Return target creature to its owner's hand.");
- StringBuilder stack3 = new StringBuilder();
+ final StringBuilder stack3 = new StringBuilder();
stack3.append(card.getName()).append(" - Return target creature to its owner's hand.");
ability3.setStackDescription(stack3.toString());
card.addSpellAbility(ability3);
- Target target4 = new Target(card, "Select target player", "Player");
- Cost cost4 = new Cost("SubCounter<12/LOYALTY>", cardName, true);
+ final Target target4 = new Target(card, "Select target player", "Player");
+ final Cost cost4 = new Cost("SubCounter<12/LOYALTY>", cardName, true);
final SpellAbility ability4 = new Ability_Activated(card, cost4, target4) {
private static final long serialVersionUID = 5512803971603404142L;
@@ -1056,15 +1077,16 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
// card.subtractCounter(Counters.LOYALTY, 12);
- Player player = getTargetPlayer();
+ final Player player = this.getTargetPlayer();
- CardList libList = player.getCardsIn(Zone.Library);
- CardList handList = player.getCardsIn(Zone.Hand);
+ final CardList libList = player.getCardsIn(Zone.Library);
+ final CardList handList = player.getCardsIn(Zone.Hand);
- for (Card c : libList)
+ for (final Card c : libList) {
AllZone.getGameAction().exile(c);
+ }
- for (Card c : handList) {
+ for (final Card c : handList) {
AllZone.getGameAction().moveToLibrary(c);
}
player.shuffle();
@@ -1072,22 +1094,24 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlayAI() {
- int libSize = AllZone.getHumanPlayer().getZone(Zone.Library).size();
- int handSize = AllZone.getHumanPlayer().getZone(Zone.Hand).size();
- return libSize > 0 && (libSize >= handSize);
+ final int libSize = AllZone.getHumanPlayer().getZone(Zone.Library).size();
+ final int handSize = AllZone.getHumanPlayer().getZone(Zone.Hand).size();
+ return (libSize > 0) && (libSize >= handSize);
}
@Override
public boolean canPlay() {
- return card.getCounters(Counters.LOYALTY) >= 12
+ return (card.getCounters(Counters.LOYALTY) >= 12)
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
}
};
- ability4.setDescription("-12: Exile all cards from target player's library, then that player shuffles his or her hand into his or her library.");
- StringBuilder stack4 = new StringBuilder();
+ ability4.setDescription("-12: Exile all cards from target player's library, then that "
+ + "player shuffles his or her hand into his or her library.");
+ final StringBuilder stack4 = new StringBuilder();
stack4.append(card.getName())
- .append(" - Exile all cards from target player's library, then that player shuffles his or her hand into his or her library.");
+ .append(" - Exile all cards from target player's library, then that player "
+ + "shuffles his or her hand into his or her library.");
ability4.setStackDescription(stack4.toString());
ability4.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
card.addSpellAbility(ability4);
@@ -1096,7 +1120,7 @@ public class CardFactory_Planeswalkers {
card.setSets(card.getSets());
return card;
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Sarkhan the Mad")) {
@@ -1118,11 +1142,11 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
final Player player = card.getController();
- PlayerZone lib = player.getZone(Constant.Zone.Library);
+ final PlayerZone lib = player.getZone(Constant.Zone.Library);
- Card topCard = lib.get(0);
- int convertedManaTopCard = CardUtil.getConvertedManaCost(topCard.getManaCost());
- CardList showTop = new CardList();
+ final Card topCard = lib.get(0);
+ final int convertedManaTopCard = CardUtil.getConvertedManaCost(topCard.getManaCost());
+ final CardList showTop = new CardList();
showTop.add(topCard);
GuiUtils.getChoiceOptional("Revealed top card: ", showTop.toArray());
@@ -1132,7 +1156,7 @@ public class CardFactory_Planeswalkers {
// now, do X damage to Sarkhan
card.addDamage(convertedManaTopCard, card);
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
@@ -1147,11 +1171,12 @@ public class CardFactory_Planeswalkers {
// looks like standard Planeswalker stuff...
// maybe should check if library is empty, or 1 card?
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
};
- ability1.setDescription("0: Reveal the top card of your library and put it into your hand. Sarkhan the Mad deals damage to himself equal to that card's converted mana cost.");
- StringBuilder stack1 = new StringBuilder();
+ ability1.setDescription("0: Reveal the top card of your library and put it "
+ + "into your hand. Sarkhan the Mad deals damage to himself equal to that card's converted mana cost.");
+ final StringBuilder stack1 = new StringBuilder();
stack1.append(card.getName()).append(" - Reveal top card and do damage.");
ability1.setStackDescription(stack1.toString());
@@ -1161,8 +1186,8 @@ public class CardFactory_Planeswalkers {
* puts a 5/5 red Dragon creature token with flying onto the
* battlefield.
*/
- Target target2 = new Target(card, "TgtC");
- Cost cost2 = new Cost("SubCounter<2/LOYALTY>", cardName, true);
+ final Target target2 = new Target(card, "TgtC");
+ final Cost cost2 = new Cost("SubCounter<2/LOYALTY>", cardName, true);
final SpellAbility ability2 = new Ability_Activated(card, cost2, target2) {
private static final long serialVersionUID = 4322453486268967722L;
@@ -1171,19 +1196,20 @@ public class CardFactory_Planeswalkers {
// card.subtractCounter(Counters.LOYALTY, 2);
turn[0] = AllZone.getPhase().getTurn();
- Card target = getTargetCard();
+ final Card target = this.getTargetCard();
AllZone.getGameAction().sacrifice(target);
// in makeToken, use target for source, so it goes into the
// correct Zone
CardFactoryUtil.makeToken("Dragon", "R 5 5 Dragon", target.getController(), "R", new String[] {
"Creature", "Dragon" }, 5, 5, new String[] { "Flying" });
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
creatures = creatures.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return !(c.isToken() && c.isType("Dragon"));
}
@@ -1196,11 +1222,12 @@ public class CardFactory_Planeswalkers {
CardList cards = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
// avoid targeting the dragon tokens we just put in play...
cards = cards.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return !(c.isToken() && c.isType("Dragon"));
}
});
- setTargetCard(CardFactoryUtil.AI_getCheapestCreature(cards, card, true));
+ this.setTargetCard(CardFactoryUtil.AI_getCheapestCreature(cards, card, true));
Log.debug(
"Sarkhan the Mad",
"Sarkhan the Mad caused sacrifice of: "
@@ -1210,19 +1237,20 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && card.getCounters(Counters.LOYALTY) >= 2 && turn[0] != AllZone.getPhase().getTurn()
+ && (card.getCounters(Counters.LOYALTY) >= 2) && (turn[0] != AllZone.getPhase().getTurn())
&& Phase.canCastSorcery(card.getController());
- }// canPlay()
+ } // canPlay()
};
- ability2.setDescription("-2: Target creature's controller sacrifices it, then that player puts a 5/5 red Dragon creature token with flying onto the battlefield.");
+ ability2.setDescription("-2: Target creature's controller sacrifices it, "
+ + "then that player puts a 5/5 red Dragon creature token with flying onto the battlefield.");
// ability3
/*
* -4: Each Dragon creature you control deals damage equal to its
* power to target player.
*/
- Target target3 = new Target(card, "Select target player", "Player");
- Cost cost3 = new Cost("SubCounter<4/LOYALTY>", cardName, true);
+ final Target target3 = new Target(card, "Select target player", "Player");
+ final Cost cost3 = new Cost("SubCounter<4/LOYALTY>", cardName, true);
final SpellAbility ability3 = new Ability_Activated(card, cost3, target3) {
private static final long serialVersionUID = -5488579738767048060L;
@@ -1231,32 +1259,33 @@ public class CardFactory_Planeswalkers {
// card.subtractCounter(Counters.LOYALTY, 4);
turn[0] = AllZone.getPhase().getTurn();
- final Player target = getTargetPlayer();
+ final Player target = this.getTargetPlayer();
final Player player = card.getController();
- CardList dragons = player.getCardsIn(Zone.Battlefield).getType("Dragon");
+ final CardList dragons = player.getCardsIn(Zone.Battlefield).getType("Dragon");
for (int i = 0; i < dragons.size(); i++) {
- Card dragon = dragons.get(i);
- int damage = dragon.getNetAttack();
+ final Card dragon = dragons.get(i);
+ final int damage = dragon.getNetAttack();
target.addDamage(damage, dragon);
}
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
- setTargetPlayer(AllZone.getHumanPlayer());
- CardList dragons = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getType("Dragon");
- return card.getCounters(Counters.LOYALTY) >= 4 && dragons.size() >= 1;
+ this.setTargetPlayer(AllZone.getHumanPlayer());
+ final CardList dragons = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getType("Dragon");
+ return (card.getCounters(Counters.LOYALTY) >= 4) && (dragons.size() >= 1);
}
@Override
public boolean canPlay() {
return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && card.getCounters(Counters.LOYALTY) >= 4 && turn[0] != AllZone.getPhase().getTurn()
+ && (card.getCounters(Counters.LOYALTY) >= 4) && (turn[0] != AllZone.getPhase().getTurn())
&& Phase.canCastSorcery(card.getController());
- }// canPlay()
+ } // canPlay()
};
- ability3.setDescription("-4: Each Dragon creature you control deals damage equal to its power to target player.");
+ ability3.setDescription("-4: Each Dragon creature you control "
+ + "deals damage equal to its power to target player.");
card.addSpellAbility(ability1);
card.addSpellAbility(ability2);
@@ -1266,7 +1295,7 @@ public class CardFactory_Planeswalkers {
card.setSets(card.getSets());
return card;
- }// *************** END ************ END **************************
+ } // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Koth of the Hammer")) {
@@ -1287,18 +1316,19 @@ public class CardFactory_Planeswalkers {
CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card crd) {
return crd.isType("Mountain");
}
});
- Ability_Mana abMana = new Ability_Mana(card, "0", "R", list.size()) {
+ final Ability_Mana abMana = new Ability_Mana(card, "0", "R", list.size()) {
private static final long serialVersionUID = -2182129023960978132L;
};
abMana.setUndoable(false);
abMana.produceMana();
- }// resolve()
+ } // resolve()
@Override
public boolean canPlayAI() {
@@ -1308,12 +1338,12 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability2
+ } // canPlay()
+ }; // SpellAbility ability2
// ability3
final SpellAbility ability3 = new Ability(card, "0") {
@@ -1322,63 +1352,66 @@ public class CardFactory_Planeswalkers {
card.subtractCounter(Counters.LOYALTY, 5);
turn[0] = AllZone.getPhase().getTurn();
- Card emblem = new Card();
+ final Card emblem = new Card();
emblem.addIntrinsicKeyword("Indestructible");
emblem.addIntrinsicKeyword("Shroud");
- emblem.addIntrinsicKeyword("Mountains you control have 'tap: This land deals 1 damage to target creature or player.'");
+ emblem.addIntrinsicKeyword("Mountains you control have 'tap: This land deals "
+ + "1 damage to target creature or player.'");
emblem.setImmutable(true);
emblem.addType("Emblem");
emblem.addController(card.getController());
emblem.setOwner(card.getOwner());
- // TODO: Emblems live in the command zone
+ // TODO Emblems live in the command zone
AllZone.getGameAction().moveToPlay(emblem);
// AllZone.getGameAction().checkStateEffects();
AllZone.getStaticEffects().rePopulateStateBasedList();
- for (String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
- Command com = GameActionUtil.commands.get(effect);
+ for (final String effect : AllZone.getStaticEffects().getStateBasedMap().keySet()) {
+ final Command com = GameActionUtil.commands.get(effect);
com.execute();
}
}
@Override
public boolean canPlay() {
- return 5 <= card.getCounters(Counters.LOYALTY)
+ return (5 <= card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
@Override
public boolean canPlayAI() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card c) {
return c.isEmblem()
- && c.hasKeyword("Mountains you control have 'tap: This land deals 1 damage to target creature or player.'");
+ && c.hasKeyword("Mountains you control have 'tap: This land "
+ + "deals 1 damage to target creature or player.'");
}
});
- return list.size() == 0 && card.getCounters(Counters.LOYALTY) > 5;
+ return (list.size() == 0) && (card.getCounters(Counters.LOYALTY) > 5);
}
};
ability3.setBeforePayMana(new Input() {
private static final long serialVersionUID = -2054686425541429389L;
- int check = -1;
+ private int check = -1;
@Override
public void showMessage() {
- if (check != AllZone.getPhase().getTurn()) {
- check = AllZone.getPhase().getTurn();
+ if (this.check != AllZone.getPhase().getTurn()) {
+ this.check = AllZone.getPhase().getTurn();
turn[0] = AllZone.getPhase().getTurn();
AllZone.getStack().add(ability3);
}
- stop();
- }// showMessage()
+ this.stop();
+ } // showMessage()
});
- // ability 1: make 4/4 out of moutain
+ // ability 1: make 4/4 out of mountain
final SpellAbility ability1 = new Ability(card, "0") {
@Override
public void resolve() {
@@ -1386,7 +1419,7 @@ public class CardFactory_Planeswalkers {
turn[0] = AllZone.getPhase().getTurn();
final Card[] card = new Card[1];
- card[0] = getTargetCard();
+ card[0] = this.getTargetCard();
final int[] oldAttack = new int[1];
final int[] oldDefense = new int[1];
@@ -1407,6 +1440,7 @@ public class CardFactory_Planeswalkers {
private static final long serialVersionUID = 6426615528873039915L;
+ @Override
public void execute() {
card[0].setBaseAttack(oldAttack[0]);
card[0].setBaseDefense(oldDefense[0]);
@@ -1423,14 +1457,17 @@ public class CardFactory_Planeswalkers {
public boolean canPlayAI() {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card crd) {
return crd.isEmblem()
- && crd.hasKeyword("Mountains you control have 'tap: This land deals 1 damage to target creature or player.'");
+ && crd.hasKeyword("Mountains you control have 'tap: "
+ + "This land deals 1 damage to target creature or player.'");
}
});
CardList mountains = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
mountains = mountains.filter(new CardListFilter() {
+ @Override
public boolean addCard(final Card crd) {
return crd.isType("Mountain") && CardFactoryUtil.canTarget(card, crd);
}
@@ -1441,37 +1478,38 @@ public class CardFactory_Planeswalkers {
return false;
}
- if (ability3.canPlay() && ability3.canPlayAI() && list.size() == 0) {
+ if (ability3.canPlay() && ability3.canPlayAI() && (list.size() == 0)) {
return false;
} else {
- setTargetCard(mountains.get(0));
+ this.setTargetCard(mountains.get(0));
return true;
}
}
@Override
public boolean canPlay() {
- return 0 < card.getCounters(Counters.LOYALTY)
+ return (0 < card.getCounters(Counters.LOYALTY))
&& AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)
- && turn[0] != AllZone.getPhase().getTurn() && Phase.canCastSorcery(card.getController());
- }// canPlay()
- };// SpellAbility ability1
+ && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController());
+ } // canPlay()
+ }; // SpellAbility ability1
- Input runtime = new Input() {
+ final Input runtime = new Input() {
private static final long serialVersionUID = -7823269301012427007L;
@Override
public void showMessage() {
- CardList lands = card.getController().getCardsIn(Zone.Battlefield).getType("Mountain");
+ final CardList lands = card.getController().getCardsIn(Zone.Battlefield).getType("Mountain");
- stopSetNext(CardFactoryUtil.input_targetSpecific(ability1, lands, "Select target Mountain", true,
- false));
- }// showMessage()
- };// Input
+ this.stopSetNext(CardFactoryUtil.input_targetSpecific(ability1, lands, "Select target Mountain",
+ true, false));
+ } // showMessage()
+ }; // Input
ability1.setBeforePayMana(runtime);
- ability1.setDescription("+1: Untap target Mountain. It becomes a 4/4 red Elemental creature until end of turn. It's still a land.");
+ ability1.setDescription("+1: Untap target Mountain. It becomes a 4/4 red "
+ + "Elemental creature until end of turn. It's still a land.");
// ability1.setStackDescription("");
card.addSpellAbility(ability1);
@@ -1479,8 +1517,10 @@ public class CardFactory_Planeswalkers {
ability2.setStackDescription("Koth of the Hammer - Add R to your mana pool for each Mountain you control.");
card.addSpellAbility(ability2);
- ability3.setDescription("-5: You get an emblem with \"Mountains you control have 'tap: This land deals 1 damage to target creature or player.'\"");
- ability3.setStackDescription("Koth of the Hammer - You get an emblem with \"Mountains you control have 'tap: This land deals 1 damage to target creature or player.'\"");
+ ability3.setDescription("-5: You get an emblem with \"Mountains you control "
+ + "have 'tap: This land deals 1 damage to target creature or player.'\"");
+ ability3.setStackDescription("Koth of the Hammer - You get an emblem with \"Mountains "
+ + "you control have 'tap: This land deals 1 damage to target creature or player.'\"");
card.addSpellAbility(ability3);
card.setSVars(card.getSVars());
@@ -1504,8 +1544,8 @@ public class CardFactory_Planeswalkers {
* @return a {@link forge.Card} object.
*/
private static Card copyStats(final Object o) {
- Card sim = (Card) o;
- Card c = new Card();
+ final Card sim = (Card) o;
+ final Card c = new Card();
c.setBaseAttack(sim.getBaseAttack());
c.setBaseDefense(sim.getBaseDefense());
@@ -1516,5 +1556,5 @@ public class CardFactory_Planeswalkers {
c.setManaCost(sim.getManaCost());
return c;
- }// copyStats()
+ } // copyStats()
}
diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java b/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java
index 46c5ec2f959..e4fe014f0c9 100644
--- a/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java
+++ b/src/main/java/forge/card/cardFactory/CardFactory_Sorceries.java
@@ -261,18 +261,18 @@ public class CardFactory_Sorceries {
// *************** START *********** START **************************
else if (cardName.equals("Mind's Desire")) {
- final Spell PlayCreature = new Spell(card) {
+ final Spell playCreature = new Spell(card) {
private static final long serialVersionUID = 53838791023456795L;
@Override
public void resolve() {
Player player = card.getController();
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
- PlayerZone RFG = player.getZone(Constant.Zone.Exile);
- Card[] Attached = card.getAttachedCardsByMindsDesire();
- RFG.remove(Attached[0]);
- play.add(Attached[0]);
- card.unattachCardByMindDesire(Attached[0]);
+ PlayerZone rfg = player.getZone(Constant.Zone.Exile);
+ Card[] attached = card.getAttachedCardsByMindsDesire();
+ rfg.remove(attached[0]);
+ play.add(attached[0]);
+ card.unattachCardByMindDesire(attached[0]);
} // resolve()
}; // SpellAbility
@@ -284,31 +284,31 @@ public class CardFactory_Sorceries {
Card c = null;
Player player = card.getController();
if (player.isHuman()) {
- Card[] Attached = getSourceCard().getAttachedCardsByMindsDesire();
- Card[] Choices = new Card[Attached.length];
- boolean SystemsGo = true;
+ Card[] attached = getSourceCard().getAttachedCardsByMindsDesire();
+ Card[] choices = new Card[attached.length];
+ boolean systemsGo = true;
if (AllZone.getStack().size() > 0) {
- CardList Config = new CardList();
- for (int i = 0; i < Attached.length; i++) {
- if (Attached[i].isInstant()|| Attached[i].hasKeyword("Flash")) {
- Config.add(Attached[i]);
+ CardList config = new CardList();
+ for (int i = 0; i < attached.length; i++) {
+ if (attached[i].isInstant() || attached[i].hasKeyword("Flash")) {
+ config.add(attached[i]);
}
}
- for (int i = 0; i < Config.size(); i++) {
- Card crd = Config.get(i);
- Choices[i] = crd;
+ for (int i = 0; i < config.size(); i++) {
+ Card crd = config.get(i);
+ choices[i] = crd;
}
- if (Config.size() == 0) {
- SystemsGo = false;
+ if (config.size() == 0) {
+ systemsGo = false;
}
} else {
- for (int i = 0; i < Attached.length; i++) {
- Choices[i] = Attached[i];
+ for (int i = 0; i < attached.length; i++) {
+ choices[i] = attached[i];
}
}
Object check = null;
- if (SystemsGo) {
- check = GuiUtils.getChoiceOptional("Select Card to play for free", Choices);
+ if (systemsGo) {
+ check = GuiUtils.getChoiceOptional("Select Card to play for free", choices);
if (check != null) {
target = ((Card) check);
}
@@ -336,29 +336,29 @@ public class CardFactory_Sorceries {
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - Copied from Mind's Desire");
- PlayCreature.setStackDescription(sb.toString());
+ playCreature.setStackDescription(sb.toString());
- Card[] ReAttach = new Card[Attached.length];
- ReAttach[0] = c;
- int ReAttach_Count = 0;
- for (int i = 0; i < Attached.length; i++) {
- if (Attached[i] != target) {
- ReAttach_Count = ReAttach_Count + 1;
- ReAttach[ReAttach_Count] = Attached[i];
+ Card[] reAttach = new Card[attached.length];
+ reAttach[0] = c;
+ int reAttachCount = 0;
+ for (int i = 0; i < attached.length; i++) {
+ if (attached[i] != target) {
+ reAttachCount = reAttachCount + 1;
+ reAttach[reAttachCount] = attached[i];
}
}
// Clear Attached List
- for (int i = 0; i < Attached.length; i++) {
- card.unattachCardByMindDesire(Attached[i]);
+ for (int i = 0; i < attached.length; i++) {
+ card.unattachCardByMindDesire(attached[i]);
}
// Re-add
- for (int i = 0; i < ReAttach.length; i++) {
- if (ReAttach[i] != null) {
- card.attachCardByMindsDesire(ReAttach[i]);
+ for (int i = 0; i < reAttach.length; i++) {
+ if (reAttach[i] != null) {
+ card.attachCardByMindsDesire(reAttach[i]);
}
}
- target.addSpellAbility(PlayCreature);
- AllZone.getStack().add(PlayCreature);
+ target.addSpellAbility(playCreature);
+ AllZone.getStack().add(playCreature);
} else {
AllZone.getGameAction().playCardNoCost(c);
card.unattachCardByMindDesire(c);
@@ -391,17 +391,17 @@ public class CardFactory_Sorceries {
public void execute() {
Player player = AllZone.getPhase().getPlayerTurn();
- PlayerZone Play = player.getZone(Constant.Zone.Battlefield);
- Card Minds_D = card;
+ PlayerZone play = player.getZone(Constant.Zone.Battlefield);
+ Card mindsD = card;
if (player.isHuman()) {
card.getController().shuffle();
}
- CardList MindsList = player.getCardsIn(Zone.Battlefield);
- MindsList = MindsList.getName("Mind's Desire");
- MindsList.remove(card);
- if (MindsList.size() > 0) {
- Play.remove(card);
- Minds_D = MindsList.get(0);
+ CardList mindsList = player.getCardsIn(Zone.Battlefield);
+ mindsList = mindsList.getName("Mind's Desire");
+ mindsList.remove(card);
+ if (mindsList.size() > 0) {
+ play.remove(card);
+ mindsD = mindsList.get(0);
} else {
JOptionPane.showMessageDialog(null,
"Click Mind's Desire to see the available cards to play without paying its mana cost.",
@@ -411,20 +411,20 @@ public class CardFactory_Sorceries {
Card c = null;
if (libList.size() > 0) {
c = libList.get(0);
- PlayerZone RFG = player.getZone(Constant.Zone.Exile);
- AllZone.getGameAction().moveTo(RFG, c);
- Minds_D.attachCardByMindsDesire(c);
+ PlayerZone rfg = player.getZone(Constant.Zone.Exile);
+ AllZone.getGameAction().moveTo(rfg, c);
+ mindsD.attachCardByMindsDesire(c);
}
- final Card Minds = card;
+ final Card minds = card;
// AllZone.getGameAction().exile(Minds);
- Minds.setImmutable(true);
+ minds.setImmutable(true);
Command untilEOT = new Command() {
private static final long serialVersionUID = -28032591440730370L;
public void execute() {
Player player = AllZone.getPhase().getPlayerTurn();
PlayerZone play = player.getZone(Constant.Zone.Battlefield);
- play.remove(Minds);
+ play.remove(minds);
}
};
AllZone.getEndOfTurn().addUntil(untilEOT);
@@ -467,67 +467,67 @@ public class CardFactory_Sorceries {
JOptionPane.INFORMATION_MESSAGE);
return;
}
- int Count = 5;
+ int count = 5;
if (lib.size() < 5) {
- Count = lib.size();
+ count = lib.size();
}
- for (int i = 0; i < Count; i++) {
+ for (int i = 0; i < count; i++) {
cards.add(lib.get(i));
}
- for (int i = 0; i < Count; i++) {
+ for (int i = 0; i < count; i++) {
exiled.add(lib.get(i));
AllZone.getGameAction().exile(lib.get(i));
}
- CardList Pile1 = new CardList();
- CardList Pile2 = new CardList();
+ CardList pile1 = new CardList();
+ CardList pile2 = new CardList();
boolean stop = false;
- int Pile1CMC = 0;
- int Pile2CMC = 0;
+ int pile1CMC = 0;
+ int pile2CMC = 0;
- GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray());
+ GuiUtils.getChoice("Revealing top " + count + " cards of library: ", cards.toArray());
// Human chooses
if (card.getController().isComputer()) {
- for (int i = 0; i < Count; i++) {
+ for (int i = 0; i < count; i++) {
if (!stop) {
choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ",
cards.toArray());
if (choice != null) {
- Pile1.add(choice);
+ pile1.add(choice);
cards.remove(choice);
- Pile1CMC = Pile1CMC + CardUtil.getConvertedManaCost(choice);
+ pile1CMC = pile1CMC + CardUtil.getConvertedManaCost(choice);
} else {
stop = true;
}
}
}
- for (int i = 0; i < Count; i++) {
- if (!Pile1.contains(exiled.get(i))) {
- Pile2.add(exiled.get(i));
- Pile2CMC = Pile2CMC + CardUtil.getConvertedManaCost(exiled.get(i));
+ for (int i = 0; i < count; i++) {
+ if (!pile1.contains(exiled.get(i))) {
+ pile2.add(exiled.get(i));
+ pile2CMC = pile2CMC + CardUtil.getConvertedManaCost(exiled.get(i));
}
}
StringBuilder sb = new StringBuilder();
sb.append("You have spilt the cards into the following piles" + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
- for (int i = 0; i < Pile1.size(); i++) {
- sb.append(Pile1.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile1.size(); i++) {
+ sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
- for (int i = 0; i < Pile2.size(); i++) {
- sb.append(Pile2.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile2.size(); i++) {
+ sb.append(pile2.get(i).getName() + "\r\n");
}
JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE);
- if (Pile1CMC >= Pile2CMC) {
+ if (pile1CMC >= pile2CMC) {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 1", "",
JOptionPane.INFORMATION_MESSAGE);
- for (int i = 0; i < Pile1.size(); i++) {
- ArrayList choices = Pile1.get(i).getBasicSpells();
+ for (int i = 0; i < pile1.size(); i++) {
+ ArrayList choices = pile1.get(i).getBasicSpells();
for (SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa);
- if (Pile1.get(i).isPermanent()) {
- exiled.remove(Pile1.get(i));
+ if (pile1.get(i).isPermanent()) {
+ exiled.remove(pile1.get(i));
}
break;
}
@@ -536,14 +536,14 @@ public class CardFactory_Sorceries {
} else {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 2", "",
JOptionPane.INFORMATION_MESSAGE);
- for (int i = 0; i < Pile2.size(); i++) {
- ArrayList choices = Pile2.get(i).getBasicSpells();
+ for (int i = 0; i < pile2.size(); i++) {
+ ArrayList choices = pile2.get(i).getBasicSpells();
for (SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa);
- if (Pile2.get(i).isPermanent()) {
- exiled.remove(Pile2.get(i));
+ if (pile2.get(i).isPermanent()) {
+ exiled.remove(pile2.get(i));
}
break;
}
@@ -562,26 +562,26 @@ public class CardFactory_Sorceries {
}
}
- Pile1.add(biggest);
+ pile1.add(biggest);
cards.remove(biggest);
if (cards.size() > 2) {
- Card Random = CardUtil.getRandom(cards.toArray());
- Pile1.add(Random);
+ Card random = CardUtil.getRandom(cards.toArray());
+ pile1.add(random);
}
- for (int i = 0; i < Count; i++) {
- if (!Pile1.contains(exiled.get(i))) {
- Pile2.add(exiled.get(i));
+ for (int i = 0; i < count; i++) {
+ if (!pile1.contains(exiled.get(i))) {
+ pile2.add(exiled.get(i));
}
}
StringBuilder sb = new StringBuilder();
sb.append("Choose a pile to add to your hand: " + "\r\n" + "\r\n");
sb.append("Pile 1: " + "\r\n");
- for (int i = 0; i < Pile1.size(); i++) {
- sb.append(Pile1.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile1.size(); i++) {
+ sb.append(pile1.get(i).getName() + "\r\n");
}
sb.append("\r\n" + "Pile 2: " + "\r\n");
- for (int i = 0; i < Pile2.size(); i++) {
- sb.append(Pile2.get(i).getName() + "\r\n");
+ for (int i = 0; i < pile2.size(); i++) {
+ sb.append(pile2.get(i).getName() + "\r\n");
}
Object[] possibleValues = {"Pile 1", "Pile 2"};
Object q = JOptionPane.showOptionDialog(null, sb, "Brilliant Ultimatum",
@@ -590,9 +590,9 @@ public class CardFactory_Sorceries {
CardList chosen;
if (q.equals(0)) {
- chosen = Pile1;
+ chosen = pile1;
} else {
- chosen = Pile2;
+ chosen = pile2;
}
int numChosen = chosen.size();
@@ -618,8 +618,8 @@ public class CardFactory_Sorceries {
}
}
- Pile1.clear();
- Pile2.clear();
+ pile1.clear();
+ pile2.clear();
} // resolve()
@Override
@@ -808,8 +808,8 @@ public class CardFactory_Sorceries {
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = -6003403347798646257L;
- int damage = 3;
- Card check;
+ private int damage = 3;
+ private Card check;
@Override
public boolean canPlayAI() {
@@ -900,12 +900,12 @@ public class CardFactory_Sorceries {
@Override
public void resolve() {
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
- int Soldiers = card.getXManaCostPaid();
- for (int i = 0; i < Soldiers; i++) {
+ int soldiers = card.getXManaCostPaid();
+ for (int i = 0; i < soldiers; i++) {
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
"Creature", "Soldier" }, 1, 1, new String[] { "" });
}
- if (Soldiers >= 5) {
+ if (soldiers >= 5) {
for (int i = 0; i < all.size(); i++) {
Card c = all.get(i);
if (c.isCreature()) {
@@ -963,7 +963,7 @@ public class CardFactory_Sorceries {
card.setFlashback(true);
card.addSpellAbility(spell);
- card.addSpellAbility(CardFactoryUtil.ability_Flashback(card, "4 G G G"));
+ card.addSpellAbility(CardFactoryUtil.abilityFlashback(card, "4 G G G"));
} // *************** END ************ END **************************
// *************** START *********** START **************************
@@ -1594,8 +1594,8 @@ public class CardFactory_Sorceries {
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = -3234630801871872940L;
- int damage = 3;
- Card check;
+ private int damage = 3;
+ private Card check;
@Override
public boolean canPlayAI() {
@@ -1921,21 +1921,21 @@ public class CardFactory_Sorceries {
/*
* We want compy to have less cards in hand than the human
*/
- CardList Hhand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
- CardList Chand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
- return Chand.size() < Hhand.size();
+ CardList humanHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
+ CardList computerHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
+ return computerHand.size() < humanHand.size();
}
@Override
public void resolve() {
- CardList Hhand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
- CardList Chand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
+ CardList humanHand = AllZone.getHumanPlayer().getCardsIn(Zone.Hand);
+ CardList computerHand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
- int num = Math.max(Hhand.size(), Chand.size());
+ int num = Math.max(humanHand.size(), computerHand.size());
discardDraw(AllZone.getHumanPlayer(), num);
discardDraw(AllZone.getComputerPlayer(), num);
- }// resolve()
+ } // resolve()
void discardDraw(final Player player, final int num) {
player.discardHand(this);
@@ -2355,7 +2355,7 @@ public class CardFactory_Sorceries {
}
}
- // "Return target creature card with converted mana cost
+ // "Return target creature card with converted mana cost
// X or less from your graveyard to the battlefield",
if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
Card c = ab1card[0];
@@ -2449,8 +2449,8 @@ public class CardFactory_Sorceries {
final Input targetXCreatures = new Input() {
private static final long serialVersionUID = 2584765431286321048L;
- int stop = 0;
- int count = 0;
+ private int stop = 0;
+ private int count = 0;
@Override
public void showMessage() {
diff --git a/src/main/java/forge/card/cardFactory/LazyCardFactory.java b/src/main/java/forge/card/cardFactory/LazyCardFactory.java
index c84444e87d2..7246cfc730d 100644
--- a/src/main/java/forge/card/cardFactory/LazyCardFactory.java
+++ b/src/main/java/forge/card/cardFactory/LazyCardFactory.java
@@ -33,8 +33,8 @@ public class LazyCardFactory extends AbstractCardFactory {
public LazyCardFactory(final File cardsfolder) {
super(cardsfolder);
- getMap().clear();
- cardReader = new CardReader(cardsfolder, getMap());
+ this.getMap().clear();
+ this.cardReader = new CardReader(cardsfolder, this.getMap());
}
/**
@@ -43,7 +43,7 @@ public class LazyCardFactory extends AbstractCardFactory {
* @return cardReader
*/
public final CardReader getCardReader() {
- return cardReader;
+ return this.cardReader;
}
/**
@@ -69,24 +69,24 @@ public class LazyCardFactory extends AbstractCardFactory {
*/
@Override
protected final Card getCard2(final String cardName, final Player owner) {
- final Map cardNamesToCards = getMap();
+ final Map cardNamesToCards = this.getMap();
Card result = null;
boolean wasLoaded = cardNamesToCards.containsKey(cardName);
if (!wasLoaded) {
- if (cardsFailedToLoad.contains(cardName)) {
+ if (this.cardsFailedToLoad.contains(cardName)) {
return null; // no more System.err, exceptions of other drama -
// just return null.
}
final String canonicalASCIIName = CardUtil.canonicalizeCardName(cardName);
- Card cardRequested = getCardReader().findCard(canonicalASCIIName);
+ final Card cardRequested = this.getCardReader().findCard(canonicalASCIIName);
if (null != cardRequested) {
cardNamesToCards.put(cardName, cardRequested);
wasLoaded = true;
} else {
- cardsFailedToLoad.add(cardName);
+ this.cardsFailedToLoad.add(cardName);
System.err.println(String.format("LazyCF: Tried to read from disk card '%s' but not found it!",
cardName));
return null;
diff --git a/src/main/java/forge/card/spellability/Ability_Mana.java b/src/main/java/forge/card/spellability/Ability_Mana.java
index 295f96ba55b..b78409a47c8 100644
--- a/src/main/java/forge/card/spellability/Ability_Mana.java
+++ b/src/main/java/forge/card/spellability/Ability_Mana.java
@@ -18,20 +18,20 @@ import forge.card.mana.ManaPool;
* @version $Id$
*/
public abstract class Ability_Mana extends Ability_Activated implements java.io.Serializable {
- /** Constant serialVersionUID=-6816356991224950520L */
+ /** Constant serialVersionUID=-6816356991224950520L. */
private static final long serialVersionUID = -6816356991224950520L;
private String origProduced;
private int amount = 1;
/** The reflected. */
- protected boolean reflected = false;
+ private boolean reflected = false;
/** The undoable. */
- protected boolean undoable = true;
+ private boolean undoable = true;
/** The canceled. */
- protected boolean canceled = false;
+ private boolean canceled = false;
/**
*
diff --git a/src/main/java/forge/card/spellability/Ability_Sub.java b/src/main/java/forge/card/spellability/Ability_Sub.java
index d5bcf4a1183..6dfd5c6dee0 100644
--- a/src/main/java/forge/card/spellability/Ability_Sub.java
+++ b/src/main/java/forge/card/spellability/Ability_Sub.java
@@ -28,7 +28,7 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
*/
public Ability_Sub(final Card sourceCard, final Target tgt) {
super(SpellAbility.Ability, sourceCard);
- setTarget(tgt);
+ this.setTarget(tgt);
}
/** {@inheritDoc} */
@@ -45,9 +45,10 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
*
* @return a boolean.
*/
- public abstract boolean chkAI_Drawback();
+ public abstract boolean chkAIDrawback();
/** {@inheritDoc} */
+ @Override
public abstract boolean doTrigger(boolean mandatory);
/**
@@ -70,6 +71,6 @@ public abstract class Ability_Sub extends SpellAbility implements java.io.Serial
* @return a {@link forge.card.spellability.SpellAbility} object.
*/
public final SpellAbility getParent() {
- return parent;
+ return this.parent;
}
}
diff --git a/src/main/java/forge/card/spellability/Ability_Triggered.java b/src/main/java/forge/card/spellability/Ability_Triggered.java
index c3a6bd40212..29962560cc5 100644
--- a/src/main/java/forge/card/spellability/Ability_Triggered.java
+++ b/src/main/java/forge/card/spellability/Ability_Triggered.java
@@ -23,13 +23,31 @@ public class Ability_Triggered extends Ability implements Command {
private static final long serialVersionUID = 4970998845621323960L;
/** The restrictions. */
- public String[] restrictions;
+ private String[] restrictions;
/** The trigger. */
- public ZCTrigger trigger;
+ private ZCTrigger trigger;
+
+ /**
+ * Gets the trigger.
+ *
+ * @return the trigger
+ */
+ public final ZCTrigger getTrigger() {
+ return trigger;
+ }
+
+ /**
+ * Sets the trigger.
+ *
+ * @param trigger the new trigger
+ */
+ public final void setTrigger(final ZCTrigger trigger) {
+ this.trigger = trigger;
+ }
/** The todo. */
- public Command todo;
+ private Command todo;
/**
*
@@ -114,7 +132,7 @@ public class Ability_Triggered extends Ability implements Command {
/** {@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;
diff --git a/src/main/java/forge/card/spellability/SpellAbility_StackInstance.java b/src/main/java/forge/card/spellability/SpellAbility_StackInstance.java
index b07394b6203..607968940ab 100644
--- a/src/main/java/forge/card/spellability/SpellAbility_StackInstance.java
+++ b/src/main/java/forge/card/spellability/SpellAbility_StackInstance.java
@@ -24,23 +24,23 @@ public class SpellAbility_StackInstance {
// Coming off the Stack would work similarly, except it would just add the
// full active SI instead of each of the parts
/** The ability. */
- SpellAbility ability = null;
+ private SpellAbility ability = null;
/** The sub instace. */
- SpellAbility_StackInstance subInstace = null;
+ private SpellAbility_StackInstance subInstace = null;
// When going to a SubAbility that SA has a Instance Choice object
/** The tc. */
- Target_Choices tc = null;
+ private Target_Choices tc = null;
/** The activating player. */
- Player activatingPlayer = null;
+ private Player activatingPlayer = null;
/** The activated from. */
- String activatedFrom = null;
+ private String activatedFrom = null;
/** The stack description. */
- String stackDescription = null;
+ private String stackDescription = null;
// Adjusted Mana Cost
// private String adjustedManaCost = "";
@@ -222,12 +222,12 @@ public class SpellAbility_StackInstance {
* isStateTrigger.
*
*
- * @param ID
+ * @param id
* a int.
* @return a boolean.
*/
- public final boolean isStateTrigger(final int ID) {
- return ability.getSourceTrigger() == ID;
+ public final boolean isStateTrigger(final int id) {
+ return ability.getSourceTrigger() == id;
}
/**
diff --git a/src/main/java/forge/card/spellability/SpellAbility_Variables.java b/src/main/java/forge/card/spellability/SpellAbility_Variables.java
index 823f15a6873..ab4452a2a0a 100644
--- a/src/main/java/forge/card/spellability/SpellAbility_Variables.java
+++ b/src/main/java/forge/card/spellability/SpellAbility_Variables.java
@@ -368,8 +368,9 @@ public class SpellAbility_Variables {
* a {@link java.lang.String} object.
*/
public final void setPhases(final String phasesString) {
- for (String s : phasesString.split(","))
+ for (String s : phasesString.split(",")) {
phases.add(s);
+ }
}
/**
@@ -520,11 +521,11 @@ public class SpellAbility_Variables {
* Setter for the field svarToCheck.
*
*
- * @param SVar
+ * @param sVar
* a {@link java.lang.String} object.
*/
- public final void setSvarToCheck(final String SVar) {
- svarToCheck = SVar;
+ public final void setSvarToCheck(final String sVar) {
+ svarToCheck = sVar;
}
/**
@@ -532,11 +533,11 @@ public class SpellAbility_Variables {
* Setter for the field svarOperator.
*
*
- * @param Operator
+ * @param operator
* a {@link java.lang.String} object.
*/
- public final void setSvarOperator(final String Operator) {
- svarOperator = Operator;
+ public final void setSvarOperator(final String operator) {
+ svarOperator = operator;
}
/**
@@ -544,11 +545,11 @@ public class SpellAbility_Variables {
* Setter for the field svarOperand.
*
*
- * @param Operand
+ * @param operand
* a {@link java.lang.String} object.
*/
- public final void setSvarOperand(final String Operand) {
- svarOperand = Operand;
+ public final void setSvarOperand(final String operand) {
+ svarOperand = operand;
}
} // end class SpellAbility_Variables
diff --git a/src/main/java/forge/card/spellability/Spell_Permanent.java b/src/main/java/forge/card/spellability/Spell_Permanent.java
index 106cd2ba57d..91e522e11c7 100644
--- a/src/main/java/forge/card/spellability/Spell_Permanent.java
+++ b/src/main/java/forge/card/spellability/Spell_Permanent.java
@@ -36,7 +36,7 @@ public class Spell_Permanent extends Spell {
private String championValidDesc = "";
/** The champion input comes. */
- final Input championInputComes = new Input() {
+ private final Input championInputComes = new Input() {
private static final long serialVersionUID = -7503268232821397107L;
@Override
@@ -58,7 +58,7 @@ public class Spell_Permanent extends Spell {
}; // CommandReturn
/** The champion ability comes. */
- final SpellAbility championAbilityComes = new Ability(getSourceCard(), "0") {
+ private final SpellAbility championAbilityComes = new Ability(getSourceCard(), "0") {
@Override
public void resolve() {
@@ -97,7 +97,7 @@ public class Spell_Permanent extends Spell {
};
/** The champion command comes. */
- Command championCommandComes = new Command() {
+ private Command championCommandComes = new Command() {
private static final long serialVersionUID = -3580408066322945328L;
@@ -111,7 +111,7 @@ public class Spell_Permanent extends Spell {
}; // championCommandComes
/** The champion command leaves play. */
- Command championCommandLeavesPlay = new Command() {
+ private Command championCommandLeavesPlay = new Command() {
private static final long serialVersionUID = -5903638227914705191L;