execute targeted trigger passing in item on stack

master
melvin 2011-08-10 11:19:50 +08:00
parent d521ecb329
commit e2dcaf6651
1 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import magic.model.MagicGame;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicTriggerType;
import magic.model.choice.MagicTargetChoice;
import magic.model.stack.MagicItemOnStack;
public class MagicExecuteFirstEventAction extends MagicAction {
@ -20,8 +21,9 @@ public class MagicExecuteFirstEventAction extends MagicAction {
game.executeEvent(firstEvent,choiceResults);
if (firstEvent.getChoice() instanceof MagicTargetChoice) {
final MagicTargetChoice tchoice = (MagicTargetChoice)firstEvent.getChoice();
if (tchoice.isTargeted()) {
game.executeTrigger(MagicTriggerType.WhenTargeted, firstEvent.getSource());
final MagicItemOnStack item = game.getStack().get(firstEvent);
if (tchoice.isTargeted() && item != null) {
game.executeTrigger(MagicTriggerType.WhenTargeted, item);
}
}
}