v0.8.1: Added a deck system for probabilities of standard consumables

This commit is contained in:
Evan Debenham 2020-05-15 23:21:13 -04:00
parent 4a6b0130c0
commit 9a59fc8a9b
13 changed files with 389 additions and 348 deletions

View File

@ -207,7 +207,6 @@ public class Dungeon {
Imp.Quest.reset(); Imp.Quest.reset();
Generator.reset(); Generator.reset();
Generator.initArtifacts();
hero = new Hero(); hero = new Hero();
hero.live(); hero.live();

View File

@ -134,12 +134,13 @@ public class Warlock extends Mob implements Callback {
} }
@Override @Override
//TODO refactor warlock drops, they shouldn't pull from regular healing potion pool
public Item createLoot(){ public Item createLoot(){
Item loot = super.createLoot(); Item loot = super.createLoot();
if (loot instanceof PotionOfHealing){ if (loot instanceof PotionOfHealing){
//count/10 chance of not dropping potion //count/8 chance of not dropping potion
if (Random.Float() < ((8f - Dungeon.LimitedDrops.WARLOCK_HP.count) / 8f)){ if (Random.Float() < ((8f - Dungeon.LimitedDrops.WARLOCK_HP.count) / 8f)){
Dungeon.LimitedDrops.WARLOCK_HP.count++; Dungeon.LimitedDrops.WARLOCK_HP.count++;
} else { } else {

View File

@ -178,6 +178,218 @@ import java.util.LinkedHashMap;
public class Generator { public class Generator {
private static final String CATEGORY_PROBS = "_probs";
private static final float[][] floorSetTierProbs = new float[][] {
{0, 70, 20, 8, 2},
{0, 25, 50, 20, 5},
{0, 0, 40, 50, 10},
{0, 0, 20, 40, 40},
{0, 0, 0, 20, 80}
};
private static HashMap<Category,Float> categoryProbs = new LinkedHashMap<>();
public static void reset() {
for (Category cat : Category.values()) {
categoryProbs.put( cat, cat.prob );
if (cat.defaultProbs != null) cat.probs = cat.defaultProbs.clone();
}
}
public static void reset(Category cat){
cat.probs = cat.defaultProbs.clone();
}
public static Item random() {
Category cat = Random.chances( categoryProbs );
if (cat == null){
reset();
cat = Random.chances( categoryProbs );
}
categoryProbs.put( cat, categoryProbs.get( cat ) - 1);
return random( cat );
}
public static Item random( Category cat ) {
switch (cat) {
case ARMOR:
return randomArmor();
case WEAPON:
return randomWeapon();
case MISSILE:
return randomMissile();
case ARTIFACT:
Item item = randomArtifact();
//if we're out of artifacts, return a ring instead.
return item != null ? item : random(Category.RING);
default:
int i = Random.chances(cat.probs);
if (i == -1) {
reset(cat);
i = Random.chances(cat.probs);
}
if (cat.defaultProbs != null) cat.probs[i]--;
return ((Item) Reflection.newInstance(cat.classes[i])).random();
}
}
//overrides any deck systems and always uses default probs
public static Item randomUsingDefaults( Category cat ){
if (cat.defaultProbs == null) {
return random(cat); //currently covers weapons/armor/missiles
} else {
return ((Item) Reflection.newInstance(cat.classes[Random.chances(cat.defaultProbs)])).random();
}
}
public static Item random( Class<? extends Item> cl ) {
return Reflection.newInstance(cl).random();
}
public static Armor randomArmor(){
return randomArmor(Dungeon.depth / 5);
}
public static Armor randomArmor(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Armor a = (Armor)Reflection.newInstance(Category.ARMOR.classes[Random.chances(floorSetTierProbs[floorSet])]);
a.random();
return a;
}
public static final Category[] wepTiers = new Category[]{
Category.WEP_T1,
Category.WEP_T2,
Category.WEP_T3,
Category.WEP_T4,
Category.WEP_T5
};
public static MeleeWeapon randomWeapon(){
return randomWeapon(Dungeon.depth / 5);
}
public static MeleeWeapon randomWeapon(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])];
MeleeWeapon w = (MeleeWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]);
w.random();
return w;
}
public static final Category[] misTiers = new Category[]{
Category.MIS_T1,
Category.MIS_T2,
Category.MIS_T3,
Category.MIS_T4,
Category.MIS_T5
};
public static MissileWeapon randomMissile(){
return randomMissile(Dungeon.depth / 5);
}
public static MissileWeapon randomMissile(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])];
MissileWeapon w = (MissileWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]);
w.random();
return w;
}
//enforces uniqueness of artifacts throughout a run.
public static Artifact randomArtifact() {
Category cat = Category.ARTIFACT;
int i = Random.chances( cat.probs );
//if no artifacts are left, return null
if (i == -1){
return null;
}
cat.probs[i]--;
return (Artifact) Reflection.newInstance((Class<? extends Artifact>) cat.classes[i]).random();
}
public static boolean removeArtifact(Class<?extends Artifact> artifact) {
Category cat = Category.ARTIFACT;
for (int i = 0; i < cat.classes.length; i++){
if (cat.classes[i].equals(artifact)) {
cat.probs[i] = 0;
return true;
}
}
return false;
}
private static final String GENERAL_PROBS = "general_probs";
public static void storeInBundle(Bundle bundle) {
Float[] genProbs = categoryProbs.values().toArray(new Float[0]);
float[] storeProbs = new float[genProbs.length];
for (int i = 0; i < storeProbs.length; i++){
storeProbs[i] = genProbs[i];
}
bundle.put( GENERAL_PROBS, storeProbs);
for (Category cat : Category.values()){
if (cat.defaultProbs == null) continue;
boolean needsStore = false;
for (int i = 0; i < cat.probs.length; i++){
if (cat.probs[i] != cat.defaultProbs[i]){
needsStore = true;
break;
}
}
if (needsStore){
bundle.put(cat.name().toLowerCase() + CATEGORY_PROBS, cat.probs);
}
}
}
public static void restoreFromBundle(Bundle bundle) {
reset();
if (bundle.contains(GENERAL_PROBS)){
float[] probs = bundle.getFloatArray(GENERAL_PROBS);
for (int i = 0; i < probs.length; i++){
categoryProbs.put(Category.values()[i], probs[i]);
}
}
for (Category cat : Category.values()){
if (bundle.contains(cat.name().toLowerCase() + CATEGORY_PROBS)){
float[] probs = bundle.getFloatArray(cat.name().toLowerCase() + CATEGORY_PROBS);
if (cat.defaultProbs != null && probs.length == cat.defaultProbs.length){
cat.probs = probs;
}
}
}
//pre-0.8.1
if (bundle.contains("spawned_artifacts")) {
for (Class<? extends Artifact> artifact : bundle.getClassArray("spawned_artifacts")) {
Category cat = Category.ARTIFACT;
for (int i = 0; i < cat.classes.length; i++) {
if (cat.classes[i].equals(artifact)) {
cat.probs[i] = 0;
}
}
}
}
}
public enum Category { public enum Category {
WEAPON ( 6, MeleeWeapon.class), WEAPON ( 6, MeleeWeapon.class),
WEP_T1 ( 0, MeleeWeapon.class), WEP_T1 ( 0, MeleeWeapon.class),
@ -210,27 +422,6 @@ public class Generator {
GOLD ( 18, Gold.class ); GOLD ( 18, Gold.class );
public Class<?>[] classes; public Class<?>[] classes;
public float[] probs;
public float prob;
public Class<? extends Item> superClass;
private Category( float prob, Class<? extends Item> superClass ) {
this.prob = prob;
this.superClass = superClass;
}
public static int order( Item item ) {
for (int i=0; i < values().length; i++) {
if (values()[i].superClass.isInstance( item )) {
return i;
}
}
return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1;
}
private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1};
static { static {
GOLD.classes = new Class<?>[]{ GOLD.classes = new Class<?>[]{
@ -250,22 +441,25 @@ public class Generator {
PotionOfParalyticGas.class, PotionOfParalyticGas.class,
PotionOfPurity.class, PotionOfPurity.class,
PotionOfExperience.class}; PotionOfExperience.class};
POTION.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 }; POTION.defaultProbs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
POTION.probs = POTION.defaultProbs.clone();
SEED.classes = new Class<?>[]{ SEED.classes = new Class<?>[]{
Rotberry.Seed.class, //quest item Rotberry.Seed.class, //quest item
Blindweed.Seed.class,
Dreamfoil.Seed.class,
Earthroot.Seed.class,
Fadeleaf.Seed.class,
Firebloom.Seed.class,
Icecap.Seed.class,
Sorrowmoss.Seed.class,
Stormvine.Seed.class,
Sungrass.Seed.class, Sungrass.Seed.class,
Fadeleaf.Seed.class,
Icecap.Seed.class,
Firebloom.Seed.class,
Sorrowmoss.Seed.class,
Swiftthistle.Seed.class, Swiftthistle.Seed.class,
Blindweed.Seed.class,
Stormvine.Seed.class,
Earthroot.Seed.class,
Dreamfoil.Seed.class,
Starflower.Seed.class}; Starflower.Seed.class};
SEED.probs = new float[]{ 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1 }; //TODO adjust these
SEED.defaultProbs = new float[]{ 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1 };
SEED.probs = SEED.defaultProbs.clone();
SCROLL.classes = new Class<?>[]{ SCROLL.classes = new Class<?>[]{
ScrollOfUpgrade.class, //3 drop every chapter, see Dungeon.souNeeded() ScrollOfUpgrade.class, //3 drop every chapter, see Dungeon.souNeeded()
@ -281,23 +475,26 @@ public class Generator {
ScrollOfTerror.class, ScrollOfTerror.class,
ScrollOfTransmutation.class ScrollOfTransmutation.class
}; };
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 }; SCROLL.defaultProbs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
SCROLL.probs = SCROLL.defaultProbs.clone();
STONE.classes = new Class<?>[]{ STONE.classes = new Class<?>[]{
StoneOfEnchantment.class, //1 is guaranteed to drop on floors 6-19 StoneOfEnchantment.class, //1 is guaranteed to drop on floors 6-19
StoneOfAugmentation.class, //1 is sold in each shop
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3 StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
StoneOfAggression.class,
StoneOfAffection.class,
StoneOfBlast.class,
StoneOfBlink.class,
StoneOfClairvoyance.class,
StoneOfDeepenedSleep.class,
StoneOfDisarming.class, StoneOfDisarming.class,
StoneOfFlock.class, StoneOfFlock.class,
StoneOfShock.class StoneOfShock.class,
StoneOfBlink.class,
StoneOfDeepenedSleep.class,
StoneOfClairvoyance.class,
StoneOfAggression.class,
StoneOfBlast.class,
StoneOfAffection.class,
StoneOfAugmentation.class //1 is also sold in each shop
}; };
STONE.probs = new float[]{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; //TODO adjust these
STONE.defaultProbs = new float[]{ 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0 };
STONE.probs = STONE.defaultProbs.clone();
WAND.classes = new Class<?>[]{ WAND.classes = new Class<?>[]{
WandOfMagicMissile.class, WandOfMagicMissile.class,
@ -448,191 +645,33 @@ public class Generator {
LloydsBeacon.class, LloydsBeacon.class,
EtherealChains.class EtherealChains.class
}; };
ARTIFACT.probs = INITIAL_ARTIFACT_PROBS.clone(); ARTIFACT.defaultProbs = new float[]{ 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1};
ARTIFACT.probs = ARTIFACT.defaultProbs.clone();
}
//some item types use a deck-based system, where the probs decrement as items are picked
// until they are all 0, and then they reset. Those generator classes should define
// defaultProbs. If defaultProbs is null then a deck system isn't used.
//Artifacts in particular don't reset, no duplicates!
public float[] probs;
public float prob;
public Class<? extends Item> superClass;
private Category( float prob, Class<? extends Item> superClass ) {
this.prob = prob;
this.superClass = superClass;
}
public static int order( Item item ) {
for (int i=0; i < values().length; i++) {
if (values()[i].superClass.isInstance( item )) {
return i;
} }
} }
private static final float[][] floorSetTierProbs = new float[][] { return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1;
{0, 70, 20, 8, 2},
{0, 25, 50, 20, 5},
{0, 0, 40, 50, 10},
{0, 0, 20, 40, 40},
{0, 0, 0, 20, 80}
};
private static HashMap<Category,Float> categoryProbs = new LinkedHashMap<>();
public static void reset() {
for (Category cat : Category.values()) {
categoryProbs.put( cat, cat.prob );
} }
} public float[] defaultProbs = null;
public static Item random() {
Category cat = Random.chances( categoryProbs );
if (cat == null){
reset();
cat = Random.chances( categoryProbs );
}
categoryProbs.put( cat, categoryProbs.get( cat ) - 1);
return random( cat );
}
public static Item random( Category cat ) {
switch (cat) {
case ARMOR:
return randomArmor();
case WEAPON:
return randomWeapon();
case MISSILE:
return randomMissile();
case ARTIFACT:
Item item = randomArtifact();
//if we're out of artifacts, return a ring instead.
return item != null ? item : random(Category.RING);
default:
return ((Item) Reflection.newInstance(cat.classes[Random.chances( cat.probs )])).random();
}
}
public static Item random( Class<? extends Item> cl ) {
return Reflection.newInstance(cl).random();
}
public static Armor randomArmor(){
return randomArmor(Dungeon.depth / 5);
}
public static Armor randomArmor(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Armor a = (Armor)Reflection.newInstance(Category.ARMOR.classes[Random.chances(floorSetTierProbs[floorSet])]);
a.random();
return a;
}
public static final Category[] wepTiers = new Category[]{
Category.WEP_T1,
Category.WEP_T2,
Category.WEP_T3,
Category.WEP_T4,
Category.WEP_T5
};
public static MeleeWeapon randomWeapon(){
return randomWeapon(Dungeon.depth / 5);
}
public static MeleeWeapon randomWeapon(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])];
MeleeWeapon w = (MeleeWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]);
w.random();
return w;
}
public static final Category[] misTiers = new Category[]{
Category.MIS_T1,
Category.MIS_T2,
Category.MIS_T3,
Category.MIS_T4,
Category.MIS_T5
};
public static MissileWeapon randomMissile(){
return randomMissile(Dungeon.depth / 5);
}
public static MissileWeapon randomMissile(int floorSet) {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])];
MissileWeapon w = (MissileWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]);
w.random();
return w;
}
//enforces uniqueness of artifacts throughout a run.
public static Artifact randomArtifact() {
Category cat = Category.ARTIFACT;
int i = Random.chances( cat.probs );
//if no artifacts are left, return null
if (i == -1){
return null;
}
Class<?extends Artifact> art = (Class<? extends Artifact>) cat.classes[i];
if (removeArtifact(art)) {
Artifact artifact = Reflection.newInstance(art);
artifact.random();
return artifact;
} else {
return null;
}
}
public static boolean removeArtifact(Class<?extends Artifact> artifact) {
if (spawnedArtifacts.contains(artifact))
return false;
Category cat = Category.ARTIFACT;
for (int i = 0; i < cat.classes.length; i++)
if (cat.classes[i].equals(artifact)) {
if (cat.probs[i] == 1){
cat.probs[i] = 0;
spawnedArtifacts.add(artifact);
return true;
} else
return false;
}
return false;
}
//resets artifact probabilities, for new dungeons
public static void initArtifacts() {
Category.ARTIFACT.probs = Category.INITIAL_ARTIFACT_PROBS.clone();
spawnedArtifacts = new ArrayList<>();
}
private static ArrayList<Class<?extends Artifact>> spawnedArtifacts = new ArrayList<>();
private static final String GENERAL_PROBS = "general_probs";
private static final String SPAWNED_ARTIFACTS = "spawned_artifacts";
public static void storeInBundle(Bundle bundle) {
Float[] genProbs = categoryProbs.values().toArray(new Float[0]);
float[] storeProbs = new float[genProbs.length];
for (int i = 0; i < storeProbs.length; i++){
storeProbs[i] = genProbs[i];
}
bundle.put( GENERAL_PROBS, storeProbs);
bundle.put( SPAWNED_ARTIFACTS, spawnedArtifacts.toArray(new Class[0]));
}
public static void restoreFromBundle(Bundle bundle) {
if (bundle.contains(GENERAL_PROBS)){
float[] probs = bundle.getFloatArray(GENERAL_PROBS);
for (int i = 0; i < probs.length; i++){
categoryProbs.put(Category.values()[i], probs[i]);
}
} else {
reset();
}
initArtifacts();
for ( Class<?extends Artifact> artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){
removeArtifact(artifact);
}
} }
} }

View File

@ -45,8 +45,8 @@ public class Overgrowth extends Armor.Glyph {
Plant.Seed s; Plant.Seed s;
do{ do{
s = (Plant.Seed) Generator.random(Generator.Category.SEED); s = (Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED);
} while (s instanceof BlandfruitBush.Seed || s instanceof Starflower.Seed); } while (s instanceof Starflower.Seed);
Plant p = s.couch(defender.pos, null); Plant p = s.couch(defender.pos, null);

View File

@ -78,7 +78,7 @@ public class UnstableSpellbook extends Artifact {
super(); super();
Class<?>[] scrollClasses = Generator.Category.SCROLL.classes; Class<?>[] scrollClasses = Generator.Category.SCROLL.classes;
float[] probs = Generator.Category.SCROLL.probs.clone(); //array of primitives, clone gives deep copy. float[] probs = Generator.Category.SCROLL.defaultProbs.clone(); //array of primitives, clone gives deep copy.
int i = Random.chances(probs); int i = Random.chances(probs);
while (i != -1){ while (i != -1){
@ -116,7 +116,7 @@ public class UnstableSpellbook extends Artifact {
Scroll scroll; Scroll scroll;
do { do {
scroll = (Scroll) Generator.random(Generator.Category.SCROLL); scroll = (Scroll) Generator.randomUsingDefaults(Generator.Category.SCROLL);
} while (scroll == null } while (scroll == null
//reduce the frequency of these scrolls by half //reduce the frequency of these scrolls by half
||((scroll instanceof ScrollOfIdentify || ||((scroll instanceof ScrollOfIdentify ||

View File

@ -93,7 +93,7 @@ public class RegrowthBomb extends Bomb {
for (int i = 0; i < plants; i++) { for (int i = 0; i < plants; i++) {
Integer plantPos = Random.element(plantCandidates); Integer plantPos = Random.element(plantCandidates);
if (plantPos != null) { if (plantPos != null) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), plantPos); Dungeon.level.plant((Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED), plantPos);
plantCandidates.remove(plantPos); plantCandidates.remove(plantPos);
} }
} }

View File

@ -507,7 +507,7 @@ public class Potion extends Item {
if ( (seeds.size() == 2 && Random.Int(4) == 0) if ( (seeds.size() == 2 && Random.Int(4) == 0)
|| (seeds.size() == 3 && Random.Int(2) == 0)) { || (seeds.size() == 3 && Random.Int(2) == 0)) {
result = Generator.random( Generator.Category.POTION ); result = Generator.randomUsingDefaults( Generator.Category.POTION );
} else { } else {
result = Reflection.newInstance(types.get(Random.element(ingredients).getClass())); result = Reflection.newInstance(types.get(Random.element(ingredients).getClass()));
@ -521,7 +521,8 @@ public class Potion extends Item {
while (result instanceof PotionOfHealing while (result instanceof PotionOfHealing
&& (Dungeon.isChallenged(Challenges.NO_HEALING) && (Dungeon.isChallenged(Challenges.NO_HEALING)
|| Random.Int(10) < Dungeon.LimitedDrops.COOKING_HP.count)) { || Random.Int(10) < Dungeon.LimitedDrops.COOKING_HP.count)) {
result = Generator.random(Generator.Category.POTION);
result = Generator.randomUsingDefaults(Generator.Category.POTION);
} }
if (result instanceof PotionOfHealing) { if (result instanceof PotionOfHealing) {

View File

@ -198,7 +198,7 @@ public class CursedWand {
pos == Terrain.GRASS || pos == Terrain.GRASS ||
pos == Terrain.HIGH_GRASS || pos == Terrain.HIGH_GRASS ||
pos == Terrain.FURROWED_GRASS) { pos == Terrain.FURROWED_GRASS) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), pos); Dungeon.level.plant((Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED), pos);
} }
afterZap.call(); afterZap.call();
} }

View File

@ -159,7 +159,7 @@ public class WandOfRegrowth extends Wand {
Level floor = Dungeon.level; Level floor = Dungeon.level;
while(cells.hasNext() && Random.Float() <= numPlants){ while(cells.hasNext() && Random.Float() <= numPlants){
Plant.Seed seed = (Plant.Seed) Generator.random(Generator.Category.SEED); Plant.Seed seed = (Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED);
floor.plant(seed, cells.next()); floor.plant(seed, cells.next());
numPlants --; numPlants --;

View File

@ -162,7 +162,7 @@ public abstract class TippedDart extends Dart {
public static TippedDart randomTipped( int quantity ){ public static TippedDart randomTipped( int quantity ){
Plant.Seed s; Plant.Seed s;
do{ do{
s = (Plant.Seed) Generator.random(Generator.Category.SEED); s = (Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED);
} while (!types.containsKey(s.getClass())); } while (!types.containsKey(s.getClass()));
return getTipped(s, quantity ); return getTipped(s, quantity );

View File

@ -57,13 +57,13 @@ public class SecretLibraryRoom extends SecretRoom {
static{ static{
scrollChances.put( ScrollOfIdentify.class, 1f ); scrollChances.put( ScrollOfIdentify.class, 1f );
scrollChances.put( ScrollOfRemoveCurse.class, 2f ); scrollChances.put( ScrollOfRemoveCurse.class, 2f );
scrollChances.put( ScrollOfMagicMapping.class, 3f );
scrollChances.put( ScrollOfMirrorImage.class, 3f ); scrollChances.put( ScrollOfMirrorImage.class, 3f );
scrollChances.put( ScrollOfRecharging.class, 3f ); scrollChances.put( ScrollOfRecharging.class, 3f );
scrollChances.put( ScrollOfTeleportation.class, 3f );
scrollChances.put( ScrollOfLullaby.class, 4f ); scrollChances.put( ScrollOfLullaby.class, 4f );
scrollChances.put( ScrollOfRetribution.class, 4f ); scrollChances.put( ScrollOfMagicMapping.class, 4f );
scrollChances.put( ScrollOfRage.class, 4f ); scrollChances.put( ScrollOfRage.class, 4f );
scrollChances.put( ScrollOfTeleportation.class, 4f ); scrollChances.put( ScrollOfRetribution.class, 4f );
scrollChances.put( ScrollOfTerror.class, 4f ); scrollChances.put( ScrollOfTerror.class, 4f );
scrollChances.put( ScrollOfTransmutation.class, 6f ); scrollChances.put( ScrollOfTransmutation.class, 6f );
} }

View File

@ -196,18 +196,19 @@ public class ShopRoom extends SpecialRoom {
itemsToSpawn.add( new PotionOfHealing() ); itemsToSpawn.add( new PotionOfHealing() );
for (int i=0; i < 3; i++) itemsToSpawn.add( Generator.randomUsingDefaults( Generator.Category.POTION ) );
itemsToSpawn.add( Generator.random( Generator.Category.POTION ) ); itemsToSpawn.add( Generator.randomUsingDefaults( Generator.Category.POTION ) );
itemsToSpawn.add( Generator.randomUsingDefaults( Generator.Category.POTION ) );
itemsToSpawn.add( new ScrollOfIdentify() ); itemsToSpawn.add( new ScrollOfIdentify() );
itemsToSpawn.add( new ScrollOfRemoveCurse() ); itemsToSpawn.add( new ScrollOfRemoveCurse() );
itemsToSpawn.add( new ScrollOfMagicMapping() ); itemsToSpawn.add( new ScrollOfMagicMapping() );
itemsToSpawn.add( Generator.random( Generator.Category.SCROLL ) ); itemsToSpawn.add( Generator.randomUsingDefaults( Generator.Category.SCROLL ) );
for (int i=0; i < 2; i++) for (int i=0; i < 2; i++)
itemsToSpawn.add( Random.Int(2) == 0 ? itemsToSpawn.add( Random.Int(2) == 0 ?
Generator.random( Generator.Category.POTION ) : Generator.randomUsingDefaults( Generator.Category.POTION ) :
Generator.random( Generator.Category.SCROLL ) ); Generator.randomUsingDefaults( Generator.Category.SCROLL ) );
itemsToSpawn.add( new SmallRation() ); itemsToSpawn.add( new SmallRation() );

View File

@ -99,7 +99,7 @@ public class PlantsRoom extends StandardRoom {
private static Plant.Seed randomSeed(){ private static Plant.Seed randomSeed(){
Plant.Seed result; Plant.Seed result;
do { do {
result = (Plant.Seed) Generator.random(Generator.Category.SEED); result = (Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED);
} while (result instanceof Firebloom.Seed); } while (result instanceof Firebloom.Seed);
return result; return result;
} }