Re: Card Contributions
run into another question.
Xenagos, God of Revels awards +X/+X until end of turn to another creature.
I got the card implemented, and it works so far except I can't find a way to exclude him from his own ability targeting.
I saw you using the the word "other" in card definitions... so how is that done in groovy?
Whip of Erebos is a Corpse Dance on demand, so to say, except it adds an extra ability to the reanimated creature - if that creature would leave play in any case exile it.
The card works fine so far, except, that the given ability ExileAtLeaving wouldn't trigger. And the timing (sorcery) needs yet to be implemented. Any idea how to fix this?
Whip of Erebos:
Xenagos, God of Revels awards +X/+X until end of turn to another creature.
I got the card implemented, and it works so far except I can't find a way to exclude him from his own ability targeting.
I saw you using the the word "other" in card definitions... so how is that done in groovy?
- Code: Select all
name=Xenagos, God of Revels
url=http://magiccards.info/query?q=%21xenagos%2C%20god%20of%20revels
image=http://mtgimage.com/card/xenagos%2C%20god%20of%20revels.jpg
value=3.863
rarity=M
type=Legendary,Enchantment,Creature
subtype=God
cost={3}{R}{G}
pt=6/5
ability=indestructible
timing=main
requires_groovy_code
- Code: Select all
[
new MagicStatic(MagicLayer.Type) {
@Override
public int getTypeFlags(final MagicPermanent permanent,final int flags) {
return flags & ~MagicType.Creature.getMask();
}
@Override
public void modSubTypeFlags(final MagicPermanent permanent,final Set<MagicSubType> flags) {
flags.remove(MagicSubType.God);
}
@Override
public boolean condition(final MagicGame game,final MagicPermanent source,final MagicPermanent target) {
return source.getController().getDevotion(MagicColor.Green, MagicColor.Red) < 7;
}
},
new MagicAtBeginOfCombatTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer attackingPlayer) {
return permanent.getController() == attackingPlayer ? new MagicEvent(
permanent,
new MagicTargetChoice("target creature you control"),
MagicPumpTargetPicker.create(),
this,
"Another target creature\$ you control gains haste and gets +X/+X until end of turn, where X is that creature's power."
):MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
final MagicPermanent perm ->
game.doAction(new MagicAddStaticAction(perm, new MagicStatic(MagicLayer.ModPT,MagicStatic.UntilEOT) {
@Override
public void modPowerToughness(final MagicPermanent source,final MagicPermanent permanent,final MagicPowerToughness pt) {
pt.add(permanent.getPower(),permanent.getPower());
}
}));
});
}
}
]
Whip of Erebos is a Corpse Dance on demand, so to say, except it adds an extra ability to the reanimated creature - if that creature would leave play in any case exile it.
The card works fine so far, except, that the given ability ExileAtLeaving wouldn't trigger. And the timing (sorcery) needs yet to be implemented. Any idea how to fix this?
Whip of Erebos:
- Code: Select all
name=Whip of Erebos
url=http://magiccards.info/query?q=%21whip%20of%20erebos
image=http://mtgimage.com/card/whip%20of%20erebos.jpg
value=3.511
rarity=R
type=Legendary,Enchantment,Artifact
cost={2}{B}{B}
ability=lord Creatures you control have lifelink
timing=artifact
requires_groovy_code
- Code: Select all
def ExileAtLeaving = new MagicWhenLeavesPlayTrigger(){
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicRemoveFromPlayAction act) {
return act.isPermanent(permanent)? new MagicExileEvent(permanent) : MagicEvent.NONE;
}
};
[
new MagicPermanentActivation(new MagicActivationHints(MagicTiming.Animate),"Animate"){
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [
new MagicTapEvent(source),
new MagicPayManaCostEvent(source,"{2}{B}{B}")
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_CARD_FROM_GRAVEYARD,
MagicGraveyardTargetPicker.PutOntoBattlefield,
this,
"Return target creature card\$ from your graveyard to the battlefield. "+
"It gains haste. Exile it at the beginning of the next end step. "+
"If it would leave the battlefield, exile it instead of putting it anywhere else."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetCard(game, {
final MagicCard targetCard ->
game.doAction(new MagicRemoveCardAction(targetCard,MagicLocationType.Graveyard));
final MagicPlayCardAction action = new MagicPlayCardAction(targetCard,event.getPlayer());
game.doAction(action);
final MagicPermanent permanent = action.getPermanent();
game.doAction(new MagicGainAbilityAction(permanent,MagicAbility.Haste,MagicStatic.UntilEOT));
game.doAction(new MagicGainAbilityAction(permanent,MagicAbility.ExileAtEnd,MagicStatic.UntilEOT));
permanent.addAbility(ExileAtLeaving);
});
}
}
]

