mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Checkstyle fixes in StaticEffect and StaticEffects
This commit is contained in:
@@ -46,12 +46,22 @@ public class StaticEffect {
|
|||||||
private boolean overwriteColors = false;
|
private boolean overwriteColors = false;
|
||||||
private HashMap<Card, Long> timestamps = new HashMap<Card, Long>();
|
private HashMap<Card, Long> timestamps = new HashMap<Card, Long>();
|
||||||
|
|
||||||
public void setTimestamp(long t) {
|
/**
|
||||||
timestamp = t;
|
* setTimestamp
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
* @param t a long
|
||||||
|
*/
|
||||||
|
public final void setTimestamp(final long t) {
|
||||||
|
timestamp = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimestamp() {
|
/**
|
||||||
return timestamp;
|
* getTimestamp.
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
* @return a long
|
||||||
|
*/
|
||||||
|
public final long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,17 +71,17 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean isOverwriteAbilities() {
|
public final boolean isOverwriteAbilities() {
|
||||||
return overwriteAbilities;
|
return overwriteAbilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>overwriteAbilities</code>.</p>
|
* <p>Setter for the field <code>overwriteAbilities</code>.</p>
|
||||||
*
|
*
|
||||||
* @param overwriteAbilities a boolean.
|
* @param overwriteAbilitiesIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setOverwriteAbilities(boolean overwriteAbilities) {
|
public final void setOverwriteAbilities(final boolean overwriteAbilitiesIn) {
|
||||||
this.overwriteAbilities = overwriteAbilities;
|
this.overwriteAbilities = overwriteAbilitiesIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
//original SAs
|
//original SAs
|
||||||
@@ -81,12 +91,14 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
* @param sa a {@link forge.card.spellability.SpellAbility} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalAbilities(Card c, SpellAbility sa) {
|
public final void addOriginalAbilities(final Card c, final SpellAbility sa) {
|
||||||
if (!originalAbilities.containsKey(c)) {
|
if (!originalAbilities.containsKey(c)) {
|
||||||
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>();
|
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>();
|
||||||
list.add(sa);
|
list.add(sa);
|
||||||
originalAbilities.put(c, list);
|
originalAbilities.put(c, list);
|
||||||
} else originalAbilities.get(c).add(sa);
|
} else {
|
||||||
|
originalAbilities.get(c).add(sa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +107,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.util.ArrayList} object.
|
* @param s a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalAbilities(Card c, ArrayList<SpellAbility> s) {
|
public final void addOriginalAbilities(final Card c, final ArrayList<SpellAbility> s) {
|
||||||
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>(s);
|
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>(s);
|
||||||
if (!originalAbilities.containsKey(c)) {
|
if (!originalAbilities.containsKey(c)) {
|
||||||
originalAbilities.put(c, list);
|
originalAbilities.put(c, list);
|
||||||
@@ -111,7 +123,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public ArrayList<SpellAbility> getOriginalAbilities(Card c) {
|
public final ArrayList<SpellAbility> getOriginalAbilities(final Card c) {
|
||||||
ArrayList<SpellAbility> returnList = new ArrayList<SpellAbility>();
|
ArrayList<SpellAbility> returnList = new ArrayList<SpellAbility>();
|
||||||
if (originalAbilities.containsKey(c)) {
|
if (originalAbilities.containsKey(c)) {
|
||||||
returnList.addAll(originalAbilities.get(c));
|
returnList.addAll(originalAbilities.get(c));
|
||||||
@@ -124,7 +136,7 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public void clearOriginalAbilities(Card c) {
|
public final void clearOriginalAbilities(final Card c) {
|
||||||
if (originalAbilities.containsKey(c)) {
|
if (originalAbilities.containsKey(c)) {
|
||||||
originalAbilities.get(c).clear();
|
originalAbilities.get(c).clear();
|
||||||
}
|
}
|
||||||
@@ -133,7 +145,7 @@ public class StaticEffect {
|
|||||||
/**
|
/**
|
||||||
* <p>clearAllOriginalAbilities.</p>
|
* <p>clearAllOriginalAbilities.</p>
|
||||||
*/
|
*/
|
||||||
public void clearAllOriginalAbilities() {
|
public final void clearAllOriginalAbilities() {
|
||||||
originalAbilities.clear();
|
originalAbilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,17 +155,17 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean isOverwriteKeywords() {
|
public final boolean isOverwriteKeywords() {
|
||||||
return overwriteKeywords;
|
return overwriteKeywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>overwriteKeywords</code>.</p>
|
* <p>Setter for the field <code>overwriteKeywords</code>.</p>
|
||||||
*
|
*
|
||||||
* @param overwriteKeywords a boolean.
|
* @param overwriteKeywordsIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setOverwriteKeywords(boolean overwriteKeywords) {
|
public final void setOverwriteKeywords(final boolean overwriteKeywordsIn) {
|
||||||
this.overwriteKeywords = overwriteKeywords;
|
this.overwriteKeywords = overwriteKeywordsIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
//original keywords
|
//original keywords
|
||||||
@@ -163,12 +175,14 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.lang.String} object.
|
* @param s a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalKeyword(Card c, String s) {
|
public final void addOriginalKeyword(final Card c, final String s) {
|
||||||
if (!originalKeywords.containsKey(c)) {
|
if (!originalKeywords.containsKey(c)) {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
list.add(s);
|
list.add(s);
|
||||||
originalKeywords.put(c, list);
|
originalKeywords.put(c, list);
|
||||||
} else originalKeywords.get(c).add(s);
|
} else {
|
||||||
|
originalKeywords.get(c).add(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +191,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.util.ArrayList} object.
|
* @param s a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalKeywords(Card c, ArrayList<String> s) {
|
public final void addOriginalKeywords(final Card c, final ArrayList<String> s) {
|
||||||
ArrayList<String> list = new ArrayList<String>(s);
|
ArrayList<String> list = new ArrayList<String>(s);
|
||||||
if (!originalKeywords.containsKey(c)) {
|
if (!originalKeywords.containsKey(c)) {
|
||||||
originalKeywords.put(c, list);
|
originalKeywords.put(c, list);
|
||||||
@@ -193,7 +207,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getOriginalKeywords(Card c) {
|
public final ArrayList<String> getOriginalKeywords(final Card c) {
|
||||||
ArrayList<String> returnList = new ArrayList<String>();
|
ArrayList<String> returnList = new ArrayList<String>();
|
||||||
if (originalKeywords.containsKey(c)) {
|
if (originalKeywords.containsKey(c)) {
|
||||||
returnList.addAll(originalKeywords.get(c));
|
returnList.addAll(originalKeywords.get(c));
|
||||||
@@ -206,7 +220,7 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public void clearOriginalKeywords(Card c) {
|
public final void clearOriginalKeywords(final Card c) {
|
||||||
if (originalKeywords.containsKey(c)) {
|
if (originalKeywords.containsKey(c)) {
|
||||||
originalKeywords.get(c).clear();
|
originalKeywords.get(c).clear();
|
||||||
}
|
}
|
||||||
@@ -215,7 +229,7 @@ public class StaticEffect {
|
|||||||
/**
|
/**
|
||||||
* <p>clearAllOriginalKeywords.</p>
|
* <p>clearAllOriginalKeywords.</p>
|
||||||
*/
|
*/
|
||||||
public void clearAllOriginalKeywords() {
|
public final void clearAllOriginalKeywords() {
|
||||||
originalKeywords.clear();
|
originalKeywords.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +241,7 @@ public class StaticEffect {
|
|||||||
* @param power a int.
|
* @param power a int.
|
||||||
* @param toughness a int.
|
* @param toughness a int.
|
||||||
*/
|
*/
|
||||||
public void addOriginalPT(Card c, int power, int toughness) {
|
public final void addOriginalPT(final Card c, final int power, final int toughness) {
|
||||||
String pt = power + "/" + toughness;
|
String pt = power + "/" + toughness;
|
||||||
if (!originalPT.containsKey(c)) {
|
if (!originalPT.containsKey(c)) {
|
||||||
originalPT.put(c, pt);
|
originalPT.put(c, pt);
|
||||||
@@ -240,7 +254,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public int getOriginalPower(Card c) {
|
public final int getOriginalPower(final Card c) {
|
||||||
int power = -1;
|
int power = -1;
|
||||||
if (originalPT.containsKey(c)) {
|
if (originalPT.containsKey(c)) {
|
||||||
power = Integer.parseInt(originalPT.get(c).split("/")[0]);
|
power = Integer.parseInt(originalPT.get(c).split("/")[0]);
|
||||||
@@ -254,7 +268,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public int getOriginalToughness(Card c) {
|
public final int getOriginalToughness(final Card c) {
|
||||||
int tough = -1;
|
int tough = -1;
|
||||||
if (originalPT.containsKey(c)) {
|
if (originalPT.containsKey(c)) {
|
||||||
tough = Integer.parseInt(originalPT.get(c).split("/")[1]);
|
tough = Integer.parseInt(originalPT.get(c).split("/")[1]);
|
||||||
@@ -265,7 +279,7 @@ public class StaticEffect {
|
|||||||
/**
|
/**
|
||||||
* <p>clearAllOriginalPTs.</p>
|
* <p>clearAllOriginalPTs.</p>
|
||||||
*/
|
*/
|
||||||
public void clearAllOriginalPTs() {
|
public final void clearAllOriginalPTs() {
|
||||||
originalPT.clear();
|
originalPT.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,17 +289,17 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean isOverwriteTypes() {
|
public final boolean isOverwriteTypes() {
|
||||||
return overwriteTypes;
|
return overwriteTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>overwriteTypes</code>.</p>
|
* <p>Setter for the field <code>overwriteTypes</code>.</p>
|
||||||
*
|
*
|
||||||
* @param overwriteTypes a boolean.
|
* @param overwriteTypesIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setOverwriteTypes(boolean overwriteTypes) {
|
public final void setOverwriteTypes(final boolean overwriteTypesIn) {
|
||||||
this.overwriteTypes = overwriteTypes;
|
this.overwriteTypes = overwriteTypesIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,17 +307,17 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean isKeepSupertype() {
|
public final boolean isKeepSupertype() {
|
||||||
return keepSupertype;
|
return keepSupertype;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>keepSupertype</code>.</p>
|
* <p>Setter for the field <code>keepSupertype</code>.</p>
|
||||||
*
|
*
|
||||||
* @param keepSupertype a boolean.
|
* @param keepSupertypeIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setKeepSupertype(boolean keepSupertype) {
|
public final void setKeepSupertype(boolean keepSupertypeIn) {
|
||||||
this.keepSupertype = keepSupertype;
|
this.keepSupertype = keepSupertypeIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
//should we overwrite land types?
|
//should we overwrite land types?
|
||||||
@@ -312,17 +326,17 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
public boolean isRemoveSubTypes() {
|
public final boolean isRemoveSubTypes() {
|
||||||
return removeSubTypes;
|
return removeSubTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Setter for the field <code>removeSubTypes</code>.</p>
|
* <p>Setter for the field <code>removeSubTypes</code>.</p>
|
||||||
*
|
*
|
||||||
* @param removeSubTypes a boolean.
|
* @param removeSubTypesIn a boolean.
|
||||||
*/
|
*/
|
||||||
public void setRemoveSubTypes(boolean removeSubTypes) {
|
public final void setRemoveSubTypes(final boolean removeSubTypesIn) {
|
||||||
this.removeSubTypes = removeSubTypes;
|
this.removeSubTypes = removeSubTypesIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
//original types
|
//original types
|
||||||
@@ -332,12 +346,14 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.lang.String} object.
|
* @param s a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalType(Card c, String s) {
|
public final void addOriginalType(final Card c, final String s) {
|
||||||
if (!originalTypes.containsKey(c)) {
|
if (!originalTypes.containsKey(c)) {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
list.add(s);
|
list.add(s);
|
||||||
originalTypes.put(c, list);
|
originalTypes.put(c, list);
|
||||||
} else originalTypes.get(c).add(s);
|
} else {
|
||||||
|
originalTypes.get(c).add(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -346,7 +362,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.util.ArrayList} object.
|
* @param s a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public void addOriginalTypes(Card c, ArrayList<String> s) {
|
public final void addOriginalTypes(final Card c, final ArrayList<String> s) {
|
||||||
ArrayList<String> list = new ArrayList<String>(s);
|
ArrayList<String> list = new ArrayList<String>(s);
|
||||||
if (!originalTypes.containsKey(c)) {
|
if (!originalTypes.containsKey(c)) {
|
||||||
originalTypes.put(c, list);
|
originalTypes.put(c, list);
|
||||||
@@ -362,7 +378,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getOriginalTypes(Card c) {
|
public final ArrayList<String> getOriginalTypes(final Card c) {
|
||||||
ArrayList<String> returnList = new ArrayList<String>();
|
ArrayList<String> returnList = new ArrayList<String>();
|
||||||
if (originalTypes.containsKey(c)) {
|
if (originalTypes.containsKey(c)) {
|
||||||
returnList.addAll(originalTypes.get(c));
|
returnList.addAll(originalTypes.get(c));
|
||||||
@@ -375,7 +391,7 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
*/
|
*/
|
||||||
public void clearOriginalTypes(Card c) {
|
public final void clearOriginalTypes(final Card c) {
|
||||||
if (originalTypes.containsKey(c)) {
|
if (originalTypes.containsKey(c)) {
|
||||||
originalTypes.get(c).clear();
|
originalTypes.get(c).clear();
|
||||||
}
|
}
|
||||||
@@ -384,7 +400,7 @@ public class StaticEffect {
|
|||||||
/**
|
/**
|
||||||
* <p>clearAllOriginalTypes.</p>
|
* <p>clearAllOriginalTypes.</p>
|
||||||
*/
|
*/
|
||||||
public void clearAllOriginalTypes() {
|
public final void clearAllOriginalTypes() {
|
||||||
originalTypes.clear();
|
originalTypes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,12 +411,14 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param s a {@link java.lang.String} object.
|
* @param s a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void addType(Card c, String s) {
|
public final void addType(final Card c, final String s) {
|
||||||
if (!types.containsKey(c)) {
|
if (!types.containsKey(c)) {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
list.add(s);
|
list.add(s);
|
||||||
types.put(c, list);
|
types.put(c, list);
|
||||||
} else types.get(c).add(s);
|
} else {
|
||||||
|
types.get(c).add(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -409,7 +427,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getTypes(Card c) {
|
public final ArrayList<String> getTypes(final Card c) {
|
||||||
ArrayList<String> returnList = new ArrayList<String>();
|
ArrayList<String> returnList = new ArrayList<String>();
|
||||||
if (types.containsKey(c)) {
|
if (types.containsKey(c)) {
|
||||||
returnList.addAll(types.get(c));
|
returnList.addAll(types.get(c));
|
||||||
@@ -423,7 +441,7 @@ public class StaticEffect {
|
|||||||
* @param c a {@link forge.Card} object.
|
* @param c a {@link forge.Card} object.
|
||||||
* @param type a {@link java.lang.String} object.
|
* @param type a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void removeType(Card c, String type) {
|
public final void removeType(final Card c, final String type) {
|
||||||
if (types.containsKey(c)) {
|
if (types.containsKey(c)) {
|
||||||
types.get(c).remove(type);
|
types.get(c).remove(type);
|
||||||
}
|
}
|
||||||
@@ -602,7 +620,7 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @param y a int.
|
* @param y a int.
|
||||||
*/
|
*/
|
||||||
public void setYValue(int y) {
|
public final void setYValue(final int y) {
|
||||||
yValue = y;
|
yValue = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,25 +629,34 @@ public class StaticEffect {
|
|||||||
*
|
*
|
||||||
* @return a int.
|
* @return a int.
|
||||||
*/
|
*/
|
||||||
public int getYValue() {
|
public final int getYValue() {
|
||||||
return yValue;
|
return yValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParams(HashMap<String, String> params) {
|
/**
|
||||||
mapParams = params;
|
* setParams.
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
* @param params a HashMap
|
||||||
|
*/
|
||||||
|
public final void setParams(HashMap<String, String> params) {
|
||||||
|
mapParams = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, String> getParams() {
|
public HashMap<String, String> getParams() {
|
||||||
return mapParams;
|
return mapParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChosenType(String type) {
|
public void setChosenType(String type) {
|
||||||
chosenType = type;
|
chosenType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getChosenType.
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getChosenType() {
|
public String getChosenType() {
|
||||||
return chosenType;
|
return chosenType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} //end class StaticEffect
|
||||||
}//end class StaticEffect
|
|
||||||
|
|||||||
@@ -17,106 +17,140 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
public class StaticEffects {
|
public class StaticEffects {
|
||||||
|
|
||||||
//**************** StaticAbility system **************************
|
//**************** StaticAbility system **************************
|
||||||
public ArrayList<StaticEffect> staticEffects;
|
/**
|
||||||
|
* staticEffects.
|
||||||
|
*/
|
||||||
|
public ArrayList<StaticEffect> staticEffects;
|
||||||
|
|
||||||
public void clearStaticEffects() {
|
/**
|
||||||
|
* clearStaticEffect.
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
*/
|
||||||
|
public final void clearStaticEffects() {
|
||||||
// remove all static effects
|
// remove all static effects
|
||||||
for (int i = 0; i < staticEffects.size(); i++) {
|
for (int i = 0; i < staticEffects.size(); i++) {
|
||||||
removeStaticEffect(staticEffects.get(i));
|
removeStaticEffect(staticEffects.get(i));
|
||||||
}
|
}
|
||||||
staticEffects = new ArrayList<StaticEffect>();
|
staticEffects = new ArrayList<StaticEffect>();
|
||||||
|
|
||||||
AllZone.getTriggerHandler().removeTemporaryTriggers();
|
AllZone.getTriggerHandler().removeTemporaryTriggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStaticEffect(StaticEffect staticEffect) {
|
/**
|
||||||
staticEffects.add(staticEffect);
|
* addStaticEffect.
|
||||||
}
|
* TODO Write javadoc for this method.
|
||||||
|
* @param staticEffect a StaticEffect
|
||||||
|
*/
|
||||||
|
public final void addStaticEffect(final StaticEffect staticEffect) {
|
||||||
|
staticEffects.add(staticEffect);
|
||||||
|
}
|
||||||
|
|
||||||
void removeStaticEffect(StaticEffect se) {
|
/**
|
||||||
|
* removeStaticEffect
|
||||||
|
* TODO Write javadoc for this method.
|
||||||
|
* @param se a StaticEffect
|
||||||
|
*/
|
||||||
|
final void removeStaticEffect(final StaticEffect se) {
|
||||||
CardList affectedCards = se.getAffectedCards();
|
CardList affectedCards = se.getAffectedCards();
|
||||||
HashMap<String, String> params = se.getParams();
|
HashMap<String, String> params = se.getParams();
|
||||||
|
|
||||||
int powerBonus = 0;
|
int powerBonus = 0;
|
||||||
int toughnessBonus = 0;
|
int toughnessBonus = 0;
|
||||||
boolean setPT = false;
|
boolean setPT = false;
|
||||||
String addKeywords[] = null;
|
String[] addKeywords = null;
|
||||||
String addColors = null;
|
String addColors = null;
|
||||||
|
|
||||||
if (params.containsKey("SetPower") || params.containsKey("SetToughness")) {
|
if (params.containsKey("SetPower") || params.containsKey("SetToughness")) {
|
||||||
setPT = true;
|
setPT = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddPower")) {
|
if (params.containsKey("AddPower")) {
|
||||||
if (params.get("AddPower").equals("X")) {
|
if (params.get("AddPower").equals("X")) {
|
||||||
powerBonus = se.getXValue();
|
powerBonus = se.getXValue();
|
||||||
} else if (params.get("AddPower").equals("Y")) {
|
} else if (params.get("AddPower").equals("Y")) {
|
||||||
powerBonus = se.getYValue();
|
powerBonus = se.getYValue();
|
||||||
} else
|
} else {
|
||||||
powerBonus = Integer.valueOf(params.get("AddPower"));
|
powerBonus = Integer.valueOf(params.get("AddPower"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddToughness")) {
|
if (params.containsKey("AddToughness")) {
|
||||||
if (params.get("AddToughness").equals("X"))
|
if (params.get("AddToughness").equals("X")) {
|
||||||
toughnessBonus = se.getXValue();
|
toughnessBonus = se.getXValue();
|
||||||
else if (params.get("AddToughness").equals("Y"))
|
} else if (params.get("AddToughness").equals("Y")) {
|
||||||
toughnessBonus = se.getYValue();
|
toughnessBonus = se.getYValue();
|
||||||
else toughnessBonus = Integer.valueOf(params.get("AddToughness"));
|
} else {
|
||||||
}
|
toughnessBonus = Integer.valueOf(params.get("AddToughness"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddKeyword"))
|
if (params.containsKey("AddKeyword")) {
|
||||||
addKeywords = params.get("AddKeyword").split(" & ");
|
addKeywords = params.get("AddKeyword").split(" & ");
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("AddColor"))
|
if (params.containsKey("AddColor")) {
|
||||||
addColors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(params.get("AddColor").split(" & "))));
|
addColors = CardUtil.getShortColorsString(
|
||||||
|
new ArrayList<String>(Arrays.asList(params.get("AddColor").split(" & "))));
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("SetColor"))
|
if (params.containsKey("SetColor")) {
|
||||||
addColors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(params.get("SetColor").split(" & "))));
|
addColors = CardUtil.getShortColorsString(
|
||||||
|
new ArrayList<String>(Arrays.asList(params.get("SetColor").split(" & "))));
|
||||||
|
}
|
||||||
|
|
||||||
//modify the affected card
|
//modify the affected card
|
||||||
for (int i = 0; i < affectedCards.size(); i++) {
|
for (int i = 0; i < affectedCards.size(); i++) {
|
||||||
Card affectedCard = affectedCards.get(i);
|
Card affectedCard = affectedCards.get(i);
|
||||||
|
|
||||||
//remove set P/T
|
//remove set P/T
|
||||||
if(!params.containsKey("CharacteristicDefining") && setPT)
|
if (!params.containsKey("CharacteristicDefining") && setPT) {
|
||||||
affectedCard.removeNewPT(se.getTimestamp());
|
affectedCard.removeNewPT(se.getTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
//remove P/T bonus
|
//remove P/T bonus
|
||||||
affectedCard.addSemiPermanentAttackBoost(powerBonus * -1);
|
affectedCard.addSemiPermanentAttackBoost(powerBonus * -1);
|
||||||
affectedCard.addSemiPermanentDefenseBoost(toughnessBonus * -1);
|
affectedCard.addSemiPermanentDefenseBoost(toughnessBonus * -1);
|
||||||
|
|
||||||
//remove keywords
|
//remove keywords
|
||||||
if (addKeywords != null)
|
if (addKeywords != null) {
|
||||||
for (String keyword : addKeywords)
|
for (String keyword : addKeywords) {
|
||||||
affectedCard.removeExtrinsicKeyword(keyword);
|
affectedCard.removeExtrinsicKeyword(keyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//remove abilities
|
//remove abilities
|
||||||
if (params.containsKey("AddAbility")) {
|
if (params.containsKey("AddAbility")) {
|
||||||
SpellAbility[] spellAbility = affectedCard.getSpellAbility();
|
SpellAbility[] spellAbility = affectedCard.getSpellAbility();
|
||||||
for (SpellAbility s : spellAbility)
|
for (SpellAbility s : spellAbility) {
|
||||||
if (s.getType().equals("Temporary"))
|
if (s.getType().equals("Temporary")) {
|
||||||
affectedCard.removeSpellAbility(s);
|
affectedCard.removeSpellAbility(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove Types
|
//remove Types
|
||||||
if (params.containsKey("AddType"))
|
if (params.containsKey("AddType")) {
|
||||||
affectedCard.removeChangedCardTypes(se.getTimestamp());
|
affectedCard.removeChangedCardTypes(se.getTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
//remove colors
|
//remove colors
|
||||||
if (addColors != null)
|
if (addColors != null) {
|
||||||
affectedCard.removeColor(addColors, affectedCard, !se.isOverwriteColors(), se.getTimestamp(affectedCard));
|
affectedCard.removeColor(addColors, affectedCard,
|
||||||
}
|
!se.isOverwriteColors(), se.getTimestamp(affectedCard));
|
||||||
se.clearTimestamps();
|
}
|
||||||
|
}
|
||||||
|
se.clearTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//**************** End StaticAbility system **************************
|
//**************** End StaticAbility system **************************
|
||||||
|
|
||||||
//this is used to keep track of all state-based effects in play:
|
//this is used to keep track of all state-based effects in play:
|
||||||
private HashMap<String, Integer> stateBasedMap = new HashMap<String, Integer>();
|
private HashMap<String, Integer> stateBasedMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
//this is used to define all cards that are state-based effects, and map the corresponding commands to their cardnames
|
//this is used to define all cards that are state-based effects, and map the
|
||||||
/** Constant <code>cardToEffectsList</code> */
|
//corresponding commands to their cardnames
|
||||||
|
/** Constant <code>cardToEffectsList</code>. */
|
||||||
private static HashMap<String, String[]> cardToEffectsList = new HashMap<String, String[]>();
|
private static HashMap<String, String[]> cardToEffectsList = new HashMap<String, String[]>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,7 +164,7 @@ public class StaticEffects {
|
|||||||
/**
|
/**
|
||||||
* <p>initStateBasedEffectsList.</p>
|
* <p>initStateBasedEffectsList.</p>
|
||||||
*/
|
*/
|
||||||
public void initStateBasedEffectsList() {
|
public final void initStateBasedEffectsList() {
|
||||||
//value has to be an array, since certain cards have multiple commands associated with them
|
//value has to be an array, since certain cards have multiple commands associated with them
|
||||||
|
|
||||||
cardToEffectsList.put("Avatar", new String[]{"Ajani_Avatar_Token"});
|
cardToEffectsList.put("Avatar", new String[]{"Ajani_Avatar_Token"});
|
||||||
@@ -157,7 +191,7 @@ public class StaticEffects {
|
|||||||
*
|
*
|
||||||
* @return a {@link java.util.HashMap} object.
|
* @return a {@link java.util.HashMap} object.
|
||||||
*/
|
*/
|
||||||
public HashMap<String, String[]> getCardToEffectsList() {
|
public final HashMap<String, String[]> getCardToEffectsList() {
|
||||||
return cardToEffectsList;
|
return cardToEffectsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,11 +200,12 @@ public class StaticEffects {
|
|||||||
*
|
*
|
||||||
* @param s a {@link java.lang.String} object.
|
* @param s a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void addStateBasedEffect(String s) {
|
public final void addStateBasedEffect(final String s) {
|
||||||
if (stateBasedMap.containsKey(s))
|
if (stateBasedMap.containsKey(s)) {
|
||||||
stateBasedMap.put(s, stateBasedMap.get(s) + 1);
|
stateBasedMap.put(s, stateBasedMap.get(s) + 1);
|
||||||
else
|
} else {
|
||||||
stateBasedMap.put(s, 1);
|
stateBasedMap.put(s, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,11 +213,12 @@ public class StaticEffects {
|
|||||||
*
|
*
|
||||||
* @param s a {@link java.lang.String} object.
|
* @param s a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
public void removeStateBasedEffect(String s) {
|
public final void removeStateBasedEffect(final String s) {
|
||||||
if (stateBasedMap.containsKey(s)) {
|
if (stateBasedMap.containsKey(s)) {
|
||||||
stateBasedMap.put(s, stateBasedMap.get(s) - 1);
|
stateBasedMap.put(s, stateBasedMap.get(s) - 1);
|
||||||
if (stateBasedMap.get(s) == 0)
|
if (stateBasedMap.get(s) == 0) {
|
||||||
stateBasedMap.remove(s);
|
stateBasedMap.remove(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,21 +227,21 @@ public class StaticEffects {
|
|||||||
*
|
*
|
||||||
* @return a {@link java.util.HashMap} object.
|
* @return a {@link java.util.HashMap} object.
|
||||||
*/
|
*/
|
||||||
public HashMap<String, Integer> getStateBasedMap() {
|
public final HashMap<String, Integer> getStateBasedMap() {
|
||||||
return stateBasedMap;
|
return stateBasedMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>reset.</p>
|
* <p>reset.</p>
|
||||||
*/
|
*/
|
||||||
public void reset() {
|
public final void reset() {
|
||||||
stateBasedMap.clear();
|
stateBasedMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>rePopulateStateBasedList.</p>
|
* <p>rePopulateStateBasedList.</p>
|
||||||
*/
|
*/
|
||||||
public void rePopulateStateBasedList() {
|
public final void rePopulateStateBasedList() {
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
CardList cards = AllZoneUtil.getCardsInPlay();
|
CardList cards = AllZoneUtil.getCardsInPlay();
|
||||||
@@ -229,4 +265,5 @@ public class StaticEffects {
|
|||||||
Log.debug("== End add state effects ==");
|
Log.debug("== End add state effects ==");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} //end class StaticEffects
|
||||||
|
|||||||
Reference in New Issue
Block a user