added trigger WhenBecomesTapped. added Gideon's Avenger

master
beholder 2011-08-27 15:56:42 +02:00
parent fad9b64fa8
commit e1b7b29734
4 changed files with 52 additions and 0 deletions

View File

@ -598,6 +598,19 @@ power=2
toughness=2
timing=main
>Gideon's Avenger
image=http://magiccards.info/scans/en/m12/17.jpg
value=3
rarity=R
type=Creature
subtype=Human,Soldier
color=w
converted=3
cost={1}{W}{W}
power=2
toughness=2
timing=fmain
>Skinrender
image=http://magiccards.info/scans/en/som/78.jpg
value=4

View File

@ -0,0 +1,36 @@
package magic.card;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicChangeCountersAction;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicTrigger;
import magic.model.trigger.MagicTriggerType;
public class Gideon_s_Avenger {
public static final MagicTrigger T = new MagicTrigger(MagicTriggerType.WhenBecomesTapped) {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final Object data) {
final MagicPlayer otherController = ((MagicPermanent)data).getController();
final MagicPlayer player = permanent.getController();
return (otherController != player && ((MagicPermanent)data).isCreature()) ?
new MagicEvent(
permanent,
player,
new Object[]{permanent},
this,
"Put a +1/+1 counter on " + permanent + ".") :
null;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.doAction(new MagicChangeCountersAction((MagicPermanent)data[0],MagicCounterType.PlusOne,1,true));
}
};
}

View File

@ -4,6 +4,7 @@ import magic.ai.ArtificialScoringSystem;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPermanentState;
import magic.model.trigger.MagicTriggerType;
// Must check if creature is untapped.
public class MagicTapAction extends MagicAction {
@ -25,6 +26,7 @@ public class MagicTapAction extends MagicAction {
if (hasScore) {
setScore(permanent.getController(),ArtificialScoringSystem.getTappedScore(permanent));
}
game.executeTrigger(MagicTriggerType.WhenBecomesTapped,permanent);
game.setStateCheckRequired();
}
}

View File

@ -6,6 +6,7 @@ public enum MagicTriggerType {
WhenDamageIsDealt, // damage
WhenSpellIsPlayed, // card on stack
WhenComesIntoPlay, // null
WhenBecomesTapped, // permanent
WhenDiscarded, // card
WhenDrawn, // card
WhenOtherComesIntoPlay, // permanent