- Converting Mox Diamond to Script

This commit is contained in:
Sol
2012-10-02 01:07:39 +00:00
parent 3bd66eb85e
commit 4313a37c63
2 changed files with 6 additions and 76 deletions

View File

@@ -154,81 +154,6 @@ class CardFactoryArtifacts {
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Mox Diamond")) {
final Input discard = new Input() {
private static final long serialVersionUID = -1319202902385425204L;
@Override
public void showMessage() {
CMatchUI.SINGLETON_INSTANCE.showMessage("Discard a land card (or select Mox Diamond to sacrifice it)");
ButtonUtil.enableOnlyCancel();
}
@Override
public void selectCard(final Card c, final PlayerZone zone) {
if (zone.is(ZoneType.Hand) && c.isLand()) {
AllZone.getHumanPlayer().discard(c, null);
this.stop();
} else if (c.equals(card)) {
Singletons.getModel().getGameAction().sacrifice(card, null);
this.stop();
}
}
}; // Input
final SpellAbility ability = new Ability(card, "0") {
@Override
public void resolve() {
if (card.getController().isHuman()) {
if (AllZone.getHumanPlayer().getZone(ZoneType.Hand).isEmpty()) {
Singletons.getModel().getGameAction().sacrifice(card, null);
} else {
AllZone.getInputControl().setInput(discard);
}
} else {
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
list = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
AllZone.getComputerPlayer().discard(list.get(0), this);
} // else
} // resolve()
}; // SpellAbility
final Command intoPlay = new Command() {
private static final long serialVersionUID = -7679939432259603542L;
@Override
public void execute() {
final StringBuilder sb = new StringBuilder();
sb.append("If Mox Diamond would enter the battlefield, you may ");
sb.append("discard a land card instead. If you do, put Mox Diamond onto the battlefield. ");
sb.append("If you don't, put it into its owner's graveyard.");
ability.setStackDescription(sb.toString());
AllZone.getStack().addSimultaneousStackEntry(ability);
}
};
final SpellAbility spell = new SpellPermanent(card) {
private static final long serialVersionUID = -1818766848857998431L;
// could never get the AI to work correctly
// it always played the same card 2 or 3 times
@Override
public boolean canPlayAI() {
return false;
}
@Override
public boolean canPlay() {
List<Card> list = card.getController().getCardsIn(ZoneType.Hand);
list.remove(card);
list = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
return (list.size() != 0) && super.canPlay();
} // canPlay()
};
card.addComesIntoPlayCommand(intoPlay);
card.clearSpellKeepManaAbility();
card.addSpellAbility(spell);
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Goblin Charbelcher")) {