magarena/release/Magarena/scripts/Elvish_Branchbender.groovy

50 lines
1.8 KiB
Groovy

def ST = new MagicStatic(MagicLayer.Type, MagicStatic.UntilEOT) {
@Override
public void modSubTypeFlags(final MagicPermanent permanent, final Set<MagicSubType> flags) {
flags.add(MagicSubType.Treefolk);
}
@Override
public int getTypeFlags(final MagicPermanent permanent,final int flags) {
return flags|MagicType.Creature.getMask();
}
};
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Animate),
"Animate"
) {
@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,
MagicTargetChoice.Positive("target Forest"),
this,
"Until end of turn, target Forest\$ becomes an X/X Treefolk creature in addition to its other types, " +
"where X is the number of Elves you control."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
final MagicPermanent land ->
final int amount = event.getPlayer().getNrOfPermanents(MagicSubType.Elf);
final MagicStatic PT = new MagicStatic(MagicLayer.SetPT, MagicStatic.UntilEOT) {
@Override
public void modPowerToughness(final MagicPermanent source,final MagicPermanent permanent,final MagicPowerToughness pt) {
pt.set(amount,amount);
}
};
game.doAction(new MagicBecomesCreatureAction(land,PT,ST));
});
}
}
]