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);
}
},
SPLIT() {
public void setProperty(final MagicCardDefinition card, final String value) {
card.setSplitCardName(value);
}
},
ORACLE() {
public void setProperty(final MagicCardDefinition card, final String value) {
card.setText(value);

View File

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

View File

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

View File

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

View File

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