mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Merge branch 'questMode_wildOpponents' into 'master'
Wild opponents included in the "random duel choice" See merge request core-developers/forge!3226
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package forge.quest;
|
package forge.quest;
|
||||||
|
|
||||||
|
import java.awt.image.renderable.RenderableImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -147,31 +148,60 @@ public class MainWorldEventDuelManager implements QuestEventDuelManagerInterface
|
|||||||
|
|
||||||
QuestEventDifficulty randomDuelDifficulty = QuestEventDifficulty.EASY;
|
QuestEventDifficulty randomDuelDifficulty = QuestEventDifficulty.EASY;
|
||||||
|
|
||||||
|
double randomDouble = MyRandom.getRandom().nextDouble();
|
||||||
|
|
||||||
if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
|
if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.EASY, 3);
|
addDuel(duelOpponents, QuestEventDifficulty.EASY, 3);
|
||||||
randomDuelDifficulty = QuestEventDifficulty.EASY;
|
if(areWildDecksWanted() && isWildDeckAvailable() && randomDouble * 2 < 1) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.WILD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.EASY;
|
||||||
|
}
|
||||||
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
|
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_MEDIUMAI, index)) {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.EASY, 1);
|
addDuel(duelOpponents, QuestEventDifficulty.EASY, 1);
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 2);
|
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 2);
|
||||||
randomDuelDifficulty = QuestEventDifficulty.MEDIUM;
|
if(areWildDecksWanted() && isWildDeckAvailable() && randomDouble * 2 < 1) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.WILD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.MEDIUM;
|
||||||
|
}
|
||||||
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
|
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 3);
|
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 3);
|
||||||
randomDuelDifficulty = QuestEventDifficulty.MEDIUM;
|
randomDuelDifficulty = QuestEventDifficulty.MEDIUM;
|
||||||
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
|
} else if (numberOfWins == questPreferences.getPrefInt(DifficultyPrefs.WINS_HARDAI, index)) {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 1);
|
addDuel(duelOpponents, QuestEventDifficulty.MEDIUM, 1);
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
|
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
|
||||||
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
if(areWildDecksWanted() && isWildDeckAvailable() && randomDouble * 2 < 1) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.WILD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
||||||
|
}
|
||||||
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_EXPERTAI, index)) {
|
} else if (numberOfWins < questPreferences.getPrefInt(DifficultyPrefs.WINS_EXPERTAI, index)) {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.HARD, 3);
|
addDuel(duelOpponents, QuestEventDifficulty.HARD, 3);
|
||||||
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
if(areWildDecksWanted() && isWildDeckAvailable() && randomDouble * 2 < 1) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.WILD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
|
addDuel(duelOpponents, QuestEventDifficulty.HARD, 2);
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.EXPERT, 1);
|
addDuel(duelOpponents, QuestEventDifficulty.EXPERT, 1);
|
||||||
if (MyRandom.getRandom().nextDouble() * 3 < 2) {
|
if(areWildDecksWanted() && isWildDeckAvailable()) {
|
||||||
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
if(randomDouble * 2 < 1) {
|
||||||
} else {
|
randomDuelDifficulty = QuestEventDifficulty.WILD;
|
||||||
randomDuelDifficulty = QuestEventDifficulty.EXPERT;
|
} else if(randomDouble * 6 < 5) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.EXPERT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (randomDouble * 3 < 2) {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.HARD;
|
||||||
|
} else {
|
||||||
|
randomDuelDifficulty = QuestEventDifficulty.EXPERT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moreDuelChoices) {
|
if (moreDuelChoices) {
|
||||||
@@ -187,7 +217,7 @@ public class MainWorldEventDuelManager implements QuestEventDuelManagerInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO put in preferences the number of wild duels to add
|
// Now to add the wild opponents
|
||||||
addDuel(duelOpponents, QuestEventDifficulty.WILD, FModel.getQuestPreferences().getPrefInt(QPref.WILD_OPPONENTS_NUMBER));
|
addDuel(duelOpponents, QuestEventDifficulty.WILD, FModel.getQuestPreferences().getPrefInt(QPref.WILD_OPPONENTS_NUMBER));
|
||||||
addRandomDuel(duelOpponents, randomDuelDifficulty);
|
addRandomDuel(duelOpponents, randomDuelDifficulty);
|
||||||
|
|
||||||
@@ -195,6 +225,16 @@ public class MainWorldEventDuelManager implements QuestEventDuelManagerInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean areWildDecksWanted() {
|
||||||
|
int wildOpponentsPreference = FModel.getQuestPreferences().getPrefInt(QPref.WILD_OPPONENTS_NUMBER);
|
||||||
|
return wildOpponentsPreference > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isWildDeckAvailable() {
|
||||||
|
List<QuestEventDuel> wildList = (List<QuestEventDuel>) sortedDuels.get(QuestEventDifficulty.WILD);
|
||||||
|
return !wildList.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* assembleDuelDifficultyLists.
|
* assembleDuelDifficultyLists.
|
||||||
|
|||||||
Reference in New Issue
Block a user