- Integrating More Duel Choices patch by Seravy.

This commit is contained in:
Agetian
2017-06-29 14:03:56 +00:00
parent 63024322ee
commit 9aa4e3d9cf
3 changed files with 65 additions and 22 deletions

View File

@@ -346,6 +346,9 @@ public enum VSubmenuQuestPrefs implements IVSubmenu<CSubmenuQuestPrefs> {
pnlDifficulty.add(new FLabel.Builder().text("Penalty for Loss").fontAlign(SwingConstants.RIGHT).build(), labelConstraints);
pnlDifficulty.add(new PrefInput(QPref.PENALTY_LOSS, QuestPreferencesErrType.DIFFICULTY), fieldConstraints + ", wrap");
pnlDifficulty.add(new FLabel.Builder().text("More Duel Choices").fontAlign(SwingConstants.RIGHT).build(), labelConstraints);
pnlDifficulty.add(new PrefInput(QPref.MORE_DUEL_CHOICES, QuestPreferencesErrType.DIFFICULTY), fieldConstraints + ", wrap");
}
private void populateBooster() {

View File

@@ -20,6 +20,7 @@ package forge.quest;
import forge.model.FModel;
import forge.quest.data.QuestPreferences;
import forge.quest.data.QuestPreferences.DifficultyPrefs;
import forge.quest.data.QuestPreferences.QPref;
import forge.quest.io.QuestDuelReader;
import forge.util.CollectionSuppliers;
import forge.util.maps.EnumMapOfLists;
@@ -147,6 +148,8 @@ public class QuestEventDuelManager {
public final List<QuestEventDuel> generateDuels() {
final QuestPreferences questPreferences = FModel.getQuestPreferences();
boolean moreDuelChoices = questPreferences.getPrefInt(QPref.MORE_DUEL_CHOICES) > 0;
if (FModel.getQuest().getAchievements() == null) {
return null;
}
@@ -157,6 +160,39 @@ public class QuestEventDuelManager {
final int index = qCtrl.getAchievements().getDifficulty();
final List<QuestEventDuel> duelOpponents = new ArrayList<>();
if (moreDuelChoices) {
if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.EASY, 3);
addRandomDuel(duelOpponents, QuestEventDifficulty.EASY);
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.EASY, 2);
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 2);
addRandomDuel(duelOpponents, QuestEventDifficulty.MEDIUM);
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 3);
addDuel(duelOpponents, QuestEventDifficulty.EASY, 1);
addRandomDuel(duelOpponents, QuestEventDifficulty.MEDIUM);
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 2);
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
addRandomDuel(duelOpponents, QuestEventDifficulty.HARD);
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_EXPERTAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.HARD, 3);
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 1);
addDuel(duelOpponents, QuestEventDifficulty.EASY, 1);
addRandomDuel(duelOpponents, QuestEventDifficulty.HARD);
} else {
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
addDuel(duelOpponents, QuestEventDifficulty.EXPERT, 1);
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 1);
addDuel(duelOpponents, QuestEventDifficulty.EASY, 1);
if (Math.random() * 3 < 2) {
addRandomDuel(duelOpponents, QuestEventDifficulty.HARD);
} else {
addRandomDuel(duelOpponents, QuestEventDifficulty.EXPERT);
}
}
} else {
if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
addDuel(duelOpponents, QuestEventDifficulty.EASY, 3);
addRandomDuel(duelOpponents, QuestEventDifficulty.EASY);
@@ -183,6 +219,7 @@ public class QuestEventDuelManager {
addRandomDuel(duelOpponents, QuestEventDifficulty.EXPERT);
}
}
}
return duelOpponents;

View File

@@ -162,6 +162,8 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
SHOP_MAX_SELLING_PRICE("1000"),
// Wins until the selling price limit is removed
SHOP_WINS_FOR_NO_SELL_LIMIT("50"),
// Duels of the current difficulty only, or that and all difficulties below it?
MORE_DUEL_CHOICES("0"),
//The number of cards to keep before selling
PLAYSET_SIZE("4"),
@@ -316,6 +318,7 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
case SHOP_SINGLES_UNCOMMON:
case SHOP_SINGLES_RARE:
case SHOP_WINS_FOR_NO_SELL_LIMIT:
case MORE_DUEL_CHOICES:
default:
if (val < 0) {
return "Value too small (minimum 0).";