package mw.server.card.gold.ub;
import mw.mtgforge.Command;
import mw.server.ChoiceCommand;
import mw.server.GameManager;
import mw.server.list.CardList;
import mw.server.list.CardListFilter;
import mw.server.model.Card;
import mw.server.model.Spell;
import mw.server.model.SpellAbility;
import mw.server.model.MagicWarsModel.GameZone;
@SuppressWarnings("serial")
public class MistveinBorderpost {
public static Card getCard(final GameManager game, final Card card) {
final SpellAbility spell = new Spell(card) {
public void resolve() {
if (getTargetCard() != null) {
int id = getTargetCard().getTableID();
if (game.getBattlefield().isCardInPlay(id)) {
Card chosenCard = game.getBattlefield().getPermanent(id);
if (chosenCard.isBasicLand()) {
getSourceCard().getSpellAbilities().get(0).resolve();
game.moveToZone(GameZone.Battlefield, GameZone.Hand, chosenCard);
}
}
}
}
};
final ChoiceCommand runtime = new ChoiceCommand() {
public void execute() {
int pid = card.getControllerID();
CardList choice = game.getBattlefield().getPermanentList(pid);
choice = choice.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isBasicLand();
}
});
setResult(choice);
}
};
final Command comesIntoPlay = new Command() {
public void execute() {
card.tap();
}
};
card.setEntersTheBattlefieldCommand(comesIntoPlay);
spell.setNeedsToChooseSpecificPermanent(true);
spell.setChoiceCommand(runtime);
spell.setChoiceDetailedDescription("Select a basic land to return.");
spell.setChoiceDescription("Select a basic land to return.");
spell.setDescription("Pay {1} and return a basic land you control");
spell.setManaCost("1");
card.addSpellAbility(spell);
return card;
}
}
|