Wow, looks like I ended up giving Melvin a bunch of trouble to correct some of those cards. Seriously, you guys don't have to go out of your way to correct my mistakes, when there's something wrong with the submission please just ignore it. I don't really have a clue about what I'm doing and realize I'm likely to make a lot of blunders in the scripts.
Edit: I was trying to do
Maze of Ith from
Elvish Scout's groovy. It's not crashing, but it's not working either - I don't get the chance to activate the ability when the opponent declares the attack. I thought about asking for help here just because it feels like it's really close - if I'm completely off and this is actually gonna take more work, then never mind this.
- Code: Select all
def ATTACKING_CREATURE = new MagicPermanentFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicPermanent target) {
return target.isCreature() && target.isAttacking();
}
};
def TARGET_ATTACKING_CREATURE = new MagicTargetChoice(
ATTACKING_CREATURE,
MagicTargetHint.Positive,
"target attacking creature"
);
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Block),
"Untap"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [
new MagicTapEvent(source)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return new MagicEvent(
source,
TARGET_ATTACKING_CREATURE,
MagicTapTargetPicker.Untap,
this,
"Untap target attacking creature\$. " +
"Prevent all combat damage that would be dealt to and dealt by it this turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
game.doAction(new MagicUntapAction(it));
game.doAction(new MagicAddTurnTriggerAction(
it,
MagicIfDamageWouldBeDealtTrigger.PreventCombatDamageDealtToDealtBy
));
});
}
}
]
edit2: Actually, never mind this, I was looking at more cards and realized that this type of script is typical of situations in which you want to target a creature you control, targeting any creature seems to be usually done in a completely different way. Looks like I was way off, my bad.