- Added a GameActionUtil.showYesNoDialog() to Oath of Druids.

- Oath of Druids will now display the revealed cards from top of library down to the first creature revealed.
This commit is contained in:
jendave
2011-08-06 14:02:38 +00:00
parent beb8d37a12
commit eb0c22ac57

View File

@@ -9185,72 +9185,77 @@ public class GameActionUtil {
}// if }// if
}// upkeep_Defense of the Heart }// upkeep_Defense of the Heart
private static void upkeep_Oath_of_Druids() { private static void upkeep_Oath_of_Druids() {
CardList oathList = AllZoneUtil.getCardsInPlay("Oath of Druids"); CardList oathList = AllZoneUtil.getCardsInPlay("Oath of Druids");
if (oathList.isEmpty()) if (oathList.isEmpty())
return; return;
final Player player = AllZone.Phase.getPlayerTurn(); final Player player = AllZone.Phase.getPlayerTurn();
if (AllZoneUtil.compareTypeAmountInPlay(player, "Creature") < 0){ if (AllZoneUtil.compareTypeAmountInPlay(player, "Creature") < 0) {
for(int i = 0; i < oathList.size(); i++) { for (int i = 0; i < oathList.size(); i++) {
Ability ability = new Ability(oathList.get(i), "0") { final Card oath = oathList.get(i);
@Override Ability ability = new Ability(oath, "0") {
public void resolve() { @Override
//String opponent = player.getOpponent(); public void resolve() {
CardList libraryList = AllZoneUtil.getPlayerCardsInLibrary(player); CardList libraryList = AllZoneUtil.getPlayerCardsInLibrary(player);
//PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, player); PlayerZone battlefield = AllZone.getZone(Constant.Zone.Battlefield, player);
PlayerZone battlefield = AllZone.getZone(Constant.Zone.Battlefield, player); boolean oathFlag = true;
boolean oathFlag = true;
if (AllZoneUtil.compareTypeAmountInPlay(player, "Creature") < 0){ if (AllZoneUtil.compareTypeAmountInPlay(player, "Creature") < 0) {
if(player == AllZone.HumanPlayer){ if (player == AllZone.HumanPlayer){
String[] choices = {"Yes", "No"}; StringBuilder question = new StringBuilder();
Object q = null; question.append("Reveal cards from the top of your library and place ");
q = AllZone.Display.getChoiceOptional("Use Oath of Druids?", choices); question.append("the first creature revealed onto the battlefield?");
if(q == null || q.equals("No")) if (!GameActionUtil.showYesNoDialog(oath, question.toString())) {
oathFlag = false; oathFlag = false;
} }
else { // if player == Computer }
CardList creaturesInLibrary = AllZoneUtil.getPlayerTypeInLibrary(player, "Creature"); else { // if player == Computer
CardList creaturesInBattlefield = AllZoneUtil.getPlayerTypeInPlay(player, "Creature"); CardList creaturesInLibrary = AllZoneUtil.getPlayerTypeInLibrary(player, "Creature");
CardList creaturesInBattlefield = AllZoneUtil.getPlayerTypeInPlay(player, "Creature");
// if there are at least 3 creatures in library, or none in play with one in library, oath // if there are at least 3 creatures in library, or none in play with one in library, oath
if(creaturesInLibrary.size() > 2 || (creaturesInBattlefield.size() == 0 && creaturesInLibrary.size() > 0) ) if (creaturesInLibrary.size() > 2
oathFlag = true; || (creaturesInBattlefield.size() == 0 && creaturesInLibrary.size() > 0) )
else oathFlag = true;
oathFlag = false; else
} oathFlag = false;
}
if (oathFlag){
int max = libraryList.size(); if (oathFlag) {
for(int i = 0; i < max; i++) { CardList cardsToReveal = new CardList();
Card c = libraryList.get(i); int max = libraryList.size();
if(c.getType().contains("Creature")) { for (int i = 0; i < max; i++) {
AllZone.GameAction.moveTo(battlefield, c); Card c = libraryList.get(i);
break; cardsToReveal.add(c);
} if (c.getType().contains("Creature")) {
else{ AllZone.GameAction.moveTo(battlefield, c);
AllZone.GameAction.moveToGraveyard(c); break;
} }
} else {
} AllZone.GameAction.moveToGraveyard(c);
} }
} }// for loop
};// Ability if (cardsToReveal.size() > 0)
AllZone.Display.getChoice("Revealed cards", cardsToReveal.toArray());
StringBuilder sb = new StringBuilder(); }
sb.append("At the beginning of each player's upkeep, that player chooses target player "); }
sb.append("who controls more creatures than he or she does and is his or her opponent. The "); }
sb.append("first player may reveal cards from the top of his or her library until he or she "); };// Ability
sb.append("reveals a creature card. If he or she does, that player puts that card onto the ");
sb.append("battlefield and all other cards revealed this way into his or her graveyard."); StringBuilder sb = new StringBuilder();
ability.setStackDescription(sb.toString()); sb.append("At the beginning of each player's upkeep, that player chooses target player ");
sb.append("who controls more creatures than he or she does and is his or her opponent. The ");
sb.append("first player may reveal cards from the top of his or her library until he or she ");
sb.append("reveals a creature card. If he or she does, that player puts that card onto the ");
sb.append("battlefield and all other cards revealed this way into his or her graveyard.");
ability.setStackDescription(sb.toString());
AllZone.Stack.add(ability); AllZone.Stack.add(ability);
} }
} }
}// upkeep_Oath of Druids() }// upkeep_Oath of Druids()
private static void upkeep_Oath_of_Ghouls() { private static void upkeep_Oath_of_Ghouls() {
CardList oathList = AllZoneUtil.getCardsInPlay("Oath of Ghouls"); CardList oathList = AllZoneUtil.getCardsInPlay("Oath of Ghouls");