38 lines
1.2 KiB
Groovy
38 lines
1.2 KiB
Groovy
def ELF_FROM_GRAVEYARD = new MagicCardFilterImpl() {
|
|
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
|
|
return target.hasSubType(MagicSubType.Elf);
|
|
}
|
|
public boolean acceptType(final MagicTargetType targetType) {
|
|
return targetType == MagicTargetType.Graveyard;
|
|
}
|
|
};
|
|
|
|
[
|
|
new MagicPermanentActivation(
|
|
new MagicActivationHints(MagicTiming.Removal),
|
|
"Life"
|
|
) {
|
|
|
|
@Override
|
|
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
|
|
return [new MagicSacrificeEvent(source)];
|
|
}
|
|
|
|
@Override
|
|
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
|
|
return new MagicEvent(
|
|
source,
|
|
this,
|
|
"PN gains 1 life for each Elf card in his or her graveyard."
|
|
);
|
|
}
|
|
|
|
@Override
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
final MagicPlayer player = event.getPlayer();
|
|
final int amount = game.filterCards(player, ELF_FROM_GRAVEYARD).size();
|
|
game.doAction(new MagicChangeLifeAction(player,amount));
|
|
}
|
|
}
|
|
]
|