v0.6.1: corrected static initialization for generator categories
This commit is contained in:
parent
e21e378b94
commit
0a0001c5d6
|
@ -154,7 +154,7 @@ import java.util.LinkedHashMap;
|
||||||
|
|
||||||
public class Generator {
|
public class Generator {
|
||||||
|
|
||||||
public static enum Category {
|
public enum Category {
|
||||||
WEAPON ( 6, Weapon.class ),
|
WEAPON ( 6, Weapon.class ),
|
||||||
WEP_T1 ( 0, Weapon.class),
|
WEP_T1 ( 0, Weapon.class),
|
||||||
WEP_T2 ( 0, Weapon.class),
|
WEP_T2 ( 0, Weapon.class),
|
||||||
|
@ -191,27 +191,15 @@ public class Generator {
|
||||||
|
|
||||||
return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1;
|
return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static final float[][] floorSetTierProbs = new float[][] {
|
|
||||||
{0, 70, 20, 8, 2},
|
|
||||||
{0, 25, 50, 20, 5},
|
|
||||||
{0, 10, 40, 40, 10},
|
|
||||||
{0, 5, 20, 50, 25},
|
|
||||||
{0, 2, 8, 20, 70}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static HashMap<Category,Float> categoryProbs = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
GOLD.classes = new Class<?>[]{
|
||||||
Category.GOLD.classes = new Class<?>[]{
|
|
||||||
Gold.class };
|
Gold.class };
|
||||||
Category.GOLD.probs = new float[]{ 1 };
|
GOLD.probs = new float[]{ 1 };
|
||||||
|
|
||||||
Category.SCROLL.classes = new Class<?>[]{
|
SCROLL.classes = new Class<?>[]{
|
||||||
ScrollOfIdentify.class,
|
ScrollOfIdentify.class,
|
||||||
ScrollOfTeleportation.class,
|
ScrollOfTeleportation.class,
|
||||||
ScrollOfRemoveCurse.class,
|
ScrollOfRemoveCurse.class,
|
||||||
|
@ -224,9 +212,9 @@ public class Generator {
|
||||||
ScrollOfMagicalInfusion.class,
|
ScrollOfMagicalInfusion.class,
|
||||||
ScrollOfPsionicBlast.class,
|
ScrollOfPsionicBlast.class,
|
||||||
ScrollOfMirrorImage.class };
|
ScrollOfMirrorImage.class };
|
||||||
Category.SCROLL.probs = new float[]{ 30, 10, 20, 0, 15, 15, 12, 8, 8, 0, 4, 10 };
|
SCROLL.probs = new float[]{ 30, 10, 20, 0, 15, 15, 12, 8, 8, 0, 4, 10 };
|
||||||
|
|
||||||
Category.POTION.classes = new Class<?>[]{
|
POTION.classes = new Class<?>[]{
|
||||||
PotionOfHealing.class,
|
PotionOfHealing.class,
|
||||||
PotionOfExperience.class,
|
PotionOfExperience.class,
|
||||||
PotionOfToxicGas.class,
|
PotionOfToxicGas.class,
|
||||||
|
@ -239,10 +227,10 @@ public class Generator {
|
||||||
PotionOfInvisibility.class,
|
PotionOfInvisibility.class,
|
||||||
PotionOfMight.class,
|
PotionOfMight.class,
|
||||||
PotionOfFrost.class };
|
PotionOfFrost.class };
|
||||||
Category.POTION.probs = new float[]{ 45, 4, 15, 10, 15, 10, 0, 20, 12, 10, 0, 10 };
|
POTION.probs = new float[]{ 45, 4, 15, 10, 15, 10, 0, 20, 12, 10, 0, 10 };
|
||||||
|
|
||||||
//TODO: add last ones when implemented
|
//TODO: add last ones when implemented
|
||||||
Category.WAND.classes = new Class<?>[]{
|
WAND.classes = new Class<?>[]{
|
||||||
WandOfMagicMissile.class,
|
WandOfMagicMissile.class,
|
||||||
WandOfLightning.class,
|
WandOfLightning.class,
|
||||||
WandOfDisintegration.class,
|
WandOfDisintegration.class,
|
||||||
|
@ -256,13 +244,13 @@ public class Generator {
|
||||||
WandOfTransfusion.class,
|
WandOfTransfusion.class,
|
||||||
WandOfCorruption.class,
|
WandOfCorruption.class,
|
||||||
WandOfRegrowth.class };
|
WandOfRegrowth.class };
|
||||||
Category.WAND.probs = new float[]{ 5, 4, 4, 4, 4, 3, /*3,*/ 3, 3, /*3,*/ 3, 3, 3 };
|
WAND.probs = new float[]{ 5, 4, 4, 4, 4, 3, /*3,*/ 3, 3, /*3,*/ 3, 3, 3 };
|
||||||
|
|
||||||
//see generator.randomWeapon
|
//see generator.randomWeapon
|
||||||
Category.WEAPON.classes = new Class<?>[]{};
|
WEAPON.classes = new Class<?>[]{};
|
||||||
Category.WEAPON.probs = new float[]{};
|
WEAPON.probs = new float[]{};
|
||||||
|
|
||||||
Category.WEP_T1.classes = new Class<?>[]{
|
WEP_T1.classes = new Class<?>[]{
|
||||||
WornShortsword.class,
|
WornShortsword.class,
|
||||||
Knuckles.class,
|
Knuckles.class,
|
||||||
Dagger.class,
|
Dagger.class,
|
||||||
|
@ -270,9 +258,9 @@ public class Generator {
|
||||||
Boomerang.class,
|
Boomerang.class,
|
||||||
Dart.class
|
Dart.class
|
||||||
};
|
};
|
||||||
Category.WEP_T1.probs = new float[]{ 1, 1, 1, 0, 0, 1 };
|
WEP_T1.probs = new float[]{ 1, 1, 1, 0, 0, 1 };
|
||||||
|
|
||||||
Category.WEP_T2.classes = new Class<?>[]{
|
WEP_T2.classes = new Class<?>[]{
|
||||||
Shortsword.class,
|
Shortsword.class,
|
||||||
HandAxe.class,
|
HandAxe.class,
|
||||||
Spear.class,
|
Spear.class,
|
||||||
|
@ -280,9 +268,9 @@ public class Generator {
|
||||||
Dirk.class,
|
Dirk.class,
|
||||||
IncendiaryDart.class
|
IncendiaryDart.class
|
||||||
};
|
};
|
||||||
Category.WEP_T2.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
WEP_T2.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
||||||
|
|
||||||
Category.WEP_T3.classes = new Class<?>[]{
|
WEP_T3.classes = new Class<?>[]{
|
||||||
Sword.class,
|
Sword.class,
|
||||||
Mace.class,
|
Mace.class,
|
||||||
Scimitar.class,
|
Scimitar.class,
|
||||||
|
@ -292,9 +280,9 @@ public class Generator {
|
||||||
Shuriken.class,
|
Shuriken.class,
|
||||||
CurareDart.class
|
CurareDart.class
|
||||||
};
|
};
|
||||||
Category.WEP_T3.probs = new float[]{ 6, 5, 5, 4, 4, 4, 6, 6 };
|
WEP_T3.probs = new float[]{ 6, 5, 5, 4, 4, 4, 6, 6 };
|
||||||
|
|
||||||
Category.WEP_T4.classes = new Class<?>[]{
|
WEP_T4.classes = new Class<?>[]{
|
||||||
Longsword.class,
|
Longsword.class,
|
||||||
BattleAxe.class,
|
BattleAxe.class,
|
||||||
Flail.class,
|
Flail.class,
|
||||||
|
@ -302,9 +290,9 @@ public class Generator {
|
||||||
AssassinsBlade.class,
|
AssassinsBlade.class,
|
||||||
Javelin.class
|
Javelin.class
|
||||||
};
|
};
|
||||||
Category.WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
||||||
|
|
||||||
Category.WEP_T5.classes = new Class<?>[]{
|
WEP_T5.classes = new Class<?>[]{
|
||||||
Greatsword.class,
|
Greatsword.class,
|
||||||
WarHammer.class,
|
WarHammer.class,
|
||||||
Glaive.class,
|
Glaive.class,
|
||||||
|
@ -312,24 +300,24 @@ public class Generator {
|
||||||
Greatshield.class,
|
Greatshield.class,
|
||||||
Tamahawk.class
|
Tamahawk.class
|
||||||
};
|
};
|
||||||
Category.WEP_T5.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
WEP_T5.probs = new float[]{ 6, 5, 5, 4, 4, 6 };
|
||||||
|
|
||||||
//see Generator.randomArmor
|
//see Generator.randomArmor
|
||||||
Category.ARMOR.classes = new Class<?>[]{
|
ARMOR.classes = new Class<?>[]{
|
||||||
ClothArmor.class,
|
ClothArmor.class,
|
||||||
LeatherArmor.class,
|
LeatherArmor.class,
|
||||||
MailArmor.class,
|
MailArmor.class,
|
||||||
ScaleArmor.class,
|
ScaleArmor.class,
|
||||||
PlateArmor.class };
|
PlateArmor.class };
|
||||||
Category.ARMOR.probs = new float[]{ 0, 0, 0, 0, 0 };
|
ARMOR.probs = new float[]{ 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
Category.FOOD.classes = new Class<?>[]{
|
FOOD.classes = new Class<?>[]{
|
||||||
Food.class,
|
Food.class,
|
||||||
Pasty.class,
|
Pasty.class,
|
||||||
MysteryMeat.class };
|
MysteryMeat.class };
|
||||||
Category.FOOD.probs = new float[]{ 4, 1, 0 };
|
FOOD.probs = new float[]{ 4, 1, 0 };
|
||||||
|
|
||||||
Category.RING.classes = new Class<?>[]{
|
RING.classes = new Class<?>[]{
|
||||||
RingOfAccuracy.class,
|
RingOfAccuracy.class,
|
||||||
RingOfEvasion.class,
|
RingOfEvasion.class,
|
||||||
RingOfElements.class,
|
RingOfElements.class,
|
||||||
|
@ -341,9 +329,9 @@ public class Generator {
|
||||||
RingOfSharpshooting.class,
|
RingOfSharpshooting.class,
|
||||||
RingOfTenacity.class,
|
RingOfTenacity.class,
|
||||||
RingOfWealth.class};
|
RingOfWealth.class};
|
||||||
Category.RING.probs = new float[]{ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
|
RING.probs = new float[]{ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
|
||||||
|
|
||||||
Category.ARTIFACT.classes = new Class<?>[]{
|
ARTIFACT.classes = new Class<?>[]{
|
||||||
CapeOfThorns.class,
|
CapeOfThorns.class,
|
||||||
ChaliceOfBlood.class,
|
ChaliceOfBlood.class,
|
||||||
CloakOfShadows.class,
|
CloakOfShadows.class,
|
||||||
|
@ -358,9 +346,9 @@ public class Generator {
|
||||||
LloydsBeacon.class,
|
LloydsBeacon.class,
|
||||||
EtherealChains.class
|
EtherealChains.class
|
||||||
};
|
};
|
||||||
Category.ARTIFACT.probs = INITIAL_ARTIFACT_PROBS.clone();
|
ARTIFACT.probs = INITIAL_ARTIFACT_PROBS.clone();
|
||||||
|
|
||||||
Category.SEED.classes = new Class<?>[]{
|
SEED.classes = new Class<?>[]{
|
||||||
Firebloom.Seed.class,
|
Firebloom.Seed.class,
|
||||||
Icecap.Seed.class,
|
Icecap.Seed.class,
|
||||||
Sorrowmoss.Seed.class,
|
Sorrowmoss.Seed.class,
|
||||||
|
@ -373,8 +361,19 @@ public class Generator {
|
||||||
Dreamfoil.Seed.class,
|
Dreamfoil.Seed.class,
|
||||||
Stormvine.Seed.class,
|
Stormvine.Seed.class,
|
||||||
Starflower.Seed.class};
|
Starflower.Seed.class};
|
||||||
Category.SEED.probs = new float[]{ 12, 12, 12, 12, 12, 12, 12, 0, 4, 12, 12, 1 };
|
SEED.probs = new float[]{ 12, 12, 12, 12, 12, 12, 12, 0, 4, 12, 12, 1 };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final float[][] floorSetTierProbs = new float[][] {
|
||||||
|
{0, 70, 20, 8, 2},
|
||||||
|
{0, 25, 50, 20, 5},
|
||||||
|
{0, 10, 40, 40, 10},
|
||||||
|
{0, 5, 20, 50, 25},
|
||||||
|
{0, 2, 8, 20, 70}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static HashMap<Category,Float> categoryProbs = new LinkedHashMap<>();
|
||||||
|
|
||||||
public static void reset() {
|
public static void reset() {
|
||||||
for (Category cat : Category.values()) {
|
for (Category cat : Category.values()) {
|
||||||
|
@ -524,7 +523,7 @@ public class Generator {
|
||||||
|
|
||||||
//resets artifact probabilities, for new dungeons
|
//resets artifact probabilities, for new dungeons
|
||||||
public static void initArtifacts() {
|
public static void initArtifacts() {
|
||||||
Category.ARTIFACT.probs = INITIAL_ARTIFACT_PROBS.clone();
|
Category.ARTIFACT.probs = Category.INITIAL_ARTIFACT_PROBS.clone();
|
||||||
|
|
||||||
//checks for dried rose quest completion, adds the rose in accordingly.
|
//checks for dried rose quest completion, adds the rose in accordingly.
|
||||||
if (Ghost.Quest.completed()) Category.ARTIFACT.probs[10] = 1;
|
if (Ghost.Quest.completed()) Category.ARTIFACT.probs[10] = 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user