AF_ChooseType for Creature types now uses list selection instead of free-text typing.

This commit is contained in:
slapshot5
2011-10-09 00:19:25 +00:00
parent dd972b42ea
commit ed92acf9c6
2 changed files with 32 additions and 3 deletions

View File

@@ -413,7 +413,7 @@ public final class CardUtil {
}
/**
* <p>getCardTypes.</p>
* <p>getBasicTypes.</p>
*
* @return a {@link java.util.ArrayList} object.
* @since 1.1.3
@@ -434,6 +434,20 @@ public final class CardUtil {
return types;
}
/**
* <p>getCreatureTypes.</p>
*
* @return a {@link java.util.ArrayList} object.
* @since 1.1.6
*/
public static ArrayList<String> getCreatureTypes() {
ArrayList<String> types = new ArrayList<String>();
types.addAll(Constant.CardTypes.creatureTypes[0].list);
return types;
}
/**
* <p>isASuperType.</p>

View File

@@ -281,8 +281,19 @@ public class AbilityFactory_Choose {
boolean valid = false;
while (!valid) {
if (sa.getActivatingPlayer().isHuman()) {
chosenType = JOptionPane.showInputDialog(null, "Choose a creature type:", card.getName(),
JOptionPane.QUESTION_MESSAGE);
ArrayList<String> validChoices = CardUtil.getCreatureTypes();
for (String s : invalidTypes) {
validChoices.remove(s);
}
Object o = GuiUtils.getChoice("Choose a creature type", validChoices.toArray());
if (null == o) {
return;
}
String choice = (String) o;
if (CardUtil.isACreatureType(choice) && !invalidTypes.contains(choice)) {
valid = true;
card.setChosenType(choice);
}
}
else {
String chosen = "";
@@ -303,6 +314,10 @@ public class AbilityFactory_Choose {
chosen = CardFactoryUtil.getMostProminentCreatureType(
AllZoneUtil.getCardsInGame().getController(AllZone.getComputerPlayer()));
}
if (logic.equals("MostProminentInComputerGraveyard")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(
AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard));
}
}
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
chosen = "Sliver";