First pass of Transform ability
parent
aa940c325f
commit
4e30d3f0b7
|
@ -8,4 +8,5 @@ cost={1}{W}
|
|||
pt=1/1
|
||||
ability=At the beginning of your upkeep, you may transform SN.
|
||||
timing=main
|
||||
transform=Unholy Fiend
|
||||
oracle=At the beginning of your upkeep, you may transform Cloistered Youth.
|
|
@ -2,9 +2,12 @@ name=Unholy Fiend
|
|||
image=http://mtgimage.com/card/unholy%20fiend.jpg
|
||||
value=2.500
|
||||
rarity=U
|
||||
color=b
|
||||
type=Creature
|
||||
subtype=Horror
|
||||
pt=3/3
|
||||
ability=At the beginning of your end step, you lose 1 life.
|
||||
timing=main
|
||||
transform=Cloistered Youth
|
||||
hidden=true
|
||||
oracle=At the beginning of your end step, you lose 1 life.
|
|
@ -186,6 +186,11 @@ public enum CardProperty {
|
|||
card.setFlipCard(value);
|
||||
}
|
||||
},
|
||||
TRANSFORM() {
|
||||
public void setProperty(final MagicCardDefinition card, final String value) {
|
||||
card.setTransformCard(value);
|
||||
}
|
||||
},
|
||||
ORACLE() {
|
||||
public void setProperty(final MagicCardDefinition card, final String value) {
|
||||
card.setText(value);
|
||||
|
|
|
@ -119,11 +119,13 @@ public class MagicCardDefinition implements MagicAbilityStore {
|
|||
private final Collection<MagicManaActivation> manaActivations=new ArrayList<MagicManaActivation>();
|
||||
private final Collection<MagicEventSource> costEventSources=new ArrayList<MagicEventSource>();
|
||||
private boolean excludeManaOrCombat;
|
||||
private MagicCardDefinition flipCardDefinition;
|
||||
private MagicCardDefinition flipCardDefinition;
|
||||
private MagicCardDefinition transformCardDefinition;
|
||||
|
||||
private String abilityProperty;
|
||||
private String requiresGroovy;
|
||||
private String flipCard;
|
||||
private String transformCard;
|
||||
|
||||
private boolean isMissing = false;
|
||||
|
||||
|
@ -153,6 +155,10 @@ public class MagicCardDefinition implements MagicAbilityStore {
|
|||
flipCard = value;
|
||||
}
|
||||
|
||||
public void setTransformCard(final String value) {
|
||||
transformCard = value;
|
||||
}
|
||||
|
||||
public void setHidden() {
|
||||
hidden = true;
|
||||
}
|
||||
|
@ -176,6 +182,13 @@ public class MagicCardDefinition implements MagicAbilityStore {
|
|||
this;
|
||||
flipCardDefinition.loadAbilities();
|
||||
}
|
||||
if (transformCardDefinition == null) {
|
||||
transformCardDefinition=(transformCard !=null) ?
|
||||
CardDefinitions.getCard(transformCard) :
|
||||
this;
|
||||
transformCardDefinition.loadAbilities();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
|
@ -359,6 +372,10 @@ public class MagicCardDefinition implements MagicAbilityStore {
|
|||
return flipCardDefinition;
|
||||
}
|
||||
|
||||
public MagicCardDefinition getTransformedDefinition() {
|
||||
return transformCardDefinition;
|
||||
}
|
||||
|
||||
public boolean isBasic() {
|
||||
return hasType(MagicType.Basic);
|
||||
}
|
||||
|
@ -422,6 +439,14 @@ public class MagicCardDefinition implements MagicAbilityStore {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDoubleFaced() {
|
||||
if (transformCard !=null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getLongTypeString() {
|
||||
if (isBasic()) {
|
||||
|
|
|
@ -235,6 +235,8 @@ public class MagicPermanent extends MagicObjectImpl implements MagicSource,Magic
|
|||
return MagicCardDefinition.MORPH;
|
||||
} else if (isFlipped()) {
|
||||
return cardDefinition.getFlippedDefinition();
|
||||
} else if (isTransformed()) {
|
||||
return cardDefinition.getTransformedDefinition();
|
||||
} else {
|
||||
return cardDefinition;
|
||||
}
|
||||
|
@ -1171,6 +1173,14 @@ public class MagicPermanent extends MagicObjectImpl implements MagicSource,Magic
|
|||
public boolean isFlipped() {
|
||||
return hasState(MagicPermanentState.Flipped);
|
||||
}
|
||||
|
||||
public boolean isDoubleFaced() {
|
||||
return getCardDefinition().isDoubleFaced();
|
||||
}
|
||||
|
||||
public boolean isTransformed() {
|
||||
return hasState(MagicPermanentState.Transformed);
|
||||
}
|
||||
|
||||
public MagicTargetChoice getAuraTargetChoice() {
|
||||
if (isAura()) {
|
||||
|
|
|
@ -19,6 +19,7 @@ public enum MagicPermanentState {
|
|||
Monstrous("monstrous", ""),
|
||||
FaceDown("face down",""),
|
||||
Flipped("flipped",""),
|
||||
Transformed("transformed",""),
|
||||
;
|
||||
|
||||
// states that persist after cleanup
|
||||
|
@ -32,6 +33,7 @@ public enum MagicPermanentState {
|
|||
| Monstrous.getMask()
|
||||
| FaceDown.getMask()
|
||||
| Flipped.getMask()
|
||||
| Transformed.getMask()
|
||||
;
|
||||
|
||||
private final String description;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package magic.model.action;
|
||||
|
||||
import magic.model.MagicGame;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicPermanentState;
|
||||
|
||||
public class MagicTransformAction extends MagicAction {
|
||||
|
||||
public final MagicPermanent permanent;
|
||||
|
||||
public MagicTransformAction(final MagicPermanent aPermanent) {
|
||||
permanent = aPermanent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(final MagicGame game) {
|
||||
if (!permanent.isTransformed() && permanent.isDoubleFaced()) {
|
||||
game.doAction(MagicChangeStateAction.Set(permanent, MagicPermanentState.Transformed));
|
||||
} else if (permanent.isTransformed() && permanent.isDoubleFaced()){
|
||||
game.doAction(MagicChangeStateAction.Clear(permanent, MagicPermanentState.Transformed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoAction(final MagicGame game) {
|
||||
//do nothing
|
||||
}
|
||||
}
|
|
@ -2142,6 +2142,17 @@ public enum MagicRuleEventAction {
|
|||
}
|
||||
}
|
||||
),
|
||||
TransformSelf(
|
||||
"transform sn\\.",
|
||||
MagicTiming.Pump,
|
||||
"Transform",
|
||||
new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
||||
game.doAction(new MagicTransformAction(event.getPermanent()));
|
||||
}
|
||||
}
|
||||
),
|
||||
;
|
||||
|
||||
private final Pattern pattern;
|
||||
|
|
Loading…
Reference in New Issue