mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Pulled QuestData Preferences out of the code into a text file. This should allow users to tweak some Quest Options without needing to recompile the code.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -4567,6 +4567,7 @@ res/quest/easy.txt -text svneol=native#text/plain
|
|||||||
res/quest/hard.txt -text svneol=native#text/plain
|
res/quest/hard.txt -text svneol=native#text/plain
|
||||||
res/quest/medium.txt -text svneol=native#text/plain
|
res/quest/medium.txt -text svneol=native#text/plain
|
||||||
res/quest/price.txt -text svneol=native#text/plain
|
res/quest/price.txt -text svneol=native#text/plain
|
||||||
|
res/quest/quest.preferences -text
|
||||||
res/quest/quest.properties svneol=native#text/plain
|
res/quest/quest.properties svneol=native#text/plain
|
||||||
res/quest/questData -text svneol=unset#unset
|
res/quest/questData -text svneol=unset#unset
|
||||||
res/quest/quests.txt -text svneol=native#text/plain
|
res/quest/quests.txt -text svneol=native#text/plain
|
||||||
@@ -4774,6 +4775,7 @@ src/forge/PrintCardNames.java svneol=native#text/plain
|
|||||||
src/forge/PrintCardPictures.java svneol=native#text/plain
|
src/forge/PrintCardPictures.java svneol=native#text/plain
|
||||||
src/forge/QuestData.java svneol=native#text/plain
|
src/forge/QuestData.java svneol=native#text/plain
|
||||||
src/forge/QuestData_BoosterPack.java svneol=native#text/plain
|
src/forge/QuestData_BoosterPack.java svneol=native#text/plain
|
||||||
|
src/forge/QuestData_Prefs.java -text svneol=native#text/plain
|
||||||
src/forge/QuestData_State.java svneol=native#text/plain
|
src/forge/QuestData_State.java svneol=native#text/plain
|
||||||
src/forge/QuestUtil.java -text svneol=native#text/plain
|
src/forge/QuestUtil.java -text svneol=native#text/plain
|
||||||
src/forge/Quest_Assignment.java -text svneol=native#text/plain
|
src/forge/Quest_Assignment.java -text svneol=native#text/plain
|
||||||
|
|||||||
28
res/quest/quest.preferences
Normal file
28
res/quest/quest.preferences
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
difficultyString=Easy,Normal,Hard,Very Hard
|
||||||
|
# Num of Wins for each Difficulty to gain a Booster, Rank, Duel vs Tougher AI Decks
|
||||||
|
winsForBooster=1,1,2,2
|
||||||
|
winsForRankIncrease=3,4,5,6
|
||||||
|
winsForMediumAI=10,9,8,7
|
||||||
|
winsForHardAI=20,18,16,14
|
||||||
|
# When starting a quest this is how much of each type you'll start with. Plus your starting Credits.
|
||||||
|
startingBasicLand=20
|
||||||
|
startingSnowBasicLand=20
|
||||||
|
startingCommons=45,40,40,40
|
||||||
|
startingUncommons=20,15,15,15
|
||||||
|
startingRares=10,10,10,10
|
||||||
|
startingCredits=250
|
||||||
|
# When winning a booster pack, this is what you'll expect to see in a pack.
|
||||||
|
boosterPackCommon=7
|
||||||
|
boosterPackUncommon=3
|
||||||
|
boosterPackRare=1
|
||||||
|
# Match rewards that are used by the quest system
|
||||||
|
matchRewardBase=10
|
||||||
|
matchRewardTotalWins=0.3
|
||||||
|
matchRewardNoLosses=10
|
||||||
|
matchRewardAltWinBonus=100
|
||||||
|
macthRewardWinOnFirstTurn=1500
|
||||||
|
matchRewardWinByTurnFive=250
|
||||||
|
matchRewardWinByTurnTen=50
|
||||||
|
matchRewardWinByTurnFifteen=5
|
||||||
|
matchRewardMullToZero=500
|
||||||
|
|
||||||
@@ -10,5 +10,6 @@ medium--file=medium.txt
|
|||||||
hard--file=hard.txt
|
hard--file=hard.txt
|
||||||
|
|
||||||
data--file=questData
|
data--file=questData
|
||||||
|
prefs--file=quest.preferences
|
||||||
|
|
||||||
decks-dir--file=decks
|
decks-dir--file=decks
|
||||||
@@ -96,7 +96,7 @@ public class Gui_QuestOptions extends JFrame {
|
|||||||
JRadioButton[] b = {easyRadio, mediumRadio, hardRadio, veryHardRadio};
|
JRadioButton[] b = {easyRadio, mediumRadio, hardRadio, veryHardRadio};
|
||||||
|
|
||||||
for(int i = 0; i < diff.length; i++) {
|
for(int i = 0; i < diff.length; i++) {
|
||||||
b[i].setText(diff[i] + " - " + questData.getTotalNumberOfGames(diff[i]));
|
b[i].setText(diff[i] + " - " + questData.getTotalNumberOfGames(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//setupRadioButtonText()
|
}//setupRadioButtonText()
|
||||||
@@ -204,20 +204,20 @@ public class Gui_QuestOptions extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void newQuestButton_actionPerformed(ActionEvent e) {
|
void newQuestButton_actionPerformed(ActionEvent e) {
|
||||||
String difficulty = "";
|
int difficulty = 0;
|
||||||
|
|
||||||
String mode = "Realistic";
|
String mode = "Realistic";
|
||||||
|
|
||||||
if (fantasyRadio.isSelected())
|
if (fantasyRadio.isSelected())
|
||||||
mode = "Fantasy";
|
mode = "Fantasy";
|
||||||
|
|
||||||
if(easyRadio.isSelected()) difficulty = questData.EASY;
|
if(easyRadio.isSelected()) difficulty = 0;
|
||||||
|
|
||||||
else if(mediumRadio.isSelected()) difficulty = questData.MEDIUM;
|
else if(mediumRadio.isSelected()) difficulty = 1;
|
||||||
|
|
||||||
else if(hardRadio.isSelected()) difficulty = questData.HARD;
|
else if(hardRadio.isSelected()) difficulty = 2;
|
||||||
|
|
||||||
else if(veryHardRadio.isSelected()) difficulty = questData.VERY_HARD;
|
else if(veryHardRadio.isSelected()) difficulty = 3;
|
||||||
|
|
||||||
else //user didn't select a difficulty
|
else //user didn't select a difficulty
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -29,25 +28,8 @@ import forge.properties.NewConstants;
|
|||||||
//OR non-static readAIQuestDeckFiles()
|
//OR non-static readAIQuestDeckFiles()
|
||||||
//which reads the files "questDecks-easy", "questDecks-medium","questDecks-hard",
|
//which reads the files "questDecks-easy", "questDecks-medium","questDecks-hard",
|
||||||
public class QuestData implements NewConstants {
|
public class QuestData implements NewConstants {
|
||||||
public final String EASY = "Easy";
|
QuestData_Prefs qdPrefs = null;
|
||||||
public final String MEDIUM = "Medium";
|
|
||||||
public final String HARD = "Hard";
|
|
||||||
public final String VERY_HARD = "Very Hard";
|
|
||||||
|
|
||||||
//easy, medium, hard, very hard
|
|
||||||
//easy gets a new booster pack after 1 wins
|
|
||||||
//medium gets a new booster pack after after 1 wins, etc...
|
|
||||||
//hard gets a new booster pack after after 2 wins, etc...
|
|
||||||
//very hard gets a new booster pack after after 2 wins, etc...
|
|
||||||
//these numbers are just guesses
|
|
||||||
private int[] addCardsArray = {1, 1, 2, 2};
|
|
||||||
|
|
||||||
//easy, medium, hard, very hard
|
|
||||||
//easy gets a new "rank" after 1 wins
|
|
||||||
//medium, gets a new "rank" after 2 wins
|
|
||||||
//these numbers are just guesses
|
|
||||||
private int[] rankChangeArray = {1, 2, 3, 4};
|
|
||||||
|
|
||||||
private int rankIndex;
|
private int rankIndex;
|
||||||
private int win;
|
private int win;
|
||||||
private int lost;
|
private int lost;
|
||||||
@@ -70,7 +52,8 @@ public class QuestData implements NewConstants {
|
|||||||
|
|
||||||
private long credits;
|
private long credits;
|
||||||
|
|
||||||
private String difficulty;
|
private int diffIndex;
|
||||||
|
private String difficulty;
|
||||||
private String mode = "";
|
private String mode = "";
|
||||||
|
|
||||||
private ArrayList<String> easyAIDecks;
|
private ArrayList<String> easyAIDecks;
|
||||||
@@ -99,60 +82,40 @@ public class QuestData implements NewConstants {
|
|||||||
"Level 3 - Shattered the Competition", "Level 4 - Black Knighted", "Level 5 - Shockingly Good",
|
"Level 3 - Shattered the Competition", "Level 4 - Black Knighted", "Level 5 - Shockingly Good",
|
||||||
"Level 6 - Regressed into Timmy", "Level 7 - Loves Blue Control", "Level 8 - Immobilized by Fear",
|
"Level 6 - Regressed into Timmy", "Level 7 - Loves Blue Control", "Level 8 - Immobilized by Fear",
|
||||||
"Level 9 - Lands = Friends", "Saltblasted for your talent", "Serra Angel is your girlfriend",};
|
"Level 9 - Lands = Friends", "Saltblasted for your talent", "Serra Angel is your girlfriend",};
|
||||||
|
|
||||||
/*
|
|
||||||
private String[] rankArray =
|
|
||||||
{
|
|
||||||
"Level 0 - Interested Newbie" ,
|
|
||||||
"Level 1 - Card Flopper" ,
|
|
||||||
"Level 2 - Friday Night Winner",
|
|
||||||
"Level 3 - Store Champion" ,
|
|
||||||
"Level 4 - Card Crusher" ,
|
|
||||||
"Level 5 - PTQ Player" ,
|
|
||||||
"Level 6 - PTQ Winner" ,
|
|
||||||
"Level 7 - Pro Wannabe" ,
|
|
||||||
"Level 8 - Pro-Tour Winner" ,
|
|
||||||
"Level 9 - Better Than Jon Finkel" ,
|
|
||||||
"Level 10 - World Champion - You Win",
|
|
||||||
"Secret Level - Magic God"
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
public QuestData() {
|
public QuestData(){
|
||||||
for(int i = 0; i < 20; i++) {
|
qdPrefs = new QuestData_Prefs();
|
||||||
|
|
||||||
|
for(int i = 0; i < qdPrefs.getStartingBasic(); i++) {
|
||||||
cardPool.add("Forest");
|
cardPool.add("Forest");
|
||||||
cardPool.add("Mountain");
|
cardPool.add("Mountain");
|
||||||
cardPool.add("Swamp");
|
cardPool.add("Swamp");
|
||||||
cardPool.add("Island");
|
cardPool.add("Island");
|
||||||
cardPool.add("Plains");
|
cardPool.add("Plains");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < qdPrefs.getStartingSnowBasic(); i++) {
|
||||||
cardPool.add("Snow-Covered Forest");
|
cardPool.add("Snow-Covered Forest");
|
||||||
cardPool.add("Snow-Covered Mountain");
|
cardPool.add("Snow-Covered Mountain");
|
||||||
cardPool.add("Snow-Covered Swamp");
|
cardPool.add("Snow-Covered Swamp");
|
||||||
cardPool.add("Snow-Covered Island");
|
cardPool.add("Snow-Covered Island");
|
||||||
cardPool.add("Snow-Covered Plains");
|
cardPool.add("Snow-Covered Plains");
|
||||||
}//for
|
}
|
||||||
}//QuestData
|
}//QuestData
|
||||||
|
|
||||||
//adds cards to card pool and sets difficulty
|
//adds cards to card pool and sets difficulty
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void newGame(String difficulty, String m) {
|
public void newGame(int difficulty, String m) {
|
||||||
setDifficulty(difficulty);
|
setDifficulty(difficulty);
|
||||||
|
|
||||||
int[][] totals = { {45, 20, 10}, //easy, 45 common, 20 uncommon, 10 rares
|
|
||||||
{40, 15, 10} //everything else
|
|
||||||
};
|
|
||||||
|
|
||||||
int n = 1;
|
|
||||||
if(difficulty.equals(EASY)) n = 0;
|
|
||||||
|
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
list.addAll(boosterPack.getCommon(totals[n][0]));
|
list.addAll(boosterPack.getCommon(qdPrefs.getStartingCommons(difficulty)));
|
||||||
list.addAll(boosterPack.getUncommon(totals[n][1]));
|
list.addAll(boosterPack.getUncommon(qdPrefs.getStartingUncommons(difficulty)));
|
||||||
list.addAll(boosterPack.getRare(totals[n][2]));
|
list.addAll(boosterPack.getRare(qdPrefs.getStartingRares(difficulty)));
|
||||||
|
|
||||||
//because cardPool already has basic land added to it
|
//because cardPool already has basic land added to it
|
||||||
cardPool.addAll(list);
|
cardPool.addAll(list);
|
||||||
credits = 250;
|
credits = qdPrefs.getStartingBasic();
|
||||||
|
|
||||||
mode = m;
|
mode = m;
|
||||||
if (mode.equals("Fantasy"))
|
if (mode.equals("Fantasy"))
|
||||||
@@ -162,22 +125,12 @@ public class QuestData implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String[] getOpponents() {
|
public String[] getOpponents() {
|
||||||
int difficulty[][] = {
|
int index = getDiffIndex();
|
||||||
//if getWin() is < 5 return use easyAIDecks
|
|
||||||
//if getWin() is < 8 return mediumAIDecks
|
|
||||||
//else use hardAIDecks
|
|
||||||
{5, 8}, //easy difficulty
|
|
||||||
{5, 8}, //medium difficulty
|
|
||||||
{10, 20},//hard difficulty
|
|
||||||
{10, 20},//very hard difficulty
|
|
||||||
};
|
|
||||||
|
|
||||||
int index = convertDifficultyToIndex(getDifficulty());
|
if(getWin() < qdPrefs.getWinsForMediumAI(index)) return getOpponents(easyAIDecks);
|
||||||
|
|
||||||
if(getWin() < difficulty[index][0]) return getOpponents(easyAIDecks);
|
if(getWin() < qdPrefs.getWinsForHardAI(index)) return getOpponents(mediumAIDecks);
|
||||||
|
|
||||||
if(getWin() < difficulty[index][1]) return getOpponents(mediumAIDecks);
|
|
||||||
|
|
||||||
return getOpponents(hardAIDecks);
|
return getOpponents(hardAIDecks);
|
||||||
}//getOpponents()
|
}//getOpponents()
|
||||||
@@ -187,14 +140,12 @@ public class QuestData implements NewConstants {
|
|||||||
data.easyAIDecks = readFile(ForgeProps.getFile(QUEST.EASY), aiDeckNames);
|
data.easyAIDecks = readFile(ForgeProps.getFile(QUEST.EASY), aiDeckNames);
|
||||||
data.mediumAIDecks = readFile(ForgeProps.getFile(QUEST.MEDIUM), aiDeckNames);
|
data.mediumAIDecks = readFile(ForgeProps.getFile(QUEST.MEDIUM), aiDeckNames);
|
||||||
data.hardAIDecks = readFile(ForgeProps.getFile(QUEST.HARD), aiDeckNames);
|
data.hardAIDecks = readFile(ForgeProps.getFile(QUEST.HARD), aiDeckNames);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAIQuestDeckFiles(ArrayList<String> aiDeckNames) {
|
public void refreshAIQuestDeckFiles(ArrayList<String> aiDeckNames) {
|
||||||
easyAIDecks = readFile(ForgeProps.getFile(QUEST.EASY), aiDeckNames);
|
easyAIDecks = readFile(ForgeProps.getFile(QUEST.EASY), aiDeckNames);
|
||||||
mediumAIDecks = readFile(ForgeProps.getFile(QUEST.MEDIUM), aiDeckNames);
|
mediumAIDecks = readFile(ForgeProps.getFile(QUEST.MEDIUM), aiDeckNames);
|
||||||
hardAIDecks = readFile(ForgeProps.getFile(QUEST.HARD), aiDeckNames);
|
hardAIDecks = readFile(ForgeProps.getFile(QUEST.HARD), aiDeckNames);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getOpponents(ArrayList<String> aiDeck) {
|
public String[] getOpponents(ArrayList<String> aiDeck) {
|
||||||
@@ -250,12 +201,12 @@ public class QuestData implements NewConstants {
|
|||||||
|
|
||||||
QuestData data = new QuestData();
|
QuestData data = new QuestData();
|
||||||
|
|
||||||
|
|
||||||
data.win = state.win;
|
data.win = state.win;
|
||||||
data.lost = state.lost;
|
data.lost = state.lost;
|
||||||
data.credits = state.credits;
|
data.credits = state.credits;
|
||||||
data.rankIndex = state.rankIndex;
|
data.rankIndex = state.rankIndex;
|
||||||
data.difficulty = state.difficulty;
|
data.difficulty = state.difficulty;
|
||||||
|
|
||||||
data.mode = state.mode;
|
data.mode = state.mode;
|
||||||
if (data.mode == null)
|
if (data.mode == null)
|
||||||
data.mode = "Realistic";
|
data.mode = "Realistic";
|
||||||
@@ -439,9 +390,9 @@ public class QuestData implements NewConstants {
|
|||||||
//(I chose 11 cards instead of 15 in order to make things more challenging)
|
//(I chose 11 cards instead of 15 in order to make things more challenging)
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void addCards() {
|
public void addCards() {
|
||||||
int nCommon = 7;
|
int nCommon = qdPrefs.getNumCommon();
|
||||||
int nUncommon = 3;
|
int nUncommon = qdPrefs.getNumUncommon();
|
||||||
int nRare = 1;
|
int nRare = qdPrefs.getNumRare();
|
||||||
|
|
||||||
ArrayList<String> newCards = new ArrayList<String>();
|
ArrayList<String> newCards = new ArrayList<String>();
|
||||||
newCards.addAll(boosterPack.getCommon(nCommon));
|
newCards.addAll(boosterPack.getCommon(nCommon));
|
||||||
@@ -539,13 +490,13 @@ public class QuestData implements NewConstants {
|
|||||||
|
|
||||||
public long getCreditsToAdd(WinLose winLose)
|
public long getCreditsToAdd(WinLose winLose)
|
||||||
{
|
{
|
||||||
long creds = (long) (10 + (0.3 * win));
|
long creds = (long) (qdPrefs.getMatchRewardBase() + (qdPrefs.getMatchRewardTotalWins() * win));
|
||||||
String[] wins = winLose.getWinMethods();
|
String[] wins = winLose.getWinMethods();
|
||||||
int[] winTurns = winLose.getWinTurns();
|
int[] winTurns = winLose.getWinTurns();
|
||||||
boolean[] mulliganedToZero = winLose.getMulliganedToZero();
|
boolean[] mulliganedToZero = winLose.getMulliganedToZero();
|
||||||
|
|
||||||
if (winLose.getLose() == 0)
|
if (winLose.getLose() == 0)
|
||||||
creds += 10;
|
creds += qdPrefs.getMatchRewardNoLosses();
|
||||||
|
|
||||||
for(String s : wins)
|
for(String s : wins)
|
||||||
{
|
{
|
||||||
@@ -553,27 +504,27 @@ public class QuestData implements NewConstants {
|
|||||||
if (s.equals("Poison Counters") || s.equals("Milled") || s.equals("Battle of Wits") ||
|
if (s.equals("Poison Counters") || s.equals("Milled") || s.equals("Battle of Wits") ||
|
||||||
s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") ||
|
s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") ||
|
||||||
s.equals("Door to Nothingness") || s.equals("Barren Glory") || s.equals("Near-Death Experience")) {
|
s.equals("Door to Nothingness") || s.equals("Barren Glory") || s.equals("Near-Death Experience")) {
|
||||||
creds+=100;
|
creds += qdPrefs.getMatchRewardAltWinBonus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i : winTurns)
|
for (int i : winTurns)
|
||||||
{
|
{
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
creds+=1500;
|
creds += qdPrefs.getMatchRewardWinFirst();
|
||||||
else if (i <= 5)
|
else if (i <= 5)
|
||||||
creds+=250;
|
creds += qdPrefs.getMatchRewardWinByFifth();
|
||||||
else if (i <= 10)
|
else if (i <= 10)
|
||||||
creds+=50;
|
creds += qdPrefs.getMatchRewardWinByTen();
|
||||||
else if (i <= 15)
|
else if (i <= 15)
|
||||||
creds+=5;
|
creds += qdPrefs.getMatchRewardWinByFifteen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (boolean b : mulliganedToZero)
|
for (boolean b : mulliganedToZero)
|
||||||
{
|
{
|
||||||
if (b == true)
|
if (b == true)
|
||||||
creds+=500;
|
creds += qdPrefs.getMatchMullToZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEstatesLevel() == 1)
|
if (getEstatesLevel() == 1)
|
||||||
@@ -595,10 +546,10 @@ public class QuestData implements NewConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getTotalNumberOfGames(String difficulty) {
|
public int getTotalNumberOfGames(int difficulty) {
|
||||||
//-2 because you start a level 1, and the last level is secret
|
//-2 because you start a level 1, and the last level is secret
|
||||||
int numberLevels = rankArray.length - 2;
|
int numberLevels = rankArray.length - 2;
|
||||||
int nMatches = rankChangeArray[convertDifficultyToIndex(difficulty)];
|
int nMatches = qdPrefs.getWinsForRankIncrease(difficulty);
|
||||||
|
|
||||||
return numberLevels * nMatches;
|
return numberLevels * nMatches;
|
||||||
}
|
}
|
||||||
@@ -606,27 +557,10 @@ public class QuestData implements NewConstants {
|
|||||||
//this changes getRank()
|
//this changes getRank()
|
||||||
public void addWin() {
|
public void addWin() {
|
||||||
win++;
|
win++;
|
||||||
|
|
||||||
int n = convertDifficultyToIndex();
|
if(win % qdPrefs.getWinsForRankIncrease(diffIndex) == 0) rankIndex++;
|
||||||
|
|
||||||
if(win % rankChangeArray[n] == 0) rankIndex++;
|
|
||||||
}//addWin()
|
}//addWin()
|
||||||
|
|
||||||
private int convertDifficultyToIndex() {
|
|
||||||
return convertDifficultyToIndex(getDifficulty());
|
|
||||||
}
|
|
||||||
|
|
||||||
private int convertDifficultyToIndex(String difficulty) {
|
|
||||||
String s = difficulty;
|
|
||||||
|
|
||||||
if(s.equals(EASY)) return 0;
|
|
||||||
if(s.equals(MEDIUM)) return 1;
|
|
||||||
if(s.equals(HARD)) return 2;
|
|
||||||
|
|
||||||
//VERY_HARD
|
|
||||||
return 3;
|
|
||||||
}//convertDifficultyToIndex()
|
|
||||||
|
|
||||||
public void addLost() {
|
public void addLost() {
|
||||||
lost++;
|
lost++;
|
||||||
}
|
}
|
||||||
@@ -795,12 +729,17 @@ public class QuestData implements NewConstants {
|
|||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDifficulty(String s) {
|
public int getDiffIndex() {
|
||||||
difficulty = s;
|
return diffIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDifficulty(int i) {
|
||||||
|
diffIndex = i;
|
||||||
|
difficulty = qdPrefs.getDifficulty(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getDifficutlyChoices() {
|
public String[] getDifficutlyChoices() {
|
||||||
return new String[] {EASY, MEDIUM, HARD, VERY_HARD};
|
return qdPrefs.getDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRank() {
|
public String getRank() {
|
||||||
@@ -812,7 +751,7 @@ public class QuestData implements NewConstants {
|
|||||||
|
|
||||||
//add cards after a certain number of wins or losses
|
//add cards after a certain number of wins or losses
|
||||||
public boolean shouldAddCards(boolean didWin) {
|
public boolean shouldAddCards(boolean didWin) {
|
||||||
int n = addCardsArray[convertDifficultyToIndex()];
|
int n = qdPrefs.getWinsForBooster(diffIndex);
|
||||||
|
|
||||||
if(didWin) return getWin() % n == 0;
|
if(didWin) return getWin() % n == 0;
|
||||||
else return getLost() % n == 0;
|
else return getLost() % n == 0;
|
||||||
|
|||||||
333
src/forge/QuestData_Prefs.java
Normal file
333
src/forge/QuestData_Prefs.java
Normal file
@@ -0,0 +1,333 @@
|
|||||||
|
package forge;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import forge.properties.ForgeProps;
|
||||||
|
import forge.properties.NewConstants.QUEST;
|
||||||
|
|
||||||
|
public class QuestData_Prefs implements Serializable {
|
||||||
|
private static final long serialVersionUID = 3266336025656577905L;
|
||||||
|
|
||||||
|
private int numDiff = 4;
|
||||||
|
|
||||||
|
// Descriptive difficulty names
|
||||||
|
private String[] sDifficulty = { "Easy", "Normal", "Hard", "Very Hard" };
|
||||||
|
|
||||||
|
// Default match wins it takes to gain a booster
|
||||||
|
private int[] winsForBooster = { 1, 1, 2, 2 };
|
||||||
|
private int[] winsForRankIncrease = { 1, 2, 3, 4 };
|
||||||
|
private int[] winsForMediumAI = { 6, 6, 11, 11 };
|
||||||
|
private int[] winsForHardAI = { 9, 9, 21, 21 };
|
||||||
|
|
||||||
|
// Default starting land for a quest
|
||||||
|
private int startingBasicLand = 20;
|
||||||
|
private int startingSnowBasicLand = 20;
|
||||||
|
|
||||||
|
// Default starting amount of each rarity
|
||||||
|
private int[] startingCommons = {45, 40, 40, 40};
|
||||||
|
private int[] startingUncommons = {20, 15, 15, 15};
|
||||||
|
private int[] startingRares = {10, 10, 10, 10};
|
||||||
|
|
||||||
|
private int startingCredits = 250;
|
||||||
|
|
||||||
|
private int boosterPackRare = 1;
|
||||||
|
private int boosterPackUncommon = 3;
|
||||||
|
private int boosterPackCommon = 9;
|
||||||
|
|
||||||
|
private int matchRewardBase = 10;
|
||||||
|
private double matchRewardTotalWins = 0.3;
|
||||||
|
private int matchRewardNoLosses = 10;
|
||||||
|
private int matchRewardAltWinBonus = 100;
|
||||||
|
private int matchRewardWinOnFirstTurn = 1500;
|
||||||
|
private int matchRewardWinByTurnFive = 250;
|
||||||
|
private int matchRewardWinByTurnTen = 50;
|
||||||
|
private int matchRewardWinByTurnFifteen = 5;
|
||||||
|
private int matchRewardMullToZero = 500;
|
||||||
|
|
||||||
|
public QuestData_Prefs()
|
||||||
|
{
|
||||||
|
// if quest.prefs exists
|
||||||
|
grabPrefsFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void grabPrefsFromFile(){
|
||||||
|
try{
|
||||||
|
BufferedReader input = new BufferedReader(new FileReader(ForgeProps.getFile(QUEST.PREFS)));
|
||||||
|
String line = null;
|
||||||
|
while((line = input.readLine()) != null){
|
||||||
|
if (line.startsWith("#") || line.isEmpty())
|
||||||
|
continue;
|
||||||
|
String[] split = line.split("=");
|
||||||
|
|
||||||
|
if (split[0].equals("difficultyString"))
|
||||||
|
setDifficulty(split[1]);
|
||||||
|
else if (split[0].equals("winsForBooster"))
|
||||||
|
setWinsForBooster(split[1]);
|
||||||
|
else if (split[0].equals("winsForRankIncrease"))
|
||||||
|
setWinsForRank(split[1]);
|
||||||
|
else if (split[0].equals("winsForMediumAI"))
|
||||||
|
setWinsForMediumAI(split[1]);
|
||||||
|
else if (split[0].equals("winsForHardAI"))
|
||||||
|
setWinsForHardAI(split[1]);
|
||||||
|
else if (split[0].equals("startingBasicLand"))
|
||||||
|
setStartingBasic(split[1]);
|
||||||
|
else if (split[0].equals("startingSnowBasicLand"))
|
||||||
|
setStartingSnowBasic(split[1]);
|
||||||
|
else if (split[0].equals("startingCommons"))
|
||||||
|
setStartingCommons(split[1]);
|
||||||
|
else if (split[0].equals("startingUncommons"))
|
||||||
|
setStartingUncommons(split[1]);
|
||||||
|
else if (split[0].equals("startingRares"))
|
||||||
|
setStartingRares(split[1]);
|
||||||
|
else if (split[0].equals("startingCredits"))
|
||||||
|
setStartingCredits(split[1]);
|
||||||
|
else if (split[0].equals("boosterPackCommon"))
|
||||||
|
setNumCommon(split[1]);
|
||||||
|
else if (split[0].equals("boosterPackUncommon"))
|
||||||
|
setNumUncommon(split[1]);
|
||||||
|
else if (split[0].equals("boosterPackRare"))
|
||||||
|
setNumRares(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardBase"))
|
||||||
|
setMatchRewardBase(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardTotalWins"))
|
||||||
|
setMatchRewardTotalWins(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardNoLosses"))
|
||||||
|
setMatchRewardNoLosses(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardAltWinBonus"))
|
||||||
|
setMatchRewardAltWinBonus(split[1]);
|
||||||
|
else if (split[0].equals("macthRewardWinOnFirstTurn"))
|
||||||
|
setMatchRewardWinFirst(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardWinByTurnFive"))
|
||||||
|
setMatchRewardWinByFifth(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardWinByTurnTen"))
|
||||||
|
setMatchRewardWinByTen(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardWinByTurnFifteen"))
|
||||||
|
setMatchRewardWinByFifteen(split[1]);
|
||||||
|
else if (split[0].equals("matchRewardMullToZero"))
|
||||||
|
setMatchMullToZero(split[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Trouble grabbing quest data preferences. Using default values.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getters
|
||||||
|
public String[] getDifficulty(){
|
||||||
|
return sDifficulty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDifficulty(int index){
|
||||||
|
return sDifficulty[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWinsForBooster(int index){
|
||||||
|
return winsForBooster[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWinsForRankIncrease(int index){
|
||||||
|
return winsForRankIncrease[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWinsForMediumAI(int index){
|
||||||
|
return winsForMediumAI[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWinsForHardAI(int index){
|
||||||
|
return winsForHardAI[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingBasic(){
|
||||||
|
return startingBasicLand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingSnowBasic(){
|
||||||
|
return startingSnowBasicLand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingCommons(int index){
|
||||||
|
return startingCommons[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingUncommons(int index){
|
||||||
|
return startingUncommons[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingRares(int index){
|
||||||
|
return startingRares[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartingCredits(){
|
||||||
|
return startingCredits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumCommon(){
|
||||||
|
return boosterPackCommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumUncommon(){
|
||||||
|
return boosterPackUncommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumRare(){
|
||||||
|
return boosterPackRare;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMatchRewardBase(){
|
||||||
|
return matchRewardBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMatchRewardTotalWins(){
|
||||||
|
return matchRewardTotalWins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchRewardNoLosses(){
|
||||||
|
return matchRewardNoLosses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchRewardAltWinBonus(){
|
||||||
|
return matchRewardAltWinBonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getMatchRewardWinFirst(){
|
||||||
|
return matchRewardWinOnFirstTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchRewardWinByFifth(){
|
||||||
|
return matchRewardWinByTurnFive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchRewardWinByTen(){
|
||||||
|
return matchRewardWinByTurnTen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchRewardWinByFifteen(){
|
||||||
|
return matchRewardWinByTurnFifteen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchMullToZero(){
|
||||||
|
return matchRewardMullToZero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// setters
|
||||||
|
public void setDifficulty(String diff){
|
||||||
|
this.sDifficulty = diff.split(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinsForBooster(String wins){
|
||||||
|
String[] winsStr = wins.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.winsForBooster[i] = Integer.parseInt(winsStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinsForRank(String wins){
|
||||||
|
String[] winsStr = wins.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.winsForRankIncrease[i] = Integer.parseInt(winsStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinsForMediumAI(String wins){
|
||||||
|
String[] winsStr = wins.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.winsForMediumAI[i] = Integer.parseInt(winsStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWinsForHardAI(String wins){
|
||||||
|
String[] winsStr = wins.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.winsForHardAI[i] = Integer.parseInt(winsStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingBasic(String land){
|
||||||
|
this.startingBasicLand = Integer.parseInt(land);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingSnowBasic(String land){
|
||||||
|
this.startingSnowBasicLand = Integer.parseInt(land);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingCommons(String rarity){
|
||||||
|
String[] splitStr = rarity.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.startingCommons[i] = Integer.parseInt(splitStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingUncommons(String rarity){
|
||||||
|
String[] splitStr = rarity.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.startingUncommons[i] = Integer.parseInt(splitStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingRares(String rarity){
|
||||||
|
String[] splitStr = rarity.split(",");
|
||||||
|
|
||||||
|
for(int i = 0; i < numDiff; i++)
|
||||||
|
this.startingRares[i] = Integer.parseInt(splitStr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartingCredits(String credits){
|
||||||
|
this.startingCredits = Integer.parseInt(credits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumCommon(String pack){
|
||||||
|
this.boosterPackCommon = Integer.parseInt(pack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumUncommon(String pack){
|
||||||
|
this.boosterPackUncommon = Integer.parseInt(pack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumRares(String pack){
|
||||||
|
this.boosterPackRare = Integer.parseInt(pack);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMatchRewardBase(String match){
|
||||||
|
this.matchRewardBase = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardTotalWins(String match){
|
||||||
|
this.matchRewardTotalWins = Double.parseDouble(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardNoLosses(String match){
|
||||||
|
this.matchRewardNoLosses = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardAltWinBonus(String match){
|
||||||
|
this.matchRewardAltWinBonus = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMatchRewardWinFirst(String match){
|
||||||
|
this.matchRewardWinOnFirstTurn = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardWinByFifth(String match){
|
||||||
|
this.matchRewardWinByTurnFive = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardWinByTen(String match){
|
||||||
|
this.matchRewardWinByTurnTen = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchRewardWinByFifteen(String match){
|
||||||
|
this.matchRewardWinByTurnFifteen = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchMullToZero(String match){
|
||||||
|
this.matchRewardMullToZero = Integer.parseInt(match);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -99,6 +99,7 @@ public interface NewConstants {
|
|||||||
public static final String HARD = "quest/hard";
|
public static final String HARD = "quest/hard";
|
||||||
|
|
||||||
public static final String DATA = "quest/data";
|
public static final String DATA = "quest/data";
|
||||||
|
public static final String PREFS = "quest/prefs";
|
||||||
|
|
||||||
public static final String DECKS = "quest/decks-dir";
|
public static final String DECKS = "quest/decks-dir";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user