v2.3.0: improved consistency of several consumable drop types
This commit is contained in:
@@ -224,6 +224,12 @@ public class Generator {
|
|||||||
//Artifacts in particular don't reset, no duplicates!
|
//Artifacts in particular don't reset, no duplicates!
|
||||||
public float[] probs;
|
public float[] probs;
|
||||||
public float[] defaultProbs = null;
|
public float[] defaultProbs = null;
|
||||||
|
|
||||||
|
//some items types have two decks and swap between them
|
||||||
|
// this enforces more consistency while still allowing for better precision
|
||||||
|
public float[] defaultProbs2 = null;
|
||||||
|
public boolean using2ndProbs = false;
|
||||||
|
|
||||||
//These variables are used as a part of the deck system, to ensure that drops are consistent
|
//These variables are used as a part of the deck system, to ensure that drops are consistent
|
||||||
// regardless of when they occur (either as part of seeded levelgen, or random item drops)
|
// regardless of when they occur (either as part of seeded levelgen, or random item drops)
|
||||||
public Long seed = null;
|
public Long seed = null;
|
||||||
@@ -271,7 +277,8 @@ public class Generator {
|
|||||||
PotionOfParalyticGas.class,
|
PotionOfParalyticGas.class,
|
||||||
PotionOfPurity.class,
|
PotionOfPurity.class,
|
||||||
PotionOfExperience.class};
|
PotionOfExperience.class};
|
||||||
POTION.defaultProbs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
|
POTION.defaultProbs = new float[]{ 0, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1 };
|
||||||
|
POTION.defaultProbs2 = new float[]{ 0, 3, 2, 2, 1, 2, 1, 1, 1, 1, 1, 0 };
|
||||||
POTION.probs = POTION.defaultProbs.clone();
|
POTION.probs = POTION.defaultProbs.clone();
|
||||||
|
|
||||||
SEED.classes = new Class<?>[]{
|
SEED.classes = new Class<?>[]{
|
||||||
@@ -287,7 +294,7 @@ public class Generator {
|
|||||||
Earthroot.Seed.class,
|
Earthroot.Seed.class,
|
||||||
Mageroyal.Seed.class,
|
Mageroyal.Seed.class,
|
||||||
Starflower.Seed.class};
|
Starflower.Seed.class};
|
||||||
SEED.defaultProbs = new float[]{ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2 };
|
SEED.defaultProbs = new float[]{ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 };
|
||||||
SEED.probs = SEED.defaultProbs.clone();
|
SEED.probs = SEED.defaultProbs.clone();
|
||||||
|
|
||||||
SCROLL.classes = new Class<?>[]{
|
SCROLL.classes = new Class<?>[]{
|
||||||
@@ -304,7 +311,8 @@ public class Generator {
|
|||||||
ScrollOfTerror.class,
|
ScrollOfTerror.class,
|
||||||
ScrollOfTransmutation.class
|
ScrollOfTransmutation.class
|
||||||
};
|
};
|
||||||
SCROLL.defaultProbs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
|
SCROLL.defaultProbs = new float[]{ 0, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1 };
|
||||||
|
SCROLL.defaultProbs2 = new float[]{ 0, 3, 2, 2, 1, 2, 1, 1, 1, 1, 1, 0 };
|
||||||
SCROLL.probs = SCROLL.defaultProbs.clone();
|
SCROLL.probs = SCROLL.defaultProbs.clone();
|
||||||
|
|
||||||
STONE.classes = new Class<?>[]{
|
STONE.classes = new Class<?>[]{
|
||||||
@@ -321,7 +329,7 @@ public class Generator {
|
|||||||
StoneOfFear.class,
|
StoneOfFear.class,
|
||||||
StoneOfAugmentation.class //1 is sold in each shop
|
StoneOfAugmentation.class //1 is sold in each shop
|
||||||
};
|
};
|
||||||
STONE.defaultProbs = new float[]{ 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0 };
|
STONE.defaultProbs = new float[]{ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 };
|
||||||
STONE.probs = STONE.defaultProbs.clone();
|
STONE.probs = STONE.defaultProbs.clone();
|
||||||
|
|
||||||
WAND.classes = new Class<?>[]{
|
WAND.classes = new Class<?>[]{
|
||||||
@@ -517,6 +525,7 @@ public class Generator {
|
|||||||
usingFirstDeck = Random.Int(2) == 0;
|
usingFirstDeck = Random.Int(2) == 0;
|
||||||
generalReset();
|
generalReset();
|
||||||
for (Category cat : Category.values()) {
|
for (Category cat : Category.values()) {
|
||||||
|
cat.using2ndProbs = cat.defaultProbs2 != null && Random.Int(2) == 0;
|
||||||
reset(cat);
|
reset(cat);
|
||||||
if (cat.defaultProbs != null) {
|
if (cat.defaultProbs != null) {
|
||||||
cat.seed = Random.Long();
|
cat.seed = Random.Long();
|
||||||
@@ -533,7 +542,14 @@ public class Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void reset(Category cat){
|
public static void reset(Category cat){
|
||||||
if (cat.defaultProbs != null) cat.probs = cat.defaultProbs.clone();
|
if (cat.defaultProbs != null) {
|
||||||
|
if (cat.defaultProbs2 != null){
|
||||||
|
cat.using2ndProbs = !cat.using2ndProbs;
|
||||||
|
cat.probs = cat.using2ndProbs ? cat.defaultProbs2.clone() : cat.defaultProbs.clone();
|
||||||
|
} else {
|
||||||
|
cat.probs = cat.defaultProbs.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//reverts changes to drop chances generates by this item
|
//reverts changes to drop chances generates by this item
|
||||||
@@ -746,6 +762,7 @@ public class Generator {
|
|||||||
private static final String FIRST_DECK = "first_deck";
|
private static final String FIRST_DECK = "first_deck";
|
||||||
private static final String GENERAL_PROBS = "general_probs";
|
private static final String GENERAL_PROBS = "general_probs";
|
||||||
private static final String CATEGORY_PROBS = "_probs";
|
private static final String CATEGORY_PROBS = "_probs";
|
||||||
|
private static final String CATEGORY_USING_PROBS2 = "_using_probs2";
|
||||||
private static final String CATEGORY_SEED = "_seed";
|
private static final String CATEGORY_SEED = "_seed";
|
||||||
private static final String CATEGORY_DROPPED = "_dropped";
|
private static final String CATEGORY_DROPPED = "_dropped";
|
||||||
|
|
||||||
@@ -762,7 +779,12 @@ public class Generator {
|
|||||||
for (Category cat : Category.values()){
|
for (Category cat : Category.values()){
|
||||||
if (cat.defaultProbs == null) continue;
|
if (cat.defaultProbs == null) continue;
|
||||||
|
|
||||||
bundle.put(cat.name().toLowerCase() + CATEGORY_PROBS, cat.probs);
|
bundle.put(cat.name().toLowerCase() + CATEGORY_PROBS, cat.probs);
|
||||||
|
|
||||||
|
if (cat.defaultProbs2 != null){
|
||||||
|
bundle.put(cat.name().toLowerCase() + CATEGORY_USING_PROBS2, cat.using2ndProbs);
|
||||||
|
}
|
||||||
|
|
||||||
if (cat.seed != null) {
|
if (cat.seed != null) {
|
||||||
bundle.put(cat.name().toLowerCase() + CATEGORY_SEED, cat.seed);
|
bundle.put(cat.name().toLowerCase() + CATEGORY_SEED, cat.seed);
|
||||||
bundle.put(cat.name().toLowerCase() + CATEGORY_DROPPED, cat.dropped);
|
bundle.put(cat.name().toLowerCase() + CATEGORY_DROPPED, cat.dropped);
|
||||||
@@ -788,6 +810,11 @@ public class Generator {
|
|||||||
if (cat.defaultProbs != null && probs.length == cat.defaultProbs.length){
|
if (cat.defaultProbs != null && probs.length == cat.defaultProbs.length){
|
||||||
cat.probs = probs;
|
cat.probs = probs;
|
||||||
}
|
}
|
||||||
|
if (bundle.contains(cat.name().toLowerCase() + CATEGORY_USING_PROBS2)){
|
||||||
|
cat.using2ndProbs = bundle.getBoolean(cat.name().toLowerCase() + CATEGORY_USING_PROBS2);
|
||||||
|
} else {
|
||||||
|
cat.using2ndProbs = false;
|
||||||
|
}
|
||||||
if (bundle.contains(cat.name().toLowerCase() + CATEGORY_SEED)){
|
if (bundle.contains(cat.name().toLowerCase() + CATEGORY_SEED)){
|
||||||
cat.seed = bundle.getLong(cat.name().toLowerCase() + CATEGORY_SEED);
|
cat.seed = bundle.getLong(cat.name().toLowerCase() + CATEGORY_SEED);
|
||||||
cat.dropped = bundle.getInt(cat.name().toLowerCase() + CATEGORY_DROPPED);
|
cat.dropped = bundle.getInt(cat.name().toLowerCase() + CATEGORY_DROPPED);
|
||||||
|
|||||||
Reference in New Issue
Block a user