mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
CardRules.reinitializeFromScript
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this type.
|
* TODO: Write javadoc for this type.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,13 +34,10 @@ import forge.card.mana.ManaCostShard;
|
|||||||
* @version $Id: CardRules.java 9708 2011-08-09 19:34:12Z jendave $
|
* @version $Id: CardRules.java 9708 2011-08-09 19:34:12Z jendave $
|
||||||
*/
|
*/
|
||||||
public final class CardRules implements ICardCharacteristics {
|
public final class CardRules implements ICardCharacteristics {
|
||||||
private final CardSplitType splitType;
|
private CardSplitType splitType;
|
||||||
private final ICardFace mainPart;
|
private ICardFace mainPart;
|
||||||
private final ICardFace otherPart;
|
private ICardFace otherPart;
|
||||||
//private final Map<String, CardInSet> setsPrinted = new TreeMap<String, CardInSet>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
private CardAiHints aiHints;
|
private CardAiHints aiHints;
|
||||||
|
|
||||||
private ColorSet colorIdentity = null;
|
private ColorSet colorIdentity = null;
|
||||||
|
|
||||||
private CardRules(ICardFace[] faces, CardSplitType altMode, CardAiHints cah) {
|
private CardRules(ICardFace[] faces, CardSplitType altMode, CardAiHints cah) {
|
||||||
@@ -49,18 +46,6 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
otherPart = faces[1];
|
otherPart = faces[1];
|
||||||
aiHints = cah;
|
aiHints = cah;
|
||||||
|
|
||||||
//System.out.print(faces[0].getName());
|
|
||||||
|
|
||||||
// for (Entry<String, CardInSet> cs : sets.entrySet()) {
|
|
||||||
// if( CardRulesReader.editions.get(cs.getKey()) != null )
|
|
||||||
// setsPrinted.put(cs.getKey(), cs.getValue());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if ( setsPrinted.isEmpty() ) {
|
|
||||||
// System.err.println(getName() + " was not assigned any set.");
|
|
||||||
// setsPrinted.put(CardEdition.UNKNOWN.getCode(), new CardInSet(CardRarity.Common, 1) );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//Calculate Color Identity
|
//Calculate Color Identity
|
||||||
byte colMask = calculateColorIdentity(mainPart);
|
byte colMask = calculateColorIdentity(mainPart);
|
||||||
|
|
||||||
@@ -71,6 +56,18 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
colorIdentity = ColorSet.fromMask(colMask);
|
colorIdentity = ColorSet.fromMask(colMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reinitializeFromScript(Iterable<String> script) {
|
||||||
|
CardRules newRules = fromScript(script);
|
||||||
|
if(!newRules.getName().equals(this.getName()))
|
||||||
|
throw new UnsupportedOperationException("You cannot rename the card using the same CardRules object");
|
||||||
|
|
||||||
|
splitType = newRules.splitType;
|
||||||
|
mainPart = newRules.mainPart;
|
||||||
|
otherPart = newRules.otherPart;
|
||||||
|
aiHints = newRules.aiHints;
|
||||||
|
colorIdentity = newRules.colorIdentity;
|
||||||
|
}
|
||||||
|
|
||||||
private byte calculateColorIdentity(ICardFace face)
|
private byte calculateColorIdentity(ICardFace face)
|
||||||
{
|
{
|
||||||
byte res = face.getColor().getColor();
|
byte res = face.getColor().getColor();
|
||||||
|
|||||||
Reference in New Issue
Block a user