From f422db3c1646b171cc48407fb68a9b5e167734b7 Mon Sep 17 00:00:00 2001 From: beholder Date: Thu, 1 Sep 2011 08:40:36 +0200 Subject: [PATCH] added Ancient Hellkite --- resources/magic/data/cards.txt | 14 +++++ src/magic/card/Ancient_Hellkite.java | 54 +++++++++++++++++++ src/magic/model/condition/MagicCondition.java | 7 +++ 3 files changed, 75 insertions(+) create mode 100644 src/magic/card/Ancient_Hellkite.java diff --git a/resources/magic/data/cards.txt b/resources/magic/data/cards.txt index 2470700519..8767456a49 100644 --- a/resources/magic/data/cards.txt +++ b/resources/magic/data/cards.txt @@ -52,6 +52,20 @@ power=2 toughness=4 timing=main +>Ancient Hellkite +image=http://magiccards.info/scans/en/m11/122.jpg +value=5 +rarity=R +type=Creature +subtype=Dragon +color=r +converted=7 +cost={4}{R}{R}{R} +power=6 +toughness=6 +ability=flying +timing=main + >Armored Warhorse image=http://magiccards.info/scans/en/m12/7.jpg value=2 diff --git a/src/magic/card/Ancient_Hellkite.java b/src/magic/card/Ancient_Hellkite.java new file mode 100644 index 0000000000..fb096ee888 --- /dev/null +++ b/src/magic/card/Ancient_Hellkite.java @@ -0,0 +1,54 @@ +package magic.card; + +import magic.model.MagicDamage; +import magic.model.MagicGame; +import magic.model.MagicManaCost; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.MagicSource; +import magic.model.action.MagicDealDamageAction; +import magic.model.action.MagicTargetAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.condition.MagicCondition; +import magic.model.event.MagicActivationHints; +import magic.model.event.MagicEvent; +import magic.model.event.MagicPayManaCostEvent; +import magic.model.event.MagicPermanentActivation; +import magic.model.event.MagicTiming; +import magic.model.target.MagicDamageTargetPicker; +import magic.model.target.MagicTarget; + +public class Ancient_Hellkite { + public static final MagicPermanentActivation A = new MagicPermanentActivation( + new MagicCondition[]{MagicCondition.IS_ATTACKING_CONDITION,MagicManaCost.RED.getCondition()}, + new MagicActivationHints(MagicTiming.Removal), + "Damage") { + + @Override + public MagicEvent[] getCostEvent(final MagicSource source) { + return new MagicEvent[]{new MagicPayManaCostEvent(source,source.getController(),MagicManaCost.RED)}; + } + + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { + return new MagicEvent( + source, + source.getController(), + MagicTargetChoice.TARGET_CREATURE_YOUR_OPPONENT_CONTROLS, + new MagicDamageTargetPicker(1), + new Object[]{source}, + this, + source + " deals 1 damage to target creature$ your opponent controls."); + } + + @Override + public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) { + event.processTarget(game,choiceResults,0,new MagicTargetAction() { + public void doAction(final MagicTarget target) { + final MagicDamage damage = new MagicDamage((MagicSource)data[0],target,1,false); + game.doAction(new MagicDealDamageAction(damage)); + } + }); + } + }; +} diff --git a/src/magic/model/condition/MagicCondition.java b/src/magic/model/condition/MagicCondition.java index f0540110ed..b0bf487716 100644 --- a/src/magic/model/condition/MagicCondition.java +++ b/src/magic/model/condition/MagicCondition.java @@ -79,6 +79,13 @@ public interface MagicCondition { } }; + public static final MagicCondition IS_ATTACKING_CONDITION = new MagicCondition() { + public boolean accept(final MagicGame game,final MagicSource source) { + final MagicPermanent permanent = (MagicPermanent)source; + return permanent.isAttacking(); + } + }; + public static final MagicCondition ABILITY_ONCE_CONDITION=new MagicCondition() { public boolean accept(final MagicGame game,final MagicSource source) { final MagicPermanent permanent=(MagicPermanent)source;