added MagicWhenBecomesBlockedTrigger. added Ichorclaw Myr

master
beholder 2011-10-08 11:08:27 +02:00
parent 08f5a095e9
commit dd93327b29
5 changed files with 65 additions and 0 deletions

View File

@ -12496,3 +12496,15 @@ converted=5
cost={4}{G} cost={4}{G}
pt=4/4 pt=4/4
timing=main timing=main
>Ichorclaw Myr
image=http://magiccards.info/scans/en/som/166.jpg
value=2
rarity=C
type=Artifact,Creature
subtype=Myr
converted=2
cost={2}
pt=1/1
ability=infect
timing=main

View File

@ -0,0 +1,31 @@
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;
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));
}
};
}

View File

@ -5,6 +5,7 @@ import magic.model.MagicPermanent;
import magic.model.MagicPlayer; import magic.model.MagicPlayer;
import magic.model.choice.MagicCombatCreature; import magic.model.choice.MagicCombatCreature;
import magic.model.choice.MagicDeclareBlockersResult; import magic.model.choice.MagicDeclareBlockersResult;
import magic.model.trigger.MagicTriggerType;
public class MagicDeclareBlockersAction extends MagicAction { public class MagicDeclareBlockersAction extends MagicAction {
@ -29,10 +30,15 @@ public class MagicDeclareBlockersAction extends MagicAction {
game.doAction(new MagicDeclareBlockerAction(attacker,creatures[index].permanent)); game.doAction(new MagicDeclareBlockerAction(attacker,creatures[index].permanent));
count++; count++;
} }
if (attacker.isBlocked()) {
game.executeTrigger(MagicTriggerType.WhenBecomesBlocked,attacker);
}
} }
} }
player.setNrOfBlockers(count); player.setNrOfBlockers(count);
} }
@Override @Override

View File

@ -15,6 +15,7 @@ public enum MagicTriggerType {
WhenOtherPutIntoGraveyardFromPlay, // permanent WhenOtherPutIntoGraveyardFromPlay, // permanent
WhenAttacks, // permanent WhenAttacks, // permanent
WhenBlocks, // permanent WhenBlocks, // permanent
WhenBecomesBlocked, //permanent
WhenTargeted, // permanent WhenTargeted, // permanent
IfDamageWouldBeDealt, // item on stack IfDamageWouldBeDealt, // item on stack
IfPlayerWouldLose, // player[] IfPlayerWouldLose, // player[]

View File

@ -0,0 +1,15 @@
package magic.model.trigger;
import magic.model.MagicPermanent;
public abstract class MagicWhenBecomesBlockedTrigger extends MagicTrigger<MagicPermanent> {
public MagicWhenBecomesBlockedTrigger(final int priority) {
super(priority);
}
public MagicWhenBecomesBlockedTrigger() {}
public MagicTriggerType getType() {
return MagicTriggerType.WhenBecomesBlocked;
}
}