mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Added fallback for quest match rewards when no boosters are in the selected sets.
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
@@ -14,10 +10,14 @@ import forge.item.SealedProduct;
|
|||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
import forge.util.storage.StorageBase;
|
import forge.util.storage.StorageBase;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding game invariants, such as cards, editions, game formats. All that data, which is not supposed to be changed by player
|
* The class holding game invariants, such as cards, editions, game formats. All that data, which is not supposed to be changed by player
|
||||||
*
|
*
|
||||||
* @author Max
|
* @author Max
|
||||||
*/
|
*/
|
||||||
public class StaticData {
|
public class StaticData {
|
||||||
@@ -37,8 +37,8 @@ public class StaticData {
|
|||||||
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
this.editions = new CardEdition.Collection(new CardEdition.Reader(new File(editionFolder)));
|
||||||
lastInstance = this;
|
lastInstance = this;
|
||||||
|
|
||||||
final Map<String, CardRules> regularCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
final Map<String, CardRules> regularCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
final Map<String, CardRules> variantsCards = new TreeMap<String, CardRules>(String.CASE_INSENSITIVE_ORDER);
|
final Map<String, CardRules> variantsCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
for (CardRules card : reader.loadCards()) {
|
for (CardRules card : reader.loadCards()) {
|
||||||
if (null == card) continue;
|
if (null == card) continue;
|
||||||
@@ -59,15 +59,15 @@ public class StaticData {
|
|||||||
commonCards.initialize(false, false);
|
commonCards.initialize(false, false);
|
||||||
variantCards.initialize(false, false);
|
variantCards.initialize(false, false);
|
||||||
|
|
||||||
this.boosters = new StorageBase<SealedProduct.Template>("Boosters", editions.getBoosterGenerator());
|
this.boosters = new StorageBase<>("Boosters", editions.getBoosterGenerator());
|
||||||
this.specialBoosters = new StorageBase<SealedProduct.Template>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
this.specialBoosters = new StorageBase<>("Special boosters", new SealedProduct.Template.Reader(new File(blockDataFolder, "boosters-special.txt")));
|
||||||
this.tournaments = new StorageBase<SealedProduct.Template>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
this.tournaments = new StorageBase<>("Starter sets", new SealedProduct.Template.Reader(new File(blockDataFolder, "starters.txt")));
|
||||||
this.fatPacks = new StorageBase<FatPack.Template>("Fat packs", new FatPack.Template.Reader(blockDataFolder + "fatpacks.txt"));
|
this.fatPacks = new StorageBase<>("Fat packs", new FatPack.Template.Reader(blockDataFolder + "fatpacks.txt"));
|
||||||
this.boosterBoxes = new StorageBase<BoosterBox.Template>("Booster boxes", new BoosterBox.Template.Reader(blockDataFolder + "boosterboxes.txt"));
|
this.boosterBoxes = new StorageBase<>("Booster boxes", new BoosterBox.Template.Reader(blockDataFolder + "boosterboxes.txt"));
|
||||||
this.printSheets = new StorageBase<PrintSheet>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
this.printSheets = new StorageBase<>("Special print runs", new PrintSheet.Reader(new File(blockDataFolder, "printsheets.txt")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static StaticData instance() {
|
public static StaticData instance() {
|
||||||
return lastInstance;
|
return lastInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,21 +75,21 @@ public class StaticData {
|
|||||||
return this.editions;
|
return this.editions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.item.FatPackTemplate}> */
|
/** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */
|
||||||
public IStorage<FatPack.Template> getFatPacks() {
|
public IStorage<FatPack.Template> getFatPacks() {
|
||||||
return fatPacks;
|
return fatPacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IStorage<BoosterBox.Template> getBoosterBoxes() {
|
public IStorage<BoosterBox.Template> getBoosterBoxes() {
|
||||||
return boosterBoxes;
|
return boosterBoxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */
|
||||||
public final IStorage<SealedProduct.Template> getTournamentPacks() {
|
public final IStorage<SealedProduct.Template> getTournamentPacks() {
|
||||||
return tournaments;
|
return tournaments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.util.storage.IStorageView}<{@link forge.card.BoosterTemplate}> */
|
/** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */
|
||||||
public final IStorage<SealedProduct.Template> getBoosters() {
|
public final IStorage<SealedProduct.Template> getBoosters() {
|
||||||
return boosters;
|
return boosters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
|
|
||||||
private final SealedProduct.Template tpl;
|
private final SealedProduct.Template tpl;
|
||||||
private final Map<String, PrintSheet> sheets;
|
private final Map<String, PrintSheet> sheets;
|
||||||
private boolean poolLimited = false; // if true after successful generation cards are removed from printsheets.
|
private boolean poolLimited = false; // if true after successful generation cards are removed from printsheets.
|
||||||
|
|
||||||
public final boolean isPoolLimited() {
|
public final boolean isPoolLimited() {
|
||||||
return poolLimited;
|
return poolLimited;
|
||||||
@@ -27,7 +27,7 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
public final void setLimitedPool(boolean considerNumbersInPool) {
|
public final void setLimitedPool(boolean considerNumbersInPool) {
|
||||||
this.poolLimited = considerNumbersInPool; // TODO: Add 0 to parameter's name.
|
this.poolLimited = considerNumbersInPool; // TODO: Add 0 to parameter's name.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Means to select from all unique cards (from base game, ie. no schemes or avatars)
|
// Means to select from all unique cards (from base game, ie. no schemes or avatars)
|
||||||
public UnOpenedProduct(SealedProduct.Template template) {
|
public UnOpenedProduct(SealedProduct.Template template) {
|
||||||
@@ -42,7 +42,7 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
|
|
||||||
public UnOpenedProduct(SealedProduct.Template template, Iterable<PaperCard> cards) {
|
public UnOpenedProduct(SealedProduct.Template template, Iterable<PaperCard> cards) {
|
||||||
tpl = template;
|
tpl = template;
|
||||||
sheets = new TreeMap<String, PrintSheet>();
|
sheets = new TreeMap<>();
|
||||||
prebuildSheets(cards);
|
prebuildSheets(cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,15 +62,15 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If they request cards from an arbitrary pool, there's no use to cache printsheets.
|
// If they request cards from an arbitrary pool, there's no use to cache printsheets.
|
||||||
private final List<PaperCard> getBoosterPack() {
|
private List<PaperCard> getBoosterPack() {
|
||||||
List<PaperCard> result = new ArrayList<PaperCard>();
|
List<PaperCard> result = new ArrayList<>();
|
||||||
for(Pair<String, Integer> slot : tpl.getSlots()) {
|
for(Pair<String, Integer> slot : tpl.getSlots()) {
|
||||||
PrintSheet ps = sheets.get(slot.getLeft());
|
PrintSheet ps = sheets.get(slot.getLeft());
|
||||||
if(ps.isEmpty() && poolLimited ) {
|
if(ps.isEmpty() && poolLimited ) {
|
||||||
throw new IllegalStateException("The cardpool has been depleted and has no more cards for slot " + slot.getKey());
|
throw new IllegalStateException("The cardpool has been depleted and has no more cards for slot " + slot.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PaperCard> foundCards = ps.random(slot.getRight().intValue(), true);
|
List<PaperCard> foundCards = ps.random(slot.getRight(), true);
|
||||||
if(poolLimited)
|
if(poolLimited)
|
||||||
ps.removeAll(foundCards);
|
ps.removeAll(foundCards);
|
||||||
result.addAll(foundCards);
|
result.addAll(foundCards);
|
||||||
@@ -79,4 +79,3 @@ public class UnOpenedProduct implements IUnOpenedProduct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
package forge.quest;
|
package forge.quest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import forge.LobbyPlayer;
|
import forge.LobbyPlayer;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
|
import forge.card.BoosterSlots;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.IUnOpenedProduct;
|
import forge.card.IUnOpenedProduct;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
@@ -22,11 +17,8 @@ import forge.game.player.PlayerStatistics;
|
|||||||
import forge.game.player.PlayerView;
|
import forge.game.player.PlayerView;
|
||||||
import forge.interfaces.IButton;
|
import forge.interfaces.IButton;
|
||||||
import forge.interfaces.IWinLoseView;
|
import forge.interfaces.IWinLoseView;
|
||||||
import forge.item.BoosterPack;
|
import forge.item.*;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.IPaperCard.Predicates;
|
||||||
import forge.item.PaperCard;
|
|
||||||
import forge.item.SealedProduct;
|
|
||||||
import forge.item.TournamentPack;
|
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.GamePlayerUtil;
|
import forge.player.GamePlayerUtil;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -36,6 +28,13 @@ import forge.quest.data.QuestPreferences.DifficultyPrefs;
|
|||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import forge.util.gui.SGuiChoose;
|
import forge.util.gui.SGuiChoose;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class QuestWinLoseController {
|
public class QuestWinLoseController {
|
||||||
private final GameView lastGame;
|
private final GameView lastGame;
|
||||||
@@ -212,11 +211,11 @@ public class QuestWinLoseController {
|
|||||||
// TODO use q.qdPrefs to write bonus credits in prefs file
|
// TODO use q.qdPrefs to write bonus credits in prefs file
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
int credTotal = 0;
|
int credTotal;
|
||||||
int credBase = 0;
|
int credBase;
|
||||||
int credGameplay = 0;
|
int credGameplay = 0;
|
||||||
int credUndefeated = 0;
|
int credUndefeated = 0;
|
||||||
int credEstates = 0;
|
int credEstates;
|
||||||
|
|
||||||
// Basic win bonus
|
// Basic win bonus
|
||||||
final int base = FModel.getQuestPreferences().getPrefInt(QPref.REWARDS_BASE);
|
final int base = FModel.getQuestPreferences().getPrefInt(QPref.REWARDS_BASE);
|
||||||
@@ -391,7 +390,7 @@ public class QuestWinLoseController {
|
|||||||
*/
|
*/
|
||||||
private void awardRandomRare(final String message) {
|
private void awardRandomRare(final String message) {
|
||||||
final PaperCard c = qData.getCards().addRandomRare();
|
final PaperCard c = qData.getCards().addRandomRare();
|
||||||
final List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
final List<PaperCard> cardsWon = new ArrayList<>();
|
||||||
cardsWon.add(c);
|
cardsWon.add(c);
|
||||||
|
|
||||||
view.showCards(message, cardsWon);
|
view.showCards(message, cardsWon);
|
||||||
@@ -409,7 +408,7 @@ public class QuestWinLoseController {
|
|||||||
|
|
||||||
final List<PaperCard> cardsWon = new ArrayList<>();
|
final List<PaperCard> cardsWon = new ArrayList<>();
|
||||||
List<PaperCard> cardsToAdd;
|
List<PaperCard> cardsToAdd;
|
||||||
String typeWon = "";
|
String typeWon;
|
||||||
boolean addDraftToken = false;
|
boolean addDraftToken = false;
|
||||||
|
|
||||||
switch (currentStreak) {
|
switch (currentStreak) {
|
||||||
@@ -466,7 +465,7 @@ public class QuestWinLoseController {
|
|||||||
qData.getAchievements().addDraftToken();
|
qData.getAchievements().addDraftToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardsWon.size() > 0) {
|
if (!cardsWon.isEmpty()) {
|
||||||
view.showCards("You have achieved a " + (currentStreak == 0 ? "50" : currentStreak) + " win streak and won " + cardsWon.size() + " " + typeWon + " card" + ((cardsWon.size() != 1) ? "s" : "") + "!", cardsWon);
|
view.showCards("You have achieved a " + (currentStreak == 0 ? "50" : currentStreak) + " win streak and won " + cardsWon.size() + " " + typeWon + " card" + ((cardsWon.size() != 1) ? "s" : "") + "!", cardsWon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,11 +490,12 @@ public class QuestWinLoseController {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void awardBooster() {
|
private void awardBooster() {
|
||||||
List<PaperCard> cardsWon = null;
|
List<PaperCard> cardsWon;
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
if (qData.getFormat() == null) {
|
if (qData.getFormat() == null) {
|
||||||
final List<GameFormat> formats = new ArrayList<GameFormat>();
|
|
||||||
|
final List<GameFormat> formats = new ArrayList<>();
|
||||||
final String preferredFormat = FModel.getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
|
final String preferredFormat = FModel.getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
|
||||||
|
|
||||||
GameFormat pref = null;
|
GameFormat pref = null;
|
||||||
@@ -515,9 +515,10 @@ public class QuestWinLoseController {
|
|||||||
qData.getCards().addAllCards(cardsWon);
|
qData.getCards().addAllCards(cardsWon);
|
||||||
|
|
||||||
title = "Bonus booster pack from the \"" + selected.getName() + "\" format!";
|
title = "Bonus booster pack from the \"" + selected.getName() + "\" format!";
|
||||||
}
|
|
||||||
else {
|
} else {
|
||||||
final List<String> sets = new ArrayList<String>();
|
|
||||||
|
final List<String> sets = new ArrayList<>();
|
||||||
|
|
||||||
for (final SealedProduct.Template bd : FModel.getMagicDb().getBoosters()) {
|
for (final SealedProduct.Template bd : FModel.getMagicDb().getBoosters()) {
|
||||||
if (bd != null && qData.getFormat().isSetLegal(bd.getEdition())) {
|
if (bd != null && qData.getFormat().isSetLegal(bd.getEdition())) {
|
||||||
@@ -525,6 +526,19 @@ public class QuestWinLoseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean customBooster = false;
|
||||||
|
|
||||||
|
//No boosters found for current quest settings
|
||||||
|
if (sets.isEmpty()) {
|
||||||
|
customBooster = true;
|
||||||
|
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
||||||
|
for (CardEdition edition : editions) {
|
||||||
|
if (qData.getFormat().isSetLegal(edition.getCode())) {
|
||||||
|
sets.add(edition.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int maxChoices = 1;
|
int maxChoices = 1;
|
||||||
if (wonMatch) {
|
if (wonMatch) {
|
||||||
maxChoices++;
|
maxChoices++;
|
||||||
@@ -535,7 +549,7 @@ public class QuestWinLoseController {
|
|||||||
maxChoices += qData.getAssets().getItemLevel(QuestItemType.MEMBERSHIP_TOKEN);
|
maxChoices += qData.getAssets().getItemLevel(QuestItemType.MEMBERSHIP_TOKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<CardEdition> options = new ArrayList<CardEdition>();
|
final List<CardEdition> options = new ArrayList<>();
|
||||||
|
|
||||||
while (!sets.isEmpty() && maxChoices > 0) {
|
while (!sets.isEmpty() && maxChoices > 0) {
|
||||||
final int ix = MyRandom.getRandom().nextInt(sets.size());
|
final int ix = MyRandom.getRandom().nextInt(sets.size());
|
||||||
@@ -547,10 +561,18 @@ public class QuestWinLoseController {
|
|||||||
|
|
||||||
final CardEdition chooseEd = SGuiChoose.one("Choose bonus booster set", options);
|
final CardEdition chooseEd = SGuiChoose.one("Choose bonus booster set", options);
|
||||||
|
|
||||||
final IUnOpenedProduct product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode()));
|
if (customBooster) {
|
||||||
cardsWon = product.get();
|
List<PaperCard> cards = FModel.getMagicDb().getCommonCards().getAllCards(Predicates.printedInSet(chooseEd.getCode()));
|
||||||
|
final IUnOpenedProduct product = new UnOpenedProduct(getBoosterTemplate(), cards);
|
||||||
|
cardsWon = product.get();
|
||||||
|
} else {
|
||||||
|
final IUnOpenedProduct product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode()));
|
||||||
|
cardsWon = product.get();
|
||||||
|
}
|
||||||
|
|
||||||
qData.getCards().addAllCards(cardsWon);
|
qData.getCards().addAllCards(cardsWon);
|
||||||
title = "Bonus " + chooseEd.getName() + " booster pack!";
|
title = "Bonus " + chooseEd.getName() + " booster pack!";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cardsWon != null) {
|
if (cardsWon != null) {
|
||||||
@@ -559,6 +581,14 @@ public class QuestWinLoseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SealedProduct.Template getBoosterTemplate() {
|
||||||
|
return new SealedProduct.Template(ImmutableList.of(
|
||||||
|
Pair.of(BoosterSlots.COMMON, FModel.getQuestPreferences().getPrefInt(QPref.BOOSTER_COMMONS)),
|
||||||
|
Pair.of(BoosterSlots.UNCOMMON, FModel.getQuestPreferences().getPrefInt(QPref.BOOSTER_UNCOMMONS)),
|
||||||
|
Pair.of(BoosterSlots.RARE_MYTHIC, FModel.getQuestPreferences().getPrefInt(QPref.BOOSTER_RARES))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* awardChallengeWin.
|
* awardChallengeWin.
|
||||||
@@ -571,11 +601,11 @@ public class QuestWinLoseController {
|
|||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Challenge completed.\n\n");
|
sb.append("Challenge completed.\n\n");
|
||||||
sb.append("Challenge bounty: " + questRewardCredits + " credits.");
|
sb.append("Challenge bounty: ").append(questRewardCredits).append(" credits.");
|
||||||
|
|
||||||
qData.getAssets().addCredits(questRewardCredits);
|
qData.getAssets().addCredits(questRewardCredits);
|
||||||
|
|
||||||
view.showMessage(sb.toString(), "Challenge Rewards for \"" + ((QuestEventChallenge) qEvent).getTitle() + "\"", FSkinProp.ICO_QUEST_BOX);
|
view.showMessage(sb.toString(), "Challenge Rewards for \"" + qEvent.getTitle() + "\"", FSkinProp.ICO_QUEST_BOX);
|
||||||
|
|
||||||
awardSpecialReward(null);
|
awardSpecialReward(null);
|
||||||
}
|
}
|
||||||
@@ -594,20 +624,19 @@ public class QuestWinLoseController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<PaperCard> cardsWon = new ArrayList<PaperCard>();
|
final List<PaperCard> cardsWon = new ArrayList<>();
|
||||||
|
|
||||||
for (final InventoryItem ii : itemsWon) {
|
for (final InventoryItem ii : itemsWon) {
|
||||||
if (ii instanceof PaperCard) {
|
if (ii instanceof PaperCard) {
|
||||||
cardsWon.add((PaperCard) ii);
|
cardsWon.add((PaperCard) ii);
|
||||||
}
|
}
|
||||||
else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
|
else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
|
||||||
final List<PaperCard> boosterCards = new ArrayList<PaperCard>();
|
final List<PaperCard> boosterCards = new ArrayList<>();
|
||||||
SealedProduct booster = null;
|
SealedProduct booster;
|
||||||
if (ii instanceof BoosterPack) {
|
if (ii instanceof BoosterPack) {
|
||||||
booster = (BoosterPack) ((BoosterPack) ii).clone();
|
booster = (BoosterPack) ((BoosterPack) ii).clone();
|
||||||
boosterCards.addAll(booster.getCards());
|
boosterCards.addAll(booster.getCards());
|
||||||
}
|
} else {
|
||||||
else if (ii instanceof TournamentPack) {
|
|
||||||
booster = (TournamentPack) ((TournamentPack) ii).clone();
|
booster = (TournamentPack) ((TournamentPack) ii).clone();
|
||||||
boosterCards.addAll(booster.getCards());
|
boosterCards.addAll(booster.getCards());
|
||||||
}
|
}
|
||||||
@@ -618,7 +647,7 @@ public class QuestWinLoseController {
|
|||||||
}
|
}
|
||||||
else if (ii instanceof IQuestRewardCard) {
|
else if (ii instanceof IQuestRewardCard) {
|
||||||
final List<PaperCard> cardChoices = ((IQuestRewardCard) ii).getChoices();
|
final List<PaperCard> cardChoices = ((IQuestRewardCard) ii).getChoices();
|
||||||
final PaperCard chosenCard = (null == cardChoices ? null : SGuiChoose.one("Choose " + ((IQuestRewardCard) ii).getName(), cardChoices));
|
final PaperCard chosenCard = (null == cardChoices ? null : SGuiChoose.one("Choose " + ii.getName(), cardChoices));
|
||||||
if (null != chosenCard) {
|
if (null != chosenCard) {
|
||||||
cardsWon.add(chosenCard);
|
cardsWon.add(chosenCard);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user