added MagicBecomesBlockedPumpTrigger. changed Ichorclaw Myr to use MagicBecomesBlockedPumpTrigger

master
beholder 2011-10-08 11:21:39 +02:00
parent f942a9419b
commit ea6ac20ca4
2 changed files with 43 additions and 26 deletions

View File

@ -1,31 +1,7 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeTurnPTAction;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicWhenBecomesBlockedTrigger;
import magic.model.trigger.MagicBecomesBlockedPumpTrigger;
public class Ichorclaw_Myr {
public static final MagicWhenBecomesBlockedTrigger T = new MagicWhenBecomesBlockedTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent data) {
return (permanent == data ) ?
new MagicEvent(
permanent,
permanent.getController(),
new Object[]{permanent},
this,
permanent + " gets +2/+2 until end of turn."):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.doAction(new MagicChangeTurnPTAction((MagicPermanent)data[0],2,2));
}
};
public static final MagicBecomesBlockedPumpTrigger T = new MagicBecomesBlockedPumpTrigger(2,2);
}

View File

@ -0,0 +1,41 @@
package magic.model.trigger;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeTurnPTAction;
import magic.model.event.MagicEvent;
public class MagicBecomesBlockedPumpTrigger extends MagicWhenBecomesBlockedTrigger {
private final int amountPower;
private final int amountToughness;
public MagicBecomesBlockedPumpTrigger(final int amountPower,final int amountToughness) {
this.amountPower = amountPower;
this.amountToughness = amountToughness;
}
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent data) {
return (permanent == data ) ?
new MagicEvent(
permanent,
permanent.getController(),
new Object[]{permanent},
this,
permanent + " gets +" + amountPower + "/+" + amountToughness + " until end of turn."):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.doAction(new MagicChangeTurnPTAction(
(MagicPermanent)data[0],
amountPower,
amountToughness));
}
}