mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
New formula for unlock prices, minor checkstyle.
This commit is contained in:
@@ -61,12 +61,13 @@ public class QuestUtilUnlockSets {
|
|||||||
|
|
||||||
final ReadPriceList prices = new ReadPriceList();
|
final ReadPriceList prices = new ReadPriceList();
|
||||||
final Map<String, Integer> mapPrices = prices.getPriceList();
|
final Map<String, Integer> mapPrices = prices.getPriceList();
|
||||||
final List<ImmutablePair<CardEdition, Integer>> setPrices = new ArrayList<ImmutablePair<CardEdition,Integer>>();
|
final List<ImmutablePair<CardEdition, Integer>> setPrices = new ArrayList<ImmutablePair<CardEdition, Integer>>();
|
||||||
|
|
||||||
for (CardEdition ed : getUnlockableEditions(qData)) {
|
for (CardEdition ed : getUnlockableEditions(qData)) {
|
||||||
int price = 7500;
|
int price = 7500;
|
||||||
if (mapPrices.containsKey(ed.getName() + " Booster Pack")) {
|
if (mapPrices.containsKey(ed.getName() + " Booster Pack")) {
|
||||||
price = Math.max( 50 * mapPrices.get(ed.getName() + " Booster Pack"), 7500 );
|
price = Math.max(new Double(60 * Math.pow(Math.sqrt(mapPrices.get(ed.getName()
|
||||||
|
+ " Booster Pack")), 1.65)).intValue(), 7500);
|
||||||
}
|
}
|
||||||
setPrices.add(ImmutablePair.of(ed, price));
|
setPrices.add(ImmutablePair.of(ed, price));
|
||||||
}
|
}
|
||||||
@@ -82,13 +83,11 @@ public class QuestUtilUnlockSets {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ImmutablePair<CardEdition, Integer> toBuy = setPrices.get(index);
|
ImmutablePair<CardEdition, Integer> toBuy = setPrices.get(index);
|
||||||
|
|
||||||
int price = toBuy.right;
|
int price = toBuy.right;
|
||||||
CardEdition choosenEdition = toBuy.left;
|
CardEdition choosenEdition = toBuy.left;
|
||||||
|
|
||||||
|
|
||||||
if (qData.getAssets().getCredits() < price) {
|
if (qData.getAssets().getCredits() < price) {
|
||||||
JOptionPane.showMessageDialog(null, "Unfortunately, you cannot afford that set yet.\n"
|
JOptionPane.showMessageDialog(null, "Unfortunately, you cannot afford that set yet.\n"
|
||||||
+ "To unlock " + choosenEdition.getName() + ", you need " + price + " credits.\n"
|
+ "To unlock " + choosenEdition.getName() + ", you need " + price + " credits.\n"
|
||||||
@@ -135,14 +134,15 @@ public class QuestUtilUnlockSets {
|
|||||||
Collections.sort(excludedSets);
|
Collections.sort(excludedSets);
|
||||||
|
|
||||||
// get a number of sets between an excluded and any included set
|
// get a number of sets between an excluded and any included set
|
||||||
List<ImmutablePair<CardEdition, Integer>> excludedWithDistances = new ArrayList<ImmutablePair<CardEdition,Integer>>();
|
List<ImmutablePair<CardEdition, Integer>> excludedWithDistances = new ArrayList<ImmutablePair<CardEdition, Integer>>();
|
||||||
for(CardEdition ex : excludedSets) {
|
for (CardEdition ex : excludedSets) {
|
||||||
int distance = Integer.MAX_VALUE;
|
int distance = Integer.MAX_VALUE;
|
||||||
for(CardEdition in : allowedSets) {
|
for (CardEdition in : allowedSets) {
|
||||||
int d = Math.abs(ex.getIndex() - in.getIndex());
|
int d = Math.abs(ex.getIndex() - in.getIndex());
|
||||||
if ( d < distance )
|
if (d < distance) {
|
||||||
distance = d;
|
distance = d;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
excludedWithDistances.add(ImmutablePair.of(ex, distance));
|
excludedWithDistances.add(ImmutablePair.of(ex, distance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user