- 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

@@ -9192,48 +9192,53 @@ public class GameActionUtil {
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);
Ability ability = new Ability(oath, "0") {
@Override @Override
public void resolve() { public void resolve() {
//String opponent = player.getOpponent();
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 else { // if player == Computer
CardList creaturesInLibrary = AllZoneUtil.getPlayerTypeInLibrary(player, "Creature"); CardList creaturesInLibrary = AllZoneUtil.getPlayerTypeInLibrary(player, "Creature");
CardList creaturesInBattlefield = AllZoneUtil.getPlayerTypeInPlay(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
|| (creaturesInBattlefield.size() == 0 && creaturesInLibrary.size() > 0) )
oathFlag = true; oathFlag = true;
else else
oathFlag = false; oathFlag = false;
} }
if (oathFlag){ if (oathFlag) {
CardList cardsToReveal = new CardList();
int max = libraryList.size(); int max = libraryList.size();
for(int i = 0; i < max; i++) { for (int i = 0; i < max; i++) {
Card c = libraryList.get(i); Card c = libraryList.get(i);
if(c.getType().contains("Creature")) { cardsToReveal.add(c);
if (c.getType().contains("Creature")) {
AllZone.GameAction.moveTo(battlefield, c); AllZone.GameAction.moveTo(battlefield, c);
break; break;
} }
else{ else {
AllZone.GameAction.moveToGraveyard(c); AllZone.GameAction.moveToGraveyard(c);
} }
} }// for loop
if (cardsToReveal.size() > 0)
AllZone.Display.getChoice("Revealed cards", cardsToReveal.toArray());
} }
} }
} }