mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Fix issue that preventing starting quest mode if there was a flaw in the price list
This commit is contained in:
@@ -33,8 +33,7 @@ import forge.util.ItemPool;
|
|||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
|
|
||||||
public class QuestSpellShop {
|
public class QuestSpellShop {
|
||||||
private static final ReadPriceList r = new ReadPriceList();
|
private static Map<String, Integer> mapPrices;
|
||||||
private static final Map<String, Integer> mapPrices = r.getPriceList();
|
|
||||||
private static double multiplier;
|
private static double multiplier;
|
||||||
private static ItemPool<InventoryItem> decksUsingMyCards;
|
private static ItemPool<InventoryItem> decksUsingMyCards;
|
||||||
|
|
||||||
@@ -47,13 +46,18 @@ public class QuestSpellShop {
|
|||||||
if (card instanceof PaperCard) {
|
if (card instanceof PaperCard) {
|
||||||
ns = card.getName() + "|" + ((PaperCard) card).getEdition();
|
ns = card.getName() + "|" + ((PaperCard) card).getEdition();
|
||||||
foil = ((PaperCard) card).isFoil();
|
foil = ((PaperCard) card).isFoil();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ns = card.getName();
|
ns = card.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mapPrices == null) { //initialize price map if not already done
|
||||||
|
mapPrices = new ReadPriceList().getPriceList();
|
||||||
|
}
|
||||||
if (mapPrices.containsKey(ns)) {
|
if (mapPrices.containsKey(ns)) {
|
||||||
value = mapPrices.get(ns);
|
value = mapPrices.get(ns);
|
||||||
} else if (card instanceof PaperCard) {
|
}
|
||||||
|
else if (card instanceof PaperCard) {
|
||||||
switch (((IPaperCard) card).getRarity()) {
|
switch (((IPaperCard) card).getRarity()) {
|
||||||
case BasicLand:
|
case BasicLand:
|
||||||
value = 4;
|
value = 4;
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ public class ReadPriceList {
|
|||||||
private void setup() {
|
private void setup() {
|
||||||
this.priceMap = this.readFile(ForgeConstants.QUEST_CARD_PRICE_FILE);
|
this.priceMap = this.readFile(ForgeConstants.QUEST_CARD_PRICE_FILE);
|
||||||
this.priceMap.putAll(this.readFile(ForgeConstants.PRICES_BOOSTER_FILE));
|
this.priceMap.putAll(this.readFile(ForgeConstants.PRICES_BOOSTER_FILE));
|
||||||
|
|
||||||
} // setup()
|
} // setup()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,6 +86,8 @@ public class ReadPriceList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String[] s = line.split("=");
|
final String[] s = line.split("=");
|
||||||
|
if (s.length < 2) { continue; } //skip line if not in correct format
|
||||||
|
|
||||||
final String name = s[0].trim();
|
final String name = s[0].trim();
|
||||||
final String price = s[1].trim();
|
final String price = s[1].trim();
|
||||||
|
|
||||||
@@ -97,7 +98,8 @@ public class ReadPriceList {
|
|||||||
float ff = 0;
|
float ff = 0;
|
||||||
if (r.nextInt(100) < 90) {
|
if (r.nextInt(100) < 90) {
|
||||||
ff = r.nextInt(10) * (float) .01;
|
ff = r.nextInt(10) * (float) .01;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// +/- 50%
|
// +/- 50%
|
||||||
ff = r.nextInt(50) * (float) .01;
|
ff = r.nextInt(50) * (float) .01;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user