mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Start working on Booster logic for Planar Conquest
This commit is contained in:
@@ -529,5 +529,93 @@ public class ConquestController {
|
||||
}
|
||||
|
||||
private void awardBooster(final IWinLoseView<? extends IButton> view) {
|
||||
Iterable<PaperCard> cardPool = gameRunner.commander.getDeployedRegion().getCardPool().getAllCards();
|
||||
|
||||
int newCommonCount = 0;
|
||||
int newUncommonCount = 0;
|
||||
int newRareCount = 0;
|
||||
int newMythicCount = 0;
|
||||
List<PaperCard> commons = new ArrayList<PaperCard>();
|
||||
List<PaperCard> uncommons = new ArrayList<PaperCard>();
|
||||
List<PaperCard> rares = new ArrayList<PaperCard>();
|
||||
List<PaperCard> mythics = new ArrayList<PaperCard>();
|
||||
|
||||
for (PaperCard c : cardPool) {
|
||||
switch (c.getRarity()) {
|
||||
case Common:
|
||||
commons.add(c);
|
||||
break;
|
||||
case Uncommon:
|
||||
uncommons.add(c);
|
||||
break;
|
||||
case Rare:
|
||||
rares.add(c);
|
||||
break;
|
||||
case MythicRare:
|
||||
mythics.add(c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ConquestPreferences prefs = FModel.getConquestPreferences();
|
||||
|
||||
int boostersPerMythic = prefs.getPrefInt(CQPref.BOOSTERS_PER_MYTHIC);
|
||||
int count = prefs.getPrefInt(CQPref.BOOSTER_RARES);
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (Aggregates.randomInt(1, boostersPerMythic) == 1) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int uncommonCount = prefs.getPrefInt(CQPref.BOOSTER_UNCOMMONS);
|
||||
|
||||
count = prefs.getPrefInt(CQPref.BOOSTER_COMMONS);
|
||||
int commonReroll = prefs.getPrefInt(CQPref.BOOSTER_COMMON_REROLL);
|
||||
int uncommonReroll = prefs.getPrefInt(CQPref.BOOSTER_COMMON_REROLL);
|
||||
int rareReroll = prefs.getPrefInt(CQPref.BOOSTER_COMMON_REROLL);
|
||||
int mythicReroll = prefs.getPrefInt(CQPref.BOOSTER_MYTHIC_REROLL);
|
||||
|
||||
}
|
||||
|
||||
private class BoosterPool {
|
||||
private final int rerollChance;
|
||||
private int newCount = 0;
|
||||
private final List<PaperCard> cards = new ArrayList<PaperCard>();
|
||||
|
||||
private BoosterPool(int rerollChance0) {
|
||||
rerollChance = rerollChance0;
|
||||
}
|
||||
|
||||
private boolean isEmpty() {
|
||||
return cards.isEmpty();
|
||||
}
|
||||
|
||||
private void add(PaperCard c) {
|
||||
if (!model.getCollection().contains(c)) {
|
||||
newCount++;
|
||||
}
|
||||
cards.add(c);
|
||||
}
|
||||
|
||||
private PaperCard rewardCard() {
|
||||
PaperCard c;
|
||||
while (true) {
|
||||
int index = Aggregates.randomInt(0, cards.size() - 1);
|
||||
c = cards.get(index);
|
||||
|
||||
//break out if new, if no new remaining, or if reroll chance fails
|
||||
if (newCount == 0 || !model.getCollection().contains(c) ||
|
||||
Aggregates.randomInt(1, 100) > rerollChance) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
cards.remove(c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,14 @@ public class ConquestPreferences extends PreferencesStore<ConquestPreferences.CQ
|
||||
PERCENT_PLANECHASE("25"),
|
||||
PERCENT_DOUBLE_VARIANT("25"),
|
||||
|
||||
// How many of each rarity comes in a won booster pack
|
||||
BOOSTER_COMMONS("11"),
|
||||
BOOSTER_UNCOMMONS("3"),
|
||||
BOOSTER_RARES("1"),
|
||||
BOOSTERS_PER_MYTHIC("8"),
|
||||
BOOSTER_COMMON_REROLL("10"),
|
||||
BOOSTER_UNCOMMON_REROLL("25"),
|
||||
BOOSTER_RARE_REROLL("50"),
|
||||
BOOSTER_MYTHIC_REROLL("100"),
|
||||
|
||||
RECRUIT_BONUS_CARD_ODDS("25"),
|
||||
STUDY_BONUS_CARD_ODDS("25"),
|
||||
@@ -167,9 +171,22 @@ public class ConquestPreferences extends PreferencesStore<ConquestPreferences.CQ
|
||||
return "Booster packs must have maximum 15 cards.";
|
||||
}
|
||||
break;
|
||||
case BOOSTERS_PER_MYTHIC:
|
||||
if (val + getPrefInt(CQPref.BOOSTER_COMMONS) + getPrefInt(CQPref.BOOSTER_UNCOMMONS) > 15) {
|
||||
return "Booster packs must have maximum 15 cards.";
|
||||
}
|
||||
break;
|
||||
case BOOSTER_COMMON_REROLL:
|
||||
case BOOSTER_UNCOMMON_REROLL:
|
||||
case BOOSTER_RARE_REROLL:
|
||||
case BOOSTER_MYTHIC_REROLL:
|
||||
if (val > 100) {
|
||||
return "Booster reroll chance must be between 0% and 100%.";
|
||||
}
|
||||
break;
|
||||
case RECRUIT_BONUS_CARD_ODDS:
|
||||
case STUDY_BONUS_CARD_ODDS:
|
||||
if (val > 50) {
|
||||
if (val > 100) {
|
||||
return "Bonus card odds must be between 0% and 50%.";
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user