mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Converted Drekavac to script.
This commit is contained in:
@@ -305,98 +305,6 @@ public class CardFactoryCreatures {
|
||||
card.addComesIntoPlayCommand(intoPlay);
|
||||
} // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Drekavac")) {
|
||||
final Input discard = new Input() {
|
||||
private static final long serialVersionUID = -6392468000100283596L;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
AllZone.getDisplay().showMessage("Select a noncreature card to discard");
|
||||
ButtonUtil.enableOnlyCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectCard(final Card c, final PlayerZone zone) {
|
||||
if (zone.is(Constant.Zone.Hand) && !c.isCreature()) {
|
||||
c.getController().discard(c, null);
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectButtonCancel() {
|
||||
AllZone.getGameAction().sacrifice(card);
|
||||
this.stop();
|
||||
}
|
||||
}; // Input
|
||||
|
||||
final SpellAbility ability = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
if (card.getController().isHuman()) {
|
||||
if (AllZone.getHumanPlayer().getCardsIn(Zone.Hand).size() == 0) {
|
||||
AllZone.getGameAction().sacrifice(card);
|
||||
} else {
|
||||
AllZone.getInputControl().setInput(discard);
|
||||
}
|
||||
} else {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||
list = list.filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return (!c.isCreature());
|
||||
}
|
||||
});
|
||||
list.get(0).getController().discard(list.get(0), this);
|
||||
} // else
|
||||
} // resolve()
|
||||
}; // SpellAbility
|
||||
|
||||
final Command intoPlay = new Command() {
|
||||
private static final long serialVersionUID = 9202753910259054021L;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(card.getController());
|
||||
sb.append(" sacrifices Drekavac unless he discards a noncreature card");
|
||||
ability.setStackDescription(sb.toString());
|
||||
|
||||
AllZone.getStack().addSimultaneousStackEntry(ability);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
final SpellAbility spell = new SpellPermanent(card) {
|
||||
private static final long serialVersionUID = -2940969025405788931L;
|
||||
|
||||
// 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() {
|
||||
CardList list = card.getController().getCardsIn(Zone.Hand);
|
||||
list.remove(card);
|
||||
list = list.filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return (!c.isCreature());
|
||||
}
|
||||
});
|
||||
return list.size() != 0;
|
||||
} // canPlay()
|
||||
};
|
||||
card.addComesIntoPlayCommand(intoPlay);
|
||||
// Do not remove SpellAbilities created by AbilityFactory or
|
||||
// Keywords.
|
||||
card.clearFirstSpell();
|
||||
card.addSpellAbility(spell);
|
||||
} // *************** END ************ END **************************
|
||||
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Minotaur Explorer") || cardName.equals("Balduvian Horde")
|
||||
|
||||
Reference in New Issue
Block a user