add Split property to identify Split cards for Cardbuilder

master
ShawnieBoy 2016-01-31 15:06:24 +00:00
parent 3e76bb83eb
commit 1b8b58f67c
5 changed files with 36 additions and 0 deletions

View File

@ -220,6 +220,11 @@ public enum CardProperty {
card.setTransformCardName(value); card.setTransformCardName(value);
} }
}, },
SPLIT() {
public void setProperty(final MagicCardDefinition card, final String value) {
card.setSplitCardName(value);
}
},
ORACLE() { ORACLE() {
public void setProperty(final MagicCardDefinition card, final String value) { public void setProperty(final MagicCardDefinition card, final String value) {
card.setText(value); card.setText(value);

View File

@ -172,6 +172,10 @@ public class MagicCard
return getCardDefinition().isFlipCard(); return getCardDefinition().isFlipCard();
} }
public boolean isSplitCard() {
return getCardDefinition().isSplitCard();
}
public boolean isNameless() { public boolean isNameless() {
return getName().isEmpty(); return getName().isEmpty();
} }

View File

@ -88,12 +88,14 @@ public class MagicCardDefinition implements MagicAbilityStore, IRenderableCard {
private MagicCardDefinition flipCardDefinition; private MagicCardDefinition flipCardDefinition;
private MagicCardDefinition transformCardDefinition; private MagicCardDefinition transformCardDefinition;
private MagicCardDefinition splitCardDefinition;
private String abilityProperty; private String abilityProperty;
private String requiresGroovy; private String requiresGroovy;
private String effectProperty; private String effectProperty;
private String flipCardName; private String flipCardName;
private String transformCardName; private String transformCardName;
private String splitCardName;
public MagicCardDefinition() { public MagicCardDefinition() {
initialize(); initialize();
@ -128,6 +130,10 @@ public class MagicCardDefinition implements MagicAbilityStore, IRenderableCard {
transformCardName = value; transformCardName = value;
} }
public void setSplitCardName(final String value) {
splitCardName = value;
}
public void setHidden() { public void setHidden() {
hidden = true; hidden = true;
} }
@ -177,6 +183,9 @@ public class MagicCardDefinition implements MagicAbilityStore, IRenderableCard {
if (getTransformedDefinition().isHidden()) { if (getTransformedDefinition().isHidden()) {
transformCardDefinition.loadAbilities(); transformCardDefinition.loadAbilities();
} }
if (getSplitDefinition() != UNKNOWN) {
splitCardDefinition.loadAbilities();
}
} }
public boolean isValid() { public boolean isValid() {
@ -381,6 +390,15 @@ public class MagicCardDefinition implements MagicAbilityStore, IRenderableCard {
return transformCardDefinition; return transformCardDefinition;
} }
public MagicCardDefinition getSplitDefinition() {
if (splitCardDefinition == null) {
splitCardDefinition = isSplitCard() ?
CardDefinitions.getMissingOrCard(splitCardName) :
UNKNOWN;
}
return splitCardDefinition;
}
public MagicCardDefinition getCardDefinition() { public MagicCardDefinition getCardDefinition() {
return this; return this;
} }
@ -433,6 +451,10 @@ public class MagicCardDefinition implements MagicAbilityStore, IRenderableCard {
return transformCardName != null; return transformCardName != null;
} }
public boolean isSplitCard() {
return splitCardName != null;
}
public boolean hasMultipleAspects() { public boolean hasMultipleAspects() {
return isFlipCard() || isDoubleFaced(); return isFlipCard() || isDoubleFaced();
} }

View File

@ -1145,6 +1145,10 @@ public class MagicPermanent extends MagicObjectImpl implements MagicSource, Magi
return hasState(MagicPermanentState.Flipped); return hasState(MagicPermanentState.Flipped);
} }
public boolean isSplitCard() {
return false;
}
public boolean isTransformed() { public boolean isTransformed() {
return hasState(MagicPermanentState.Transformed); return hasState(MagicPermanentState.Transformed);
} }

View File

@ -27,6 +27,7 @@ public interface IRenderableCard {
boolean hasType(MagicType type); boolean hasType(MagicType type);
boolean isToken(); boolean isToken();
boolean isFlipCard(); boolean isFlipCard();
boolean isSplitCard();
boolean isDoubleFaced(); boolean isDoubleFaced();
boolean hasAbility(MagicAbility ability); boolean hasAbility(MagicAbility ability);
boolean isPlaneswalker(); boolean isPlaneswalker();