mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
checkstyle and refactoring
This commit is contained in:
@@ -1326,7 +1326,7 @@ public class AbilityFactory {
|
||||
if (sa.isSpell()) {
|
||||
return sa.getSourceCard().isSorcery();
|
||||
} else if (sa.isAbility()) {
|
||||
return sa.getRestrictions().getSorcerySpeed();
|
||||
return sa.getRestrictions().isSorcerySpeed();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -653,8 +653,7 @@ public class AbilityFactory_Destroy {
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
private static String destroyAllStackDescription(final AbilityFactory af,
|
||||
final SpellAbility sa, final boolean noRegen)
|
||||
{
|
||||
final SpellAbility sa, final boolean noRegen) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String name = af.getHostCard().getName();
|
||||
|
||||
@@ -121,9 +121,9 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
|
||||
|
||||
// basically PresentCompare for life totals:
|
||||
if (params.containsKey("ConditionLifeTotal")) {
|
||||
lifeTotal = params.get("ConditionLifeTotal");
|
||||
setLifeTotal(params.get("ConditionLifeTotal"));
|
||||
if (params.containsKey("ConditionLifeAmount")) {
|
||||
lifeAmount = params.get("ConditionLifeAmount");
|
||||
setLifeAmount(params.get("ConditionLifeAmount"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,27 +159,27 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
|
||||
+ " Did not have activator set in SpellAbility_Condition.checkConditions()");
|
||||
}
|
||||
|
||||
if (hellbent) {
|
||||
if (isHellbent()) {
|
||||
if (!activator.hasHellbent()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (threshold) {
|
||||
if (isThreshold()) {
|
||||
if (!activator.hasThreshold()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (metalcraft) {
|
||||
if (isMetalcraft()) {
|
||||
if (!activator.hasMetalcraft()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bSorcerySpeed && !Phase.canCastSorcery(activator)) {
|
||||
if (isSorcerySpeed() && !Phase.canCastSorcery(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bPlayerTurn && !AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
if (isPlayerTurn() && !AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -187,14 +187,14 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activationLimit != -1 && numberTurnActivations >= activationLimit) {
|
||||
if (getActivationLimit() != -1 && getNumberTurnActivations() >= getActivationLimit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (phases.size() > 0) {
|
||||
if (getPhases().size() > 0) {
|
||||
boolean isPhase = false;
|
||||
String currPhase = AllZone.getPhase().getPhase();
|
||||
for (String s : phases) {
|
||||
for (String s : getPhases()) {
|
||||
if (s.equals(currPhase)) {
|
||||
isPhase = true;
|
||||
break;
|
||||
@@ -243,7 +243,7 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
|
||||
list = list.getValidCards(sIsPresent.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
int right;
|
||||
String rightString = presentCompare.substring(2);
|
||||
String rightString = getPresentCompare().substring(2);
|
||||
try { // If this is an Integer, just parse it
|
||||
right = Integer.parseInt(rightString);
|
||||
} catch (NumberFormatException e) { // Otherwise, grab it from the
|
||||
@@ -253,29 +253,29 @@ public class SpellAbility_Condition extends SpellAbility_Variables {
|
||||
|
||||
int left = list.size();
|
||||
|
||||
if (!AllZoneUtil.compare(left, presentCompare, right)) {
|
||||
if (!AllZoneUtil.compare(left, getPresentCompare(), right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (lifeTotal != null) {
|
||||
if (getLifeTotal() != null) {
|
||||
int life = 1;
|
||||
if (lifeTotal.equals("You")) {
|
||||
if (getLifeTotal().equals("You")) {
|
||||
life = activator.getLife();
|
||||
}
|
||||
if (lifeTotal.equals("Opponent")) {
|
||||
if (getLifeTotal().equals("Opponent")) {
|
||||
life = activator.getOpponent().getLife();
|
||||
}
|
||||
|
||||
int right = 1;
|
||||
String rightString = lifeAmount.substring(2);
|
||||
String rightString = getLifeAmount().substring(2);
|
||||
if (rightString.equals("X")) {
|
||||
right = CardFactoryUtil.xCount(sa.getSourceCard(), sa.getSourceCard().getSVar("X"));
|
||||
} else {
|
||||
right = Integer.parseInt(lifeAmount.substring(2));
|
||||
right = Integer.parseInt(getLifeAmount().substring(2));
|
||||
}
|
||||
|
||||
if (!AllZoneUtil.compare(life, lifeAmount, right)) {
|
||||
if (!AllZoneUtil.compare(life, getLifeAmount(), right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,9 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
|
||||
// basically PresentCompare for life totals:
|
||||
if (params.containsKey("ActivationLifeTotal")) {
|
||||
lifeTotal = params.get("ActivationLifeTotal");
|
||||
setLifeTotal(params.get("ActivationLifeTotal"));
|
||||
if (params.containsKey("ActivationLifeAmount")) {
|
||||
lifeAmount = params.get("ActivationLifeAmount");
|
||||
setLifeAmount(params.get("ActivationLifeAmount"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,11 +193,11 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
System.out.println(c.getName() + " Did not have activator set in SpellAbility_Restriction.canPlay()");
|
||||
}
|
||||
|
||||
if (bSorcerySpeed && !Phase.canCastSorcery(activator)) {
|
||||
if (isSorcerySpeed() && !Phase.canCastSorcery(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bPlayerTurn && !AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
if (isPlayerTurn() && !AllZone.getPhase().isPlayerTurn(activator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -209,14 +209,14 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activationLimit != -1 && numberTurnActivations >= activationLimit) {
|
||||
if (getActivationLimit() != -1 && getNumberTurnActivations() >= getActivationLimit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (phases.size() > 0) {
|
||||
if (getPhases().size() > 0) {
|
||||
boolean isPhase = false;
|
||||
String currPhase = AllZone.getPhase().getPhase();
|
||||
for (String s : phases) {
|
||||
for (String s : getPhases()) {
|
||||
if (s.equals(currPhase)) {
|
||||
isPhase = true;
|
||||
break;
|
||||
@@ -233,26 +233,26 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hellbent) {
|
||||
if (isHellbent()) {
|
||||
if (!activator.hasHellbent()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (threshold) {
|
||||
if (isThreshold()) {
|
||||
if (!activator.hasThreshold()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (metalcraft) {
|
||||
if (isMetalcraft()) {
|
||||
if (!activator.hasMetalcraft()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (prowl != null) {
|
||||
if (getProwl() != null) {
|
||||
// only true if the activating player has damaged the opponent with
|
||||
// one of the specified types
|
||||
boolean prowlFlag = false;
|
||||
for (String type : prowl) {
|
||||
for (String type : getProwl()) {
|
||||
if (activator.hasProwl(type)) {
|
||||
prowlFlag = true;
|
||||
}
|
||||
@@ -267,42 +267,42 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
|
||||
list = list.getValidCards(sIsPresent.split(","), activator, c);
|
||||
|
||||
int right = 1;
|
||||
String rightString = presentCompare.substring(2);
|
||||
String rightString = getPresentCompare().substring(2);
|
||||
if (rightString.equals("X")) {
|
||||
right = CardFactoryUtil.xCount(c, c.getSVar("X"));
|
||||
} else {
|
||||
right = Integer.parseInt(presentCompare.substring(2));
|
||||
right = Integer.parseInt(getPresentCompare().substring(2));
|
||||
}
|
||||
int left = list.size();
|
||||
|
||||
if (!AllZoneUtil.compare(left, presentCompare, right)) {
|
||||
if (!AllZoneUtil.compare(left, getPresentCompare(), right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (lifeTotal != null) {
|
||||
if (getLifeTotal() != null) {
|
||||
int life = 1;
|
||||
if (lifeTotal.equals("You")) {
|
||||
if (getLifeTotal().equals("You")) {
|
||||
life = activator.getLife();
|
||||
}
|
||||
if (lifeTotal.equals("Opponent")) {
|
||||
if (getLifeTotal().equals("Opponent")) {
|
||||
life = activator.getOpponent().getLife();
|
||||
}
|
||||
|
||||
int right = 1;
|
||||
String rightString = lifeAmount.substring(2);
|
||||
String rightString = getLifeAmount().substring(2);
|
||||
if (rightString.equals("X")) {
|
||||
right = CardFactoryUtil.xCount(sa.getSourceCard(), sa.getSourceCard().getSVar("X"));
|
||||
} else {
|
||||
right = Integer.parseInt(lifeAmount.substring(2));
|
||||
right = Integer.parseInt(getLifeAmount().substring(2));
|
||||
}
|
||||
|
||||
if (!AllZoneUtil.compare(life, lifeAmount, right)) {
|
||||
if (!AllZoneUtil.compare(life, getLifeAmount(), right)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwAbility) {
|
||||
if (isPwAbility()) {
|
||||
// Planeswalker abilities can only be activated as Sorceries
|
||||
if (!Phase.canCastSorcery(activator)) {
|
||||
return false;
|
||||
|
||||
@@ -33,10 +33,10 @@ public class SpellAbility_Variables {
|
||||
protected Constant.Zone zone = Constant.Zone.Battlefield;
|
||||
|
||||
/** The phases. */
|
||||
protected ArrayList<String> phases = new ArrayList<String>();
|
||||
private ArrayList<String> phases = new ArrayList<String>();
|
||||
|
||||
/** The b sorcery speed. */
|
||||
protected boolean bSorcerySpeed = false;
|
||||
private boolean sorcerySpeed = false;
|
||||
|
||||
/** The b any player. */
|
||||
protected boolean bAnyPlayer = false;
|
||||
@@ -45,37 +45,37 @@ public class SpellAbility_Variables {
|
||||
protected boolean bOpponentTurn = false;
|
||||
|
||||
/** The b player turn. */
|
||||
protected boolean bPlayerTurn = false;
|
||||
private boolean playerTurn = false;
|
||||
|
||||
/** The activation limit. */
|
||||
protected int activationLimit = -1;
|
||||
private int activationLimit = -1;
|
||||
|
||||
/** The number turn activations. */
|
||||
protected int numberTurnActivations = 0;
|
||||
private int numberTurnActivations = 0;
|
||||
|
||||
/** The activation number sacrifice. */
|
||||
protected int activationNumberSacrifice = -1;
|
||||
private int activationNumberSacrifice = -1;
|
||||
|
||||
/** The n cards in hand. */
|
||||
protected int nCardsInHand = -1;
|
||||
|
||||
/** The threshold. */
|
||||
protected boolean threshold = false;
|
||||
private boolean threshold = false;
|
||||
|
||||
/** The metalcraft. */
|
||||
protected boolean metalcraft = false;
|
||||
private boolean metalcraft = false;
|
||||
|
||||
/** The hellbent. */
|
||||
protected boolean hellbent = false;
|
||||
private boolean hellbent = false;
|
||||
|
||||
/** The prowl. */
|
||||
protected ArrayList<String> prowl = null;
|
||||
private ArrayList<String> prowl = null;
|
||||
|
||||
/** The s is present. */
|
||||
protected String sIsPresent = null;
|
||||
|
||||
/** The present compare. */
|
||||
protected String presentCompare = "GE1"; // Default Compare to Greater or
|
||||
private String presentCompare = "GE1"; // Default Compare to Greater or
|
||||
// Equal to 1
|
||||
|
||||
/** The present defined. */
|
||||
@@ -94,16 +94,16 @@ public class SpellAbility_Variables {
|
||||
protected String svarOperand = "1";
|
||||
|
||||
/** The life total. */
|
||||
protected String lifeTotal = null;
|
||||
private String lifeTotal = null;
|
||||
|
||||
/** The life amount. */
|
||||
protected String lifeAmount = "GE1";
|
||||
private String lifeAmount = "GE1";
|
||||
|
||||
/** The mana spent. */
|
||||
protected String manaSpent = "";
|
||||
|
||||
/** The pw ability. */
|
||||
protected boolean pwAbility = false;
|
||||
private boolean pwAbility = false;
|
||||
|
||||
/** The all m12 empires. */
|
||||
protected boolean allM12Empires = false;
|
||||
@@ -212,7 +212,7 @@ public class SpellAbility_Variables {
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setSorcerySpeed(final boolean bSpeed) {
|
||||
bSorcerySpeed = bSpeed;
|
||||
sorcerySpeed = bSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,8 +222,8 @@ public class SpellAbility_Variables {
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean getSorcerySpeed() {
|
||||
return bSorcerySpeed;
|
||||
public final boolean isSorcerySpeed() {
|
||||
return sorcerySpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,7 +258,7 @@ public class SpellAbility_Variables {
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setPlayerTurn(final boolean bTurn) {
|
||||
bPlayerTurn = bTurn;
|
||||
playerTurn = bTurn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,7 +269,7 @@ public class SpellAbility_Variables {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean getPlayerTurn() {
|
||||
return bPlayerTurn;
|
||||
return isPlayerTurn();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -501,7 +501,7 @@ public class SpellAbility_Variables {
|
||||
* a boolean.
|
||||
*/
|
||||
public final void setPlaneswalker(final boolean bPlaneswalker) {
|
||||
pwAbility = bPlaneswalker;
|
||||
setPwAbility(bPlaneswalker);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ public class SpellAbility_Variables {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean getPlaneswalker() {
|
||||
return pwAbility;
|
||||
return isPwAbility();
|
||||
}
|
||||
|
||||
// Checking the values of SVars (Mostly for Traps)
|
||||
@@ -552,4 +552,139 @@ public class SpellAbility_Variables {
|
||||
svarOperand = operand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the activation limit.
|
||||
*
|
||||
* @return the activationLimit
|
||||
*/
|
||||
public int getActivationLimit() {
|
||||
return activationLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is threshold.
|
||||
*
|
||||
* @return the threshold
|
||||
*/
|
||||
public final boolean isThreshold() {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is metalcraft.
|
||||
*
|
||||
* @return the metalcraft
|
||||
*/
|
||||
public final boolean isMetalcraft() {
|
||||
return metalcraft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is hellbent.
|
||||
*
|
||||
* @return the hellbent
|
||||
*/
|
||||
public final boolean isHellbent() {
|
||||
return hellbent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is pw ability.
|
||||
*
|
||||
* @return the pwAbility
|
||||
*/
|
||||
public final boolean isPwAbility() {
|
||||
return pwAbility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pw ability.
|
||||
*
|
||||
* @param pwAbility the new pw ability
|
||||
*/
|
||||
public final void setPwAbility(final boolean pwAbility) {
|
||||
this.pwAbility = pwAbility; // TODO Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is player turn.
|
||||
*
|
||||
* @return the playerTurn
|
||||
*/
|
||||
public boolean isPlayerTurn() {
|
||||
return playerTurn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prowl.
|
||||
*
|
||||
* @return the prowl
|
||||
*/
|
||||
public ArrayList<String> getProwl() {
|
||||
return prowl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the present compare.
|
||||
*
|
||||
* @return the presentCompare
|
||||
*/
|
||||
public String getPresentCompare() {
|
||||
return presentCompare;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the life total.
|
||||
*
|
||||
* @return the lifeTotal
|
||||
*/
|
||||
public final String getLifeTotal() {
|
||||
return lifeTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the life total.
|
||||
*
|
||||
* @param lifeTotal the lifeTotal to set
|
||||
*/
|
||||
public final void setLifeTotal(final String lifeTotal) {
|
||||
this.lifeTotal = lifeTotal; // TODO Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the life amount.
|
||||
*
|
||||
* @return the lifeAmount
|
||||
*/
|
||||
public final String getLifeAmount() {
|
||||
return lifeAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the life amount.
|
||||
*
|
||||
* @param lifeAmount the lifeAmount to set
|
||||
*/
|
||||
public final void setLifeAmount(final String lifeAmount) {
|
||||
this.lifeAmount = lifeAmount; // TODO Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the phases.
|
||||
*
|
||||
* @return the phases
|
||||
*/
|
||||
public final ArrayList<String> getPhases() {
|
||||
return phases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the phases.
|
||||
*
|
||||
* @param phases the new phases
|
||||
*/
|
||||
public final void setPhases(final ArrayList<String> phases) {
|
||||
this.phases = phases; // TODO Add 0 to parameter's name.
|
||||
}
|
||||
|
||||
} // end class SpellAbility_Variables
|
||||
|
||||
Reference in New Issue
Block a user