mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Renamed "getOpponents()" to "generateBattles()" in QuestBattleManager and QuestBattle.
Note: AllZoneUtil already has a method called getOpponents. Updated references.
This commit is contained in:
@@ -40,6 +40,8 @@ public class QuestBattleManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>removeAIDeck.</p>
|
* <p>removeAIDeck.</p>
|
||||||
|
* Removes a deck object stored in the
|
||||||
|
*{@link forge.quest.gui.main.aiDecks} map.
|
||||||
*
|
*
|
||||||
* @param deckName a {@link java.lang.String} object.
|
* @param deckName a {@link java.lang.String} object.
|
||||||
*/
|
*/
|
||||||
@@ -49,6 +51,8 @@ public class QuestBattleManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>addAIDeck.</p>
|
* <p>addAIDeck.</p>
|
||||||
|
* Adds a deck object stored in the
|
||||||
|
*{@link forge.quest.gui.main.aiDecks} map.
|
||||||
*
|
*
|
||||||
* @param d a {@link forge.deck.Deck} object.
|
* @param d a {@link forge.deck.Deck} object.
|
||||||
*/
|
*/
|
||||||
@@ -73,6 +77,17 @@ public class QuestBattleManager {
|
|||||||
return aiDecks.get(deckName);
|
return aiDecks.get(deckName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>getAIDeckNames.</p>
|
||||||
|
* Returns a list of decks stored in the
|
||||||
|
* {@link forge.quest.gui.main.aiDecks} map.
|
||||||
|
*
|
||||||
|
* @return a {@link java.util.List} object.
|
||||||
|
*/
|
||||||
|
public static List<String> getAIDeckNames() {
|
||||||
|
return new ArrayList<String>(aiDecks.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getDeckFromFile.</p>
|
* <p>getDeckFromFile.</p>
|
||||||
* Returns a deck object built from a file name.
|
* Returns a deck object built from a file name.
|
||||||
@@ -86,18 +101,12 @@ public class QuestBattleManager {
|
|||||||
return manager.getDeck(deckName);
|
return manager.getDeck(deckName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>getAIDeckNames.</p>
|
|
||||||
*
|
|
||||||
* @return a {@link java.util.List} object.
|
|
||||||
*/
|
|
||||||
public static List<String> getAIDeckNames() {
|
|
||||||
return new ArrayList<String>(aiDecks.keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getOpponent.</p>
|
* <p>getOpponent.</p>
|
||||||
*
|
*
|
||||||
|
* Badly named; AllZoneUtil already has a method called getOpponents.
|
||||||
|
* ?????
|
||||||
|
*
|
||||||
* @param aiDeck a {@link java.util.List} object.
|
* @param aiDeck a {@link java.util.List} object.
|
||||||
* @param number a int.
|
* @param number a int.
|
||||||
* @return a {@link java.lang.String} object.
|
* @return a {@link java.lang.String} object.
|
||||||
@@ -108,16 +117,16 @@ public class QuestBattleManager {
|
|||||||
Collections.shuffle(deckListCopy, new Random(AllZone.getQuestData().getRandomSeed()));
|
Collections.shuffle(deckListCopy, new Random(AllZone.getQuestData().getRandomSeed()));
|
||||||
|
|
||||||
return deckListCopy.get(number);
|
return deckListCopy.get(number);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>getOpponents.</p>
|
* <p>generateBattles.</p>
|
||||||
|
* Generates an array of new opponents based on current win conditions.
|
||||||
*
|
*
|
||||||
* @return an array of {@link java.lang.String} objects.
|
* @return an array of {@link java.lang.String} objects.
|
||||||
*/
|
*/
|
||||||
public static String[] getOpponents() {
|
public static String[] generateBattles() {
|
||||||
int index = AllZone.getQuestData().getDifficultyIndex();
|
int index = AllZone.getQuestData().getDifficultyIndex();
|
||||||
|
|
||||||
if (AllZone.getQuestData().getWin() < QuestPreferences.getWinsForMediumAI(index)) {
|
if (AllZone.getQuestData().getWin() < QuestPreferences.getWinsForMediumAI(index)) {
|
||||||
@@ -163,6 +172,7 @@ public class QuestBattleManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>readFile.</p>
|
* <p>readFile.</p>
|
||||||
|
* A reader util for accessing the AI deck list text files.
|
||||||
*
|
*
|
||||||
* @param file a {@link java.io.File} object.
|
* @param file a {@link java.io.File} object.
|
||||||
* @param aiDecks a {@link java.util.List} object.
|
* @param aiDecks a {@link java.util.List} object.
|
||||||
@@ -172,7 +182,7 @@ public class QuestBattleManager {
|
|||||||
ArrayList<String> list = FileUtil.readFile(file);
|
ArrayList<String> list = FileUtil.readFile(file);
|
||||||
|
|
||||||
//remove any blank lines
|
//remove any blank lines
|
||||||
ArrayList<String> noBlankLines = new ArrayList<String>();
|
ArrayList<String> noBlankLines = new ArrayList<String>();
|
||||||
String s;
|
String s;
|
||||||
for (String aList : list) {
|
for (String aList : list) {
|
||||||
s = aList.trim();
|
s = aList.trim();
|
||||||
@@ -188,7 +198,6 @@ public class QuestBattleManager {
|
|||||||
file);
|
file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (String aList : list) {
|
for (String aList : list) {
|
||||||
if (!aiDecks.contains(aList)) {
|
if (!aiDecks.contains(aList)) {
|
||||||
aiDecks.add(aList);
|
aiDecks.add(aList);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class QuestBattle extends QuestSelectablePanel {
|
|||||||
public static List<QuestSelectablePanel> getBattles() {
|
public static List<QuestSelectablePanel> getBattles() {
|
||||||
List<QuestSelectablePanel> opponentList = new ArrayList<QuestSelectablePanel>();
|
List<QuestSelectablePanel> opponentList = new ArrayList<QuestSelectablePanel>();
|
||||||
|
|
||||||
String[] oppDecks = QuestBattleManager.getOpponents();
|
String[] oppDecks = QuestBattleManager.generateBattles();
|
||||||
for (String oppDeckName : oppDecks) {
|
for (String oppDeckName : oppDecks) {
|
||||||
// Get deck object and properties for this opponent.
|
// Get deck object and properties for this opponent.
|
||||||
oppDeck = QuestBattleManager.getAIDeckFromFile(oppDeckName);
|
oppDeck = QuestBattleManager.getAIDeckFromFile(oppDeckName);
|
||||||
|
|||||||
Reference in New Issue
Block a user