- 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

@@ -1,8 +1,13 @@
Name:Mox Diamond Name:Mox Diamond
ManaCost:0 ManaCost:0
Types:Artifact Types:Artifact
Text:If CARDNAME would enter the battlefield, you may discard a land card instead. If you do, put CARDNAME onto the battlefield. If you don't, put it into its owner's graveyard. Text:no text
A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color to your mana pool. A:AB$ Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color to your mana pool.
R:Event$ Moved | Destination$ Battlefield | ValidCard$ Card.Self | ReplaceWith$ PayBeforeETB | Description$ If CARDNAME would enter the battlefield, you may discard a land card instead. If you do, put CARDNAME onto the battlefield. If you don't, put it into its owner's graveyard.
SVar:PayBeforeETB:AB$ Discard | Cost$ 0 | DiscardValid$ Card.Land | Mode$ TgtChoose | RememberDiscarded$ True | Optional$ True | SubAbility$ MoveToGraveyard
SVar:MoveToGraveyard:DB$ ChangeZone | Origin$ All | Destination$ Graveyard | Defined$ ReplacedCard | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | SubAbility$ MoveToBattlefield
SVar:MoveToBattlefield:DB$ ChangeZone | Origin$ All | Destination$ Battlefield | Defined$ ReplacedCard | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ1
SVar:X:Remembered$Amount
SVar:RemAIDeck:True SVar:RemAIDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/mox_diamond.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mox_diamond.jpg

View File

@@ -154,81 +154,6 @@ class CardFactoryArtifacts {
} // *************** END ************ END ************************** } // *************** 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 ************************** // *************** START *********** START **************************
else if (cardName.equals("Goblin Charbelcher")) { else if (cardName.equals("Goblin Charbelcher")) {