magarena/release/Magarena/scripts/Golem_Foundry.groovy

27 lines
1021 B
Groovy

[
new MagicWhenOtherSpellIsCastTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack cardOnStack) {
return (cardOnStack.isFriend(permanent) &&
cardOnStack.hasType(MagicType.Artifact)) ?
new MagicEvent(
permanent,
new MagicSimpleMayChoice(
MagicSimpleMayChoice.ADD_CHARGE_COUNTER,
1,
MagicSimpleMayChoice.DEFAULT_YES
),
this,
"PN may\$ put a charge counter on SN."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
game.doAction(new MagicChangeCountersAction(event.getPermanent(),MagicCounterType.Charge,1,true));
}
}
}
]