magarena/release/Magarena/scripts/Gwafa_Hazid__Profiteer.groovy

65 lines
2.1 KiB
Groovy

[
new MagicStatic(
MagicLayer.Ability,
MagicTargetFilter.TARGET_CREATURE
) {
@Override
public void modAbilityFlags(
final MagicPermanent source,
final MagicPermanent permanent,
final Set<MagicAbility> flags) {
flags.add(MagicAbility.CannotAttackOrBlock);
}
@Override
public boolean condition(
final MagicGame game,
final MagicPermanent source,
final MagicPermanent target) {
return target.getCounters(MagicCounterType.Bribery) > 0;
}
},
new MagicPermanentActivation(
[
MagicCondition.CAN_TAP_CONDITION,
MagicConditionFactory.ManaCost("{W}{U}")
],
new MagicActivationHints(MagicTiming.Tapping),
"Bribe"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostTapEvent(source,"{W}{U}")
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_YOUR_OPPONENT_CONTROLS,
new MagicNoCombatTargetPicker(true,true,true),
this,
"PN puts a bribery counter on target creature\$. " +
"Its controller draws a card."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicChangeCountersAction(
creature,
MagicCounterType.Bribery,
1,
true
));
game.doAction(new MagicDrawAction(creature.getController(),1));
}
});
}
}
]