Introduced 2 quest preferences for the multiplier and the number of wild

opponents
This commit is contained in:
Alessandro Coli
2020-09-27 14:14:12 +02:00
parent 72ee7dfeb3
commit 1382952d76
7 changed files with 48 additions and 9 deletions

View File

@@ -119,4 +119,8 @@ public abstract class PreferencesStore<T extends Enum<T>> {
public final boolean getPrefBoolean(final T fp0) {
return Boolean.parseBoolean(getPref(fp0));
}
public final double getPrefDouble(final T fp0) {
return Double.parseDouble(getPref(fp0));
}
}

View File

@@ -188,7 +188,7 @@ public class MainWorldEventDuelManager implements QuestEventDuelManagerInterface
}
//TODO put in preferences the number of wild duels to add
addDuel(duelOpponents, QuestEventDifficulty.WILD, 3);
addDuel(duelOpponents, QuestEventDifficulty.WILD, FModel.getQuestPreferences().getPrefInt(QPref.WILD_OPPONENTS_NUMBER));
addRandomDuel(duelOpponents, randomDuelDifficulty);
return duelOpponents;

View File

@@ -2,6 +2,9 @@ package forge.quest;
import org.apache.commons.lang3.StringUtils;
import forge.model.FModel;
import forge.quest.data.QuestPreferences.QPref;
/**
* TODO: Write javadoc for this type.
*
@@ -11,7 +14,7 @@ public enum QuestEventDifficulty {
MEDIUM("medium", 1.5),
HARD ("hard", 2. ),
EXPERT("very hard", 3. ),
WILD("wild", 2. );
WILD("wild", FModel.getQuestPreferences().getPrefDouble(QPref.WILD_OPPONENTS_MULTIPLIER) );
private final String inFile;
private final double multiplier;

View File

@@ -19,6 +19,7 @@ package forge.quest.data;
import forge.properties.ForgeConstants;
import forge.properties.PreferencesStore;
import forge.util.Localizer;
import forge.util.TextUtil;
import java.io.Serializable;
@@ -173,6 +174,8 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
SHOP_WINS_FOR_NO_SELL_LIMIT("50"),
// Duels of the current difficulty only, or that and all difficulties below it?
MORE_DUEL_CHOICES("0"),
WILD_OPPONENTS_MULTIPLIER("2.0"),
WILD_OPPONENTS_NUMBER("0"),
//The number of cards to keep before selling
PLAYSET_SIZE("4"),
@@ -313,6 +316,11 @@ public class QuestPreferences extends PreferencesStore<QuestPreferences.QPref> i
return "Value too small (minimum 1).";
}
break;
case WILD_OPPONENTS_NUMBER:
if(val < 0 || val > 3) {
return Localizer.getInstance().getMessage("lblWildOpponentNumberError");
}
break;
case BOOSTER_COMMONS:
case BOOSTER_UNCOMMONS:
case BOOSTER_RARES: