mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
restricted class visibility and performed some style adjustments on CardFaceRules
This commit is contained in:
@@ -9,7 +9,6 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -20,51 +19,49 @@ import forge.card.mana.ManaCost;
|
|||||||
* TODO: Write javadoc for this type.
|
* TODO: Write javadoc for this type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CardFaceRules implements ICardCharacteristics {
|
final class CardFaceRules implements ICardCharacteristics {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private CardType type = null;
|
private CardType type = null;
|
||||||
private ManaCost manaCost = ManaCost.NO_COST;
|
private ManaCost manaCost = ManaCost.NO_COST;
|
||||||
private ColorSet color = null;
|
private ColorSet color = null;
|
||||||
|
|
||||||
private String oracleText = null;
|
private String oracleText = null;
|
||||||
private int iPower = -1;
|
private int iPower = -1;
|
||||||
private int iToughness = -1;
|
private int iToughness = -1;
|
||||||
private String power = null;
|
private String power = null;
|
||||||
private String toughness = null;
|
private String toughness = null;
|
||||||
private int initialLoyalty = 0;
|
private int initialLoyalty = 0;
|
||||||
|
|
||||||
private final List<String> keywords = new ArrayList<String>();
|
private final List<String> keywords = new ArrayList<String>();
|
||||||
|
|
||||||
// these implement ICardCharacteristics
|
// these implement ICardCharacteristics
|
||||||
@Override public String getOracleText() { return oracleText; }
|
@Override public final String getOracleText() { return oracleText; }
|
||||||
@Override public int getIntPower() { return iPower; }
|
@Override public final int getIntPower() { return iPower; }
|
||||||
@Override public int getIntToughness() { return iToughness; }
|
@Override public final int getIntToughness() { return iToughness; }
|
||||||
@Override public String getPower() { return power; }
|
@Override public final String getPower() { return power; }
|
||||||
@Override public String getToughness() { return toughness; }
|
@Override public final String getToughness() { return toughness; }
|
||||||
@Override public int getInitialLoyalty() { return initialLoyalty; }
|
@Override public int getInitialLoyalty() { return initialLoyalty; }
|
||||||
@Override public final String getName() { return this.name; }
|
@Override public final String getName() { return this.name; }
|
||||||
@Override public final CardType getType() { return this.type; }
|
@Override public final CardType getType() { return this.type; }
|
||||||
@Override public final ManaCost getManaCost() { return this.manaCost; }
|
@Override public final ManaCost getManaCost() { return this.manaCost; }
|
||||||
@Override public final ColorSet getColor() { return this.color; }
|
@Override public final ColorSet getColor() { return this.color; }
|
||||||
@Override public Iterable<String> getKeywords() { return keywords; }
|
@Override public final Iterable<String> getKeywords() { return keywords; }
|
||||||
|
|
||||||
|
|
||||||
|
// Here come setters to allow parser supply values
|
||||||
// setters to allow parsers supply values here
|
public CardFaceRules(String name0) { this.name = name0; if ( StringUtils.isBlank(name0) ) throw new RuntimeException("Card name is empty"); }
|
||||||
public CardFaceRules(String name0) { this.name = name0; if ( StringUtils.isBlank(name0) ) throw new RuntimeException("Card name is empty"); }
|
|
||||||
|
public final void setType(CardType type0) { this.type = type0; }
|
||||||
public void setType(CardType type0) { this.type = type0; }
|
public final void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
|
||||||
public void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
|
public final void setColor(ColorSet color0) { this.color = color0; }
|
||||||
public void setColor(ColorSet color0) { this.color = color0; }
|
public final void setOracleText(String text) { this.oracleText = text; }
|
||||||
public void setOracleText(String text) { this.oracleText = text; }
|
public final void addKeyword(String value) { this.keywords.add(value); }
|
||||||
public void addKeyword(String value) { this.keywords.add(value); }
|
public final void setInitialLoaylty(int value) { this.initialLoyalty = value; }
|
||||||
public void setInitialLoaylty(int value) { this.initialLoyalty = value; }
|
public final Map<String, CardInSet> getSetsData() { return this.setsPrinted; } // reader will add sets here
|
||||||
public Map<String, CardInSet> getSetsData() { return this.setsPrinted; } // reader will add sets here
|
|
||||||
|
|
||||||
|
|
||||||
public void setPtText(String value) {
|
public void setPtText(String value) {
|
||||||
final int slashPos = value == null ? -1 : value.indexOf('/');
|
final int slashPos = value.indexOf('/');
|
||||||
if (slashPos == -1) {
|
if (slashPos == -1) {
|
||||||
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", this.getName()));
|
throw new RuntimeException(String.format("Creature '%s' has bad p/t stats", this.getName()));
|
||||||
}
|
}
|
||||||
@@ -79,9 +76,8 @@ public class CardFaceRules implements ICardCharacteristics {
|
|||||||
if ( manaCost == null && color == null ) System.err.println(name + " has neither ManaCost nor Color");
|
if ( manaCost == null && color == null ) System.err.println(name + " has neither ManaCost nor Color");
|
||||||
if ( color == null ) color = ColorSet.fromManaCost(manaCost);
|
if ( color == null ) color = ColorSet.fromManaCost(manaCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This should not be here
|
// This should not be here
|
||||||
private final Map<String, CardInSet> setsPrinted = new TreeMap<String, CardInSet>(String.CASE_INSENSITIVE_ORDER);
|
private final Map<String, CardInSet> setsPrinted = new TreeMap<String, CardInSet>(String.CASE_INSENSITIVE_ORDER);
|
||||||
@Override public Set<Entry<String, CardInSet>> getSetsPrinted() { return this.setsPrinted.entrySet(); }
|
@Override public Set<Entry<String, CardInSet>> getSetsPrinted() { return this.setsPrinted.entrySet(); }
|
||||||
@@ -93,10 +89,4 @@ public class CardFaceRules implements ICardCharacteristics {
|
|||||||
throw new RuntimeException(String.format("Card '%s' was never printed in set '%s'", this.getName(), setCode));
|
throw new RuntimeException(String.format("Card '%s' was never printed in set '%s'", this.getName(), setCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user