added isRepresentedByACard method to MagicCardOnStack, use this instead of getting card from card on stack in MagicCipherAction

master
melvin 2013-10-09 14:20:07 +08:00
parent 46dbb37738
commit 9d67e3f149
2 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,7 @@ public class MagicCipherAction extends MagicAction {
@Override
public void doAction(final MagicGame game) {
if (cardOnStack.getCard().isToken() == false) {
if (cardOnStack.isRepresentedByACard()) {
// prevent auto move to graveyard
game.doAction(new MagicChangeCardDestinationAction(cardOnStack, MagicLocationType.Play));
game.addEvent(new MagicCipherEvent(cardOnStack, controller));

View File

@ -101,6 +101,10 @@ public class MagicCardOnStack extends MagicItemOnStack implements MagicSource {
return true;
}
public boolean isRepresentedByACard() {
return getCard().isToken() == false;
}
@Override
public boolean canBeCountered() {
return !getCardDefinition().hasAbility(MagicAbility.CannotBeCountered);