replace card code for Demolish with effect property in card script

master
melvin 2012-08-26 21:35:55 +08:00
parent 94ed2bbed9
commit 1ff2b630dd
3 changed files with 2 additions and 44 deletions

View File

@ -7,4 +7,4 @@ rarity=U
type=Sorcery type=Sorcery
cost={3}{R} cost={3}{R}
timing=removal timing=removal
requires_card_code effect=Destroy target artifact or land

View File

@ -1,43 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicDestroyAction;
import magic.model.action.MagicMoveCardAction;
import magic.model.action.MagicPermanentAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicDestroyTargetPicker;
public class Demolish {
public static final MagicSpellCardEvent E = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack.getCard(),
cardOnStack.getController(),
MagicTargetChoice.NEG_TARGET_ARTIFACT_OR_LAND,
new MagicDestroyTargetPicker(false),
new Object[]{cardOnStack},
this,
"Destroy target artifact or land$.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object[] data,
final Object[] choiceResults) {
final MagicCardOnStack cardOnStack=(MagicCardOnStack)data[0];
game.doAction(new MagicMoveCardAction(cardOnStack));
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
game.doAction(new MagicDestroyAction(permanent));
}
});
}
};
}

View File

@ -494,6 +494,7 @@ public class MagicTargetChoice extends MagicChoice {
factory.put("neg target artifact or enchantment", NEG_TARGET_ARTIFACT_OR_ENCHANTMENT); factory.put("neg target artifact or enchantment", NEG_TARGET_ARTIFACT_OR_ENCHANTMENT);
factory.put("neg target attacking creature", NEG_TARGET_ATTACKING_CREATURE); factory.put("neg target attacking creature", NEG_TARGET_ATTACKING_CREATURE);
factory.put("neg target Human creature", NEG_TARGET_HUMAN_CREATURE); factory.put("neg target Human creature", NEG_TARGET_HUMAN_CREATURE);
factory.put("neg target artifact or land", NEG_TARGET_ARTIFACT_OR_LAND);
} }
public static MagicTargetChoice build(String arg) { public static MagicTargetChoice build(String arg) {