From 052fa1c6712460619db87ed9da99b2d27828e00f Mon Sep 17 00:00:00 2001 From: beholder Date: Mon, 26 Sep 2011 15:20:51 +0200 Subject: [PATCH] added Frightful Delusion --- resources/magic/data/cards2.txt | 10 ++++++ src/magic/card/Frightful_Delusion.java | 44 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/magic/card/Frightful_Delusion.java diff --git a/resources/magic/data/cards2.txt b/resources/magic/data/cards2.txt index 63f1418965..feccadd576 100644 --- a/resources/magic/data/cards2.txt +++ b/resources/magic/data/cards2.txt @@ -4288,6 +4288,16 @@ cost={3}{U} pt=1/6 timing=main +>Frightful Delusion +image=http://magiccards.info/scans/en/isd/57.jpg +value=3 +rarity=C +type=Instant +color=u +converted=3 +cost={2}{U} +timing=counter + >Morkrut Banshee image=http://magiccards.info/scans/en/isd/110.jpg value=4 diff --git a/src/magic/card/Frightful_Delusion.java b/src/magic/card/Frightful_Delusion.java new file mode 100644 index 0000000000..6d843cd971 --- /dev/null +++ b/src/magic/card/Frightful_Delusion.java @@ -0,0 +1,44 @@ +package magic.card; + +import magic.model.MagicGame; +import magic.model.MagicManaCost; +import magic.model.MagicPayedCost; +import magic.model.action.MagicCardOnStackAction; +import magic.model.action.MagicMoveCardAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicCounterUnlessEvent; +import magic.model.event.MagicDiscardEvent; +import magic.model.event.MagicEvent; +import magic.model.event.MagicSpellCardEvent; +import magic.model.stack.MagicCardOnStack; + +public class Frightful_Delusion { + public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack.getCard(), + cardOnStack.getController(), + MagicTargetChoice.NEG_TARGET_SPELL, + new Object[]{cardOnStack}, + this, + "Counter target spell$ unless its controller pays {1}. " + + "That player discards a card."); + } + @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.processTargetCardOnStack(game,choiceResults,0,new MagicCardOnStackAction() { + public void doAction(final MagicCardOnStack targetSpell) { + game.addEvent(new MagicCounterUnlessEvent(cardOnStack.getCard(),targetSpell,MagicManaCost.ONE)); + game.addEvent(new MagicDiscardEvent(cardOnStack.getCard(),targetSpell.getController(),1,false)); + } + }); + } + }; +}