magarena/release/Magarena/scripts/Tinker.groovy

40 lines
1.3 KiB
Groovy
Raw Normal View History

2013-11-15 18:22:03 -08:00
def ARTIFACT_CARD_FROM_LIBRARY = new MagicCardFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
return target.hasType(MagicType.Artifact);
}
public boolean acceptType(final MagicTargetType targetType) {
return targetType == MagicTargetType.Library;
}
};
def AN_ARTIFACT_CARD_FROM_LIBRARY = new MagicTargetChoice(
ARTIFACT_CARD_FROM_LIBRARY,
"an artifact card"
);
[
new MagicAdditionalCost() {
@Override
public MagicEvent getEvent(final MagicSource source) {
return new MagicSacrificePermanentEvent(source, MagicTargetChoice.SACRIFICE_ARTIFACT);
}
},
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
this,
"PN may search his or her library for an artifact card and put it on the battlefield, then shuffle his or her library."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.addEvent(new MagicSearchOntoBattlefieldEvent(
event,
AN_ARTIFACT_CARD_FROM_LIBRARY
));
}
}
]