- Found and fixed a bug in the GameActionUtil.playCard_Enchantress_Draw() code. Added a JOptionPane.showConfirmDialog() to Verduran Enchantress and Mesa Enchantress, you are now asked if you want to draw a card for these two only. Argothian Enchantress and Enchantress's Presence forces you to draw a card. Added some AI to the computer's choice.

This commit is contained in:
jendave
2011-08-06 05:57:28 +00:00
parent 8bb03c70a6
commit e7764d486d
2 changed files with 57 additions and 44 deletions

View File

@@ -1,12 +0,0 @@
#Forge
#Mon Aug 23 19:15:41 CEST 2010
gui.laf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
AI.stack.land=false
gui.new=true
stack.offset=tiny
card.images.size=medium
card.overlay=true
card.scale.larger.than.original=true
stack.max.size=3
gui.laf.fonts=false
loss.condition.milling=true

View File

@@ -2560,42 +2560,67 @@ public class GameActionUtil {
} }
public static void playCard_Enchantress_Draw(Card c) { public static void playCard_Enchantress_Draw(Card c) {
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
CardList list = new CardList();
list.addAll(play.getCards());
CardList list = new CardList(); list = list.filter(new CardListFilter() {
list.addAll(play.getCards()); public boolean addCard(Card crd) {
if (crd.getName().equals("Verduran Enchantress") || crd.getName().equals("Enchantress's Presence")
|| crd.getName().equals("Mesa Enchantress") || crd.getName().equals("Argothian Enchantress")) return true;
else return false;
}
});
list = list.filter(new CardListFilter() { if (c.isEnchantment()) {
public boolean addCard(Card crd) { for (int i = 0; i < list.size(); i++) {
if(crd.getName().equals("Verduran Enchantress") || crd.getName().equals("Enchantress's Presence") final Card card = list.get(i); //was "list.get(0);"
|| crd.getName().equals("Mesa Enchantress")
|| crd.getName().equals("Argothian Enchantress")) return true;
else return false;
}
});
//list = list.getName("Verduran Enchantress");
if(c.isEnchantment()) { Ability ability2 = new Ability(card, "0") {
for(int i = 0; i < list.size(); i++) { @Override
final Card card = list.get(0); public void resolve() {
Boolean mayDrawNotMust = (card.getName().equals("Verduran Enchantress") || card.getName().equals("Mesa Enchantress"));
int choice = 0;
Ability ability2 = new Ability(card, "0") { if (card.getController().equals("Human")) {
@Override if (mayDrawNotMust) {
public void resolve() { StringBuffer title = new StringBuffer();
// draws a card title.append(card.getName()).append(" Ability");
AllZone.GameAction.drawCard(card.getController()); StringBuffer message = new StringBuffer();
} message.append("Will you draw a card?");
}; // ability2 choice = JOptionPane.showConfirmDialog(null, message.toString(), title.toString(), JOptionPane.YES_NO_OPTION);
}// May Draw a card
ability2.setStackDescription(card.getName() + " - " + c.getController() if ((mayDrawNotMust && choice == JOptionPane.YES_OPTION) || !mayDrawNotMust) {
+ " plays an enchantment spell and draws a card"); AllZone.GameAction.drawCard(card.getController());
AllZone.Stack.add(ability2); }
}// Human
} // for if (card.getController().equals("Computer")) {
}// if isEnchantment() int compLibSize = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer).size();
} int compHandSize = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer).size();
if ((!mayDrawNotMust) || (mayDrawNotMust && compLibSize >= 5 && compHandSize <= 7)) {
AllZone.GameAction.drawCard(card.getController());
}
}// Computer
}// resolve()
};// ability2
StringBuffer sb = new StringBuffer();
sb.append(card.getName()).append(" - ").append(c.getController()).append(" plays an enchantment spell and ");
if (card.getName().equals("Verduran Enchantress") || card.getName().equals("Mesa Enchantress")) {
sb.append("may draw a card.");
} else {
sb.append("draws a card.");
}
ability2.setStackDescription(sb.toString());
AllZone.Stack.add(ability2);
}// for
}// if isEnchantment()
}// playCard_Enchantress_Draw()
public static void playCard_Gilt_Leaf_Archdruid(Card c) { public static void playCard_Gilt_Leaf_Archdruid(Card c) {