- Convert Bazaar of Wonders to script

This commit is contained in:
Sol
2013-04-06 20:16:48 +00:00
parent a7eb64cec9
commit bcdc366d48
5 changed files with 14 additions and 40 deletions

View File

@@ -6693,6 +6693,13 @@ public class Card extends GameEntity implements Comparable<Card> {
}
}
return false;
} else if (restriction.equals(ZoneType.Graveyard.toString())) {
for (final Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard)) {
if (this.getName().equals(card.getName())) {
return true;
}
}
return false;
} else if (restriction.equals(ZoneType.Battlefield.toString())) {
for (final Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
if (this.getName().equals(card.getName())) {

View File

@@ -2119,7 +2119,7 @@ public class CardFactoryUtil {
final String[] splitString = string.split("/", 2);
String valid = splitString[0].substring(6);
final List<Card> list = CardLists.getValidCards(paidList, valid, source.getController(), source);
return CardFactoryUtil.doXMath(list.size(), splitString[1], source);
return CardFactoryUtil.doXMath(list.size(), splitString.length > 1 ? splitString[1] : null, source);
}
int tot = 0;

View File

@@ -516,43 +516,6 @@ public class MagicStack extends MyObservable {
}
}
/*
* Whenever a player casts a spell, counter it if a card with the same
* name is in a graveyard or a nontoken permanent with the same name is
* on the battlefield.
*/
if (sp.isSpell() && game.isCardInPlay("Bazaar of Wonders")) {
boolean found = false;
List<Card> all = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), Presets.NON_TOKEN);
final List<Card> graves = game.getCardsIn(ZoneType.Graveyard);
all.addAll(graves);
for (final Card c : all) {
if (sp.getSourceCard().getName().equals(c.getName())) {
found = true;
}
}
if (found) {
final List<Card> bazaars = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Bazaar of Wonders")); // should
// only
// be
// 1...
for (final Card bazaar : bazaars) {
final SpellAbility counter = new Ability(bazaar, ManaCost.ZERO) {
@Override
public void resolve() {
if (game.getStack().size() > 0) {
game.getStack().pop();
}
} // resolve()
}; // SpellAbility
counter.setStackDescription(bazaar.getName() + " - counter " + sp.getSourceCard().getName() + ".");
this.add(counter);
}
}
}
if (this.getSimultaneousStackEntryList().size() > 0) {
game.getPhaseHandler().passPriority();
}

View File

@@ -186,7 +186,7 @@ public enum VStack implements IVDoc<CStack> {
parentCell.getBody().add(tar, "w 98%!");
stackTARs.add(tar);
if (stack.peekInstance(i).isOptionalTrigger()) {
if (spell != null && spell.isOptionalTrigger()) {
tar.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {