From a207ac624e4e526a3879812c7a25fde63fc489b9 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 21 Oct 2011 09:56:11 +0200 Subject: [PATCH] added Soltari Visionary and Stronghold Overseer --- resources/magic/data/cards.txt | 28 ++++++++++ src/magic/card/Soltari_Visionary.java | 49 +++++++++++++++++ src/magic/card/Stronghold_Overseer.java | 55 +++++++++++++++++++ src/magic/model/choice/MagicTargetChoice.java | 5 ++ src/magic/model/target/MagicTargetFilter.java | 31 +++++++++++ 5 files changed, 168 insertions(+) create mode 100644 src/magic/card/Soltari_Visionary.java create mode 100644 src/magic/card/Stronghold_Overseer.java diff --git a/resources/magic/data/cards.txt b/resources/magic/data/cards.txt index 7be94b7c65..ad0cd66a66 100644 --- a/resources/magic/data/cards.txt +++ b/resources/magic/data/cards.txt @@ -16112,3 +16112,31 @@ cost={1}{W} pt=1/1 ability=shadow timing=main + +>Soltari Visionary +url=http://magiccards.info/ex/en/20.html +image=http://magiccards.info/scans/en/ex/20.jpg +value=3 +rarity=C +type=Creature +subtype=Soltari,Cleric +color=w +converted=3 +cost={1}{W}{W} +pt=2/2 +ability=shadow +timing=main + +>Stronghold Overseer +url=http://magiccards.info/ts/en/133.html +image=http://magiccards.info/scans/en/ts/133.jpg +value=5 +rarity=R +type=Creature +subtype=Demon +color=b +converted=6 +cost={3}{B}{B}{B} +pt=5/5 +ability=shadow,flying +timing=fmain diff --git a/src/magic/card/Soltari_Visionary.java b/src/magic/card/Soltari_Visionary.java new file mode 100644 index 0000000000..9e724be2f1 --- /dev/null +++ b/src/magic/card/Soltari_Visionary.java @@ -0,0 +1,49 @@ +package magic.card; + +import magic.model.MagicDamage; +import magic.model.MagicGame; +import magic.model.MagicPermanent; +import magic.model.MagicPlayer; +import magic.model.MagicType; +import magic.model.action.MagicDestroyAction; +import magic.model.action.MagicPermanentAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicEvent; +import magic.model.target.MagicDestroyTargetPicker; +import magic.model.trigger.MagicWhenDamageIsDealtTrigger; + +public class Soltari_Visionary { + public static final MagicWhenDamageIsDealtTrigger T = new MagicWhenDamageIsDealtTrigger() { + @Override + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) { + final MagicPlayer player = permanent.getController(); + final MagicPlayer target = (MagicPlayer)damage.getTarget(); + return (damage.getSource() == permanent && + damage.getTarget().isPlayer() && + target.controlsPermanentWithType(MagicType.Enchantment,game)) ? + new MagicEvent( + permanent, + player, + damage.getTarget() == player ? + MagicTargetChoice.TARGET_ENCHANTMENT_YOU_CONTROL : + MagicTargetChoice.TARGET_ENCHANTMENT_YOUR_OPPONENT_CONTROLS, + new MagicDestroyTargetPicker(false), + MagicEvent.NO_DATA, + this, + "Destroy target enchantment$."): + MagicEvent.NONE; + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object data[], + final Object[] choiceResults) { + event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent perm) { + game.doAction(new MagicDestroyAction(perm)); + } + }); + } + }; +} diff --git a/src/magic/card/Stronghold_Overseer.java b/src/magic/card/Stronghold_Overseer.java new file mode 100644 index 0000000000..65825e8c5a --- /dev/null +++ b/src/magic/card/Stronghold_Overseer.java @@ -0,0 +1,55 @@ +package magic.card; + +import java.util.Collection; + +import magic.model.MagicGame; +import magic.model.MagicManaCost; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.MagicSource; +import magic.model.action.MagicChangeTurnPTAction; +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.MagicTarget; +import magic.model.target.MagicTargetFilter; + +public class Stronghold_Overseer { + public static final MagicPermanentActivation A = new MagicPermanentActivation( + new MagicCondition[]{MagicManaCost.BLACK_BLACK.getCondition()}, + new MagicActivationHints(MagicTiming.Pump,false,1), + "Pump") { + + @Override + public MagicEvent[] getCostEvent(final MagicSource source) { + return new MagicEvent[]{new MagicPayManaCostEvent(source,source.getController(),MagicManaCost.BLACK_BLACK)}; + } + + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { + return new MagicEvent( + source, + source.getController(), + MagicEvent.NO_DATA, + this, + "Creatures with shadow get +1/+0 until end of turn and " + + "creatures without shadow get -1/-0 until end of turn."); + } + + @Override + public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) { + Collection targets = + game.filterTargets(game.getPlayer(0),MagicTargetFilter.TARGET_CREATURE_WITH_SHADOW); + for (final MagicTarget target : targets) { + game.doAction(new MagicChangeTurnPTAction((MagicPermanent)target,1,0)); + } + targets = game.filterTargets(game.getPlayer(0),MagicTargetFilter.TARGET_CREATURE_WITHOUT_SHADOW); + for (final MagicTarget target : targets) { + game.doAction(new MagicChangeTurnPTAction((MagicPermanent)target,-1,0)); + } + } + }; +} diff --git a/src/magic/model/choice/MagicTargetChoice.java b/src/magic/model/choice/MagicTargetChoice.java index 8a1fdfc8b2..d9063d63c7 100644 --- a/src/magic/model/choice/MagicTargetChoice.java +++ b/src/magic/model/choice/MagicTargetChoice.java @@ -123,6 +123,11 @@ public class MagicTargetChoice extends MagicChoice { "target artifact creature"); public static final MagicTargetChoice TARGET_ENCHANTMENT = new MagicTargetChoice(MagicTargetFilter.TARGET_ENCHANTMENT,true,MagicTargetHint.None,"target enchantment"); + public static final MagicTargetChoice TARGET_ENCHANTMENT_YOU_CONTROL = + new MagicTargetChoice(MagicTargetFilter.TARGET_ENCHANTMENT_YOU_CONTROL,true,MagicTargetHint.None,"target enchantment you control"); + public static final MagicTargetChoice TARGET_ENCHANTMENT_YOUR_OPPONENT_CONTROLS = + new MagicTargetChoice(MagicTargetFilter.TARGET_ENCHANTMENT_YOUR_OPPONENT_CONTROLS,true,MagicTargetHint.None, + "target enchantment your opponent controls"); public static final MagicTargetChoice NEG_TARGET_ENCHANTMENT = new MagicTargetChoice(MagicTargetFilter.TARGET_ENCHANTMENT,true,MagicTargetHint.Negative,"target enchantment"); public static final MagicTargetChoice NEG_TARGET_SPIRIT_OR_ENCHANTMENT = diff --git a/src/magic/model/target/MagicTargetFilter.java b/src/magic/model/target/MagicTargetFilter.java index 552c69e6bc..59d4209c1f 100644 --- a/src/magic/model/target/MagicTargetFilter.java +++ b/src/magic/model/target/MagicTargetFilter.java @@ -421,6 +421,26 @@ public interface MagicTargetFilter { } }; + MagicTargetFilter TARGET_ENCHANTMENT_YOU_CONTROL = new MagicTargetFilter() { + public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) { + return target.getController() == player && + ((MagicPermanent)target).isEnchantment(); + } + public boolean acceptType(final MagicTargetType targetType) { + return targetType == MagicTargetType.Permanent; + } + }; + + MagicTargetFilter TARGET_ENCHANTMENT_YOUR_OPPONENT_CONTROLS = new MagicTargetFilter() { + public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) { + return target.getController() != player && + ((MagicPermanent)target).isEnchantment(); + } + public boolean acceptType(final MagicTargetType targetType) { + return targetType == MagicTargetType.Permanent; + } + }; + MagicTargetFilter TARGET_SPIRIT_OR_ENCHANTMENT = new MagicTargetFilter() { public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) { final MagicPermanent targetPermanent = (MagicPermanent)target; @@ -1230,6 +1250,17 @@ public interface MagicTargetFilter { } }; + MagicTargetFilter TARGET_CREATURE_WITHOUT_SHADOW = new MagicTargetFilter() { + public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) { + final MagicPermanent permanent = (MagicPermanent)target; + return permanent.isCreature(game) && + !permanent.hasAbility(game,MagicAbility.Shadow); + } + public boolean acceptType(final MagicTargetType targetType) { + return targetType == MagicTargetType.Permanent; + } + }; + MagicTargetFilter TARGET_CREATURE_CONVERTED_3_OR_LESS=new MagicTargetFilter() { public boolean accept(final MagicGame game,final MagicPlayer player,final MagicTarget target) {