From ecab1e8cd101ae10c950fe20913f05a620823d38 Mon Sep 17 00:00:00 2001 From: melvin Date: Tue, 28 Aug 2012 21:06:48 +0800 Subject: [PATCH] use THRESHOLD_CONDITION.accept instead of explicit testing graveyard size --- src/magic/card/Fledgling_Dragon.java | 2 +- src/magic/card/Krosan_Beast.java | 3 ++- src/magic/card/Stitch_Together.java | 17 ++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/magic/card/Fledgling_Dragon.java b/src/magic/card/Fledgling_Dragon.java index a8b4d345ea..11e1eb5a01 100644 --- a/src/magic/card/Fledgling_Dragon.java +++ b/src/magic/card/Fledgling_Dragon.java @@ -23,7 +23,7 @@ public class Fledgling_Dragon { final MagicPermanent source, final MagicPermanent permanent, final MagicPowerToughness pt) { - if (permanent.getController().getGraveyard().size() >= 7) { + if (MagicCondition.THRESHOLD_CONDITION.accept(permanent)) { pt.add(3,3); } } diff --git a/src/magic/card/Krosan_Beast.java b/src/magic/card/Krosan_Beast.java index 441fe98fd6..ca3856b6b0 100644 --- a/src/magic/card/Krosan_Beast.java +++ b/src/magic/card/Krosan_Beast.java @@ -4,6 +4,7 @@ import magic.model.MagicGame; import magic.model.mstatic.MagicLayer; import magic.model.MagicPermanent; import magic.model.MagicPowerToughness; +import magic.model.condition.MagicCondition; import magic.model.mstatic.MagicStatic; public class Krosan_Beast { @@ -13,7 +14,7 @@ public class Krosan_Beast { final MagicPermanent source, final MagicPermanent permanent, final MagicPowerToughness pt) { - if (permanent.getController().getGraveyard().size() >= 7) { + if (MagicCondition.THRESHOLD_CONDITION.accept(permanent)) { pt.add(7,7); } } diff --git a/src/magic/card/Stitch_Together.java b/src/magic/card/Stitch_Together.java index d7f474ce7f..0af98e231d 100644 --- a/src/magic/card/Stitch_Together.java +++ b/src/magic/card/Stitch_Together.java @@ -15,21 +15,21 @@ import magic.model.event.MagicEvent; import magic.model.event.MagicSpellCardEvent; import magic.model.stack.MagicCardOnStack; import magic.model.target.MagicGraveyardTargetPicker; +import magic.model.condition.MagicCondition; public class Stitch_Together { public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { @Override public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { - final MagicPlayer player = cardOnStack.getController(); // estimated number of cards in the graveyard. this may change // before resolution but we need to make a choice here - final boolean threshold = player.getGraveyard().size() >= 7; + final MagicCard card = cardOnStack.getCard(); return new MagicEvent( - cardOnStack.getCard(), - player, + card, + cardOnStack.getController(), MagicTargetChoice.TARGET_CREATURE_CARD_FROM_GRAVEYARD, - new MagicGraveyardTargetPicker(threshold ?true:false), - new Object[]{cardOnStack,player}, + new MagicGraveyardTargetPicker(MagicCondition.THRESHOLD_CONDITION.accept(card)), + new Object[]{cardOnStack}, this, "Return target creature card$ from your graveyard to your hand. " + "Return that card from your graveyard to the battlefield instead " + @@ -41,12 +41,11 @@ public class Stitch_Together { final MagicEvent event, final Object[] data, final Object[] choiceResults) { - final MagicPlayer player = (MagicPlayer)data[1]; - final boolean threshold = player.getGraveyard().size() >= 7; + final MagicPlayer player = event.getPlayer(); game.doAction(new MagicMoveCardAction((MagicCardOnStack)data[0])); event.processTargetCard(game,choiceResults,0,new MagicCardAction() { public void doAction(final MagicCard targetCard) { - if (threshold) { + if (MagicCondition.THRESHOLD_CONDITION.accept(event.getSource())) { game.doAction(new MagicReanimateAction(player,targetCard,MagicPlayCardAction.NONE)); } else { game.doAction(new MagicRemoveCardAction(targetCard,MagicLocationType.Graveyard));