2013-05-30 19:34:19 -07:00
|
|
|
def drawCards = {
|
|
|
|
final MagicGame game,final MagicPermanent permanent ->
|
|
|
|
if (permanent.hasCounters()) {
|
|
|
|
game.doAction(new MagicDrawAction(
|
|
|
|
permanent.getController(),
|
|
|
|
permanent.getCounters(
|
|
|
|
MagicCounterType.PlusOne)
|
|
|
|
));
|
2013-04-12 19:32:25 -07:00
|
|
|
}
|
2013-05-30 19:34:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[
|
|
|
|
new MagicWhenComesIntoPlayTrigger() {
|
2013-04-12 19:32:25 -07:00
|
|
|
@Override
|
|
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
|
2013-06-03 22:46:22 -07:00
|
|
|
final MagicTargetFilter<MagicPermanent> targetFilter=new MagicOtherPermanentTargetFilter(
|
2013-04-12 19:32:25 -07:00
|
|
|
MagicTargetFilter.TARGET_CREATURE_YOU_CONTROL,permanent);
|
|
|
|
final MagicTargetChoice targetChoice=new MagicTargetChoice(
|
|
|
|
targetFilter,false,MagicTargetHint.None,"a creature other than "+permanent+" to sacrifice");
|
|
|
|
if (player.getNrOfPermanentsWithType(MagicType.Creature)>1) {
|
|
|
|
return new MagicEvent(
|
|
|
|
permanent,
|
|
|
|
new MagicMayChoice(targetChoice),
|
|
|
|
MagicSacrificeTargetPicker.create(),
|
|
|
|
this,
|
2013-05-30 19:34:19 -07:00
|
|
|
"You may\$ sacrifice a creature\$ to SN."
|
2013-04-12 19:32:25 -07:00
|
|
|
);
|
|
|
|
}
|
2013-05-30 19:34:19 -07:00
|
|
|
drawCards(game, permanent);
|
2013-04-12 19:32:25 -07:00
|
|
|
return MagicEvent.NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean usesStack() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
|
|
final MagicPermanent permanent=event.getPermanent();
|
|
|
|
if (event.isYes()) {
|
|
|
|
event.processTargetPermanent(game,new MagicPermanentAction() {
|
|
|
|
public void doAction(final MagicPermanent creature) {
|
|
|
|
game.doAction(new MagicSacrificeAction(creature));
|
|
|
|
game.doAction(new MagicChangeCountersAction(permanent,MagicCounterType.PlusOne,1,true));
|
|
|
|
final MagicEvent newEvent=executeTrigger(game,permanent,permanent.getController());
|
|
|
|
if (newEvent.isValid()) {
|
|
|
|
game.addEvent(newEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
drawCards(game,permanent);
|
|
|
|
}
|
|
|
|
}
|
2013-05-30 19:34:19 -07:00
|
|
|
}
|
|
|
|
]
|