From c7dd241983f0a2baaecad2dbc49dff09455f8978 Mon Sep 17 00:00:00 2001 From: beholder Date: Sat, 3 Sep 2011 09:05:41 +0200 Subject: [PATCH] added Angelic Destiny --- resources/magic/data/cards.txt | 14 +++++ src/magic/card/Angelic_Destiny.java | 85 +++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/magic/card/Angelic_Destiny.java diff --git a/resources/magic/data/cards.txt b/resources/magic/data/cards.txt index e503efbb9c..cf153ce3a3 100644 --- a/resources/magic/data/cards.txt +++ b/resources/magic/data/cards.txt @@ -7589,6 +7589,20 @@ converted=1 cost={G} timing=pump +>Angelic Destiny +image=http://magiccards.info/scans/en/m12/3.jpg +value=5 +rarity=M +type=Enchantment +subtype=Aura +color=w +converted=4 +cost={2}{W}{W} +power=4 +toughness=4 +ability=flying,first strike +timing=aura + >Lone Missionary image=http://magiccards.info/scans/en/roe/34.jpg value=2 diff --git a/src/magic/card/Angelic_Destiny.java b/src/magic/card/Angelic_Destiny.java new file mode 100644 index 0000000000..705859e37e --- /dev/null +++ b/src/magic/card/Angelic_Destiny.java @@ -0,0 +1,85 @@ +package magic.card; + +import java.util.EnumSet; + +import magic.model.MagicCard; +import magic.model.MagicGame; +import magic.model.MagicLocationType; +import magic.model.MagicPermanent; +import magic.model.MagicPlayer; +import magic.model.MagicSubType; +import magic.model.action.MagicMoveCardAction; +import magic.model.action.MagicPermanentAction; +import magic.model.action.MagicPlayCardFromStackAction; +import magic.model.action.MagicRemoveCardAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicEvent; +import magic.model.event.MagicPlayAuraEvent; +import magic.model.event.MagicSpellCardEvent; +import magic.model.stack.MagicCardOnStack; +import magic.model.target.MagicPumpTargetPicker; +import magic.model.trigger.MagicWhenOtherPutIntoGraveyardFromPlayTrigger; +import magic.model.variable.MagicDummyLocalVariable; + +public class Angelic_Destiny { + public static final MagicSpellCardEvent S = new MagicPlayAuraEvent( + MagicTargetChoice.POS_TARGET_CREATURE, + MagicPumpTargetPicker.getInstance()){ + + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object[] data, + final Object[] choiceResults) { + final MagicCardOnStack cardOnStack=(MagicCardOnStack)data[0]; + final boolean success = event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent creature) { + game.doAction(new MagicPlayCardFromStackAction(cardOnStack,creature)); + creature.addLocalVariable( + new MagicDummyLocalVariable() { + @Override + public EnumSet getSubTypeFlags( + final MagicPermanent permanent, + final EnumSet flags) { + final EnumSet mod = flags.clone(); + mod.add(MagicSubType.Angel); + return mod; + } + } + ); + } + }); + if (!success) { + game.doAction(new MagicMoveCardAction(cardOnStack)); + } + } + }; + + public static final MagicWhenOtherPutIntoGraveyardFromPlayTrigger T = new MagicWhenOtherPutIntoGraveyardFromPlayTrigger() { + @Override + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent data) { + if (permanent.getEnchantedCreature() == data) { + return new MagicEvent( + permanent, + permanent.getController(), + new Object[]{permanent.getCard()}, + this, + "Return " + permanent + " to its owner's hand."); + } + return null; + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object data[], + final Object[] choiceResults) { + final MagicCard card = (MagicCard)data[0]; + if (card.getOwner().getGraveyard().contains(card)) { + game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard)); + game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersHand)); + } + } + }; +}