use THRESHOLD_CONDITION.accept instead of explicit testing graveyard size

master
melvin 2012-08-28 21:06:48 +08:00
parent 160ffc014f
commit ecab1e8cd1
3 changed files with 11 additions and 11 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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));