auto move to graveyard only occurs if action is instance of MagicSpellCardEvent

master
melvin 2012-09-24 21:17:49 +08:00
parent 6ed86e94bd
commit be5252da9d
2 changed files with 14 additions and 12 deletions

View File

@ -32,8 +32,9 @@ public class MagicEvent implements MagicCopyable {
public static final MagicSource NO_SOURCE = MagicCard.NONE;
public static final Object NO_CHOICE_RESULTS[] = new Object[0];
public static final Object NO_DATA[] = new Object[0];
public static final MagicEvent NO_EVENTS[] = new MagicEvent[0];
private static final Object NO_DATA[] = new Object[0];
private static final MagicChoice NO_CHOICES = MagicChoice.NONE;
private static final MagicEventAction NO_ACTION = new MagicEventAction() {
public void executeEvent(
@ -389,7 +390,9 @@ public class MagicEvent implements MagicCopyable {
public final void executeEvent(final MagicGame game,final Object choiceResults[]) {
action.executeEvent(game,this,data,choiceResults);
//move card to move location that is not play
if (source instanceof MagicCardOnStack && getCardOnStack().getMoveLocation() != MagicLocationType.Play) {
if (source instanceof MagicCardOnStack &&
action instanceof MagicSpellCardEvent &&
getCardOnStack().getMoveLocation() != MagicLocationType.Play) {
game.doAction(new MagicMoveCardAction(getCardOnStack()));
}
}

View File

@ -23,15 +23,6 @@ public abstract class MagicSpellCardEvent implements MagicCardEvent,MagicEventAc
return cdef;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
throw new RuntimeException(getClass() + " did not override executeEvent");
}
@Override
public void change(MagicCardDefinition cdef) {
cdef.setEvent(this);
@ -52,10 +43,18 @@ public abstract class MagicSpellCardEvent implements MagicCardEvent,MagicEventAc
cardOnStack,
choice,
(picker != null ? picker : MagicDefaultTargetPicker.create()),
action,
this,
effect + "$."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
action.executeEvent(game, event, data, choiceResults);
}
};
}
}