v2.4.0: removed cases of game directly using dungeon seed for levelgen

This commit is contained in:
Evan Debenham
2024-04-16 13:06:16 -04:00
parent d9d04c30e5
commit ba90e140c1
4 changed files with 64 additions and 21 deletions

View File

@@ -102,6 +102,10 @@ public class Dungeon {
STRENGTH_POTIONS,
UPGRADE_SCROLLS,
ARCANE_STYLI,
ENCH_STONE,
INT_STONE,
TRINKET_CATA,
LAB_ROOM, //actually a room, but logic is the same
//Health potion sources
//enemies
@@ -256,7 +260,7 @@ public class Dungeon {
QuickSlotButton.reset();
Toolbar.swappedQuickslots = false;
depth = 1;
depth = 15;
branch = 0;
generatedLevels.clear();
@@ -554,6 +558,46 @@ public class Dungeon {
return Random.Int(5 - floorThisSet) < asLeftThisSet;
}
public static boolean enchStoneNeeded(){
//1 enchantment stone, spawns on chapter 2 or 3
if (!LimitedDrops.ENCH_STONE.dropped()){
int region = 1+depth/5;
if (region > 1){
int floorsVisited = depth - 5;
if (floorsVisited > 4) floorsVisited--; //skip floor 10
return Random.Int(9-floorsVisited) == 0; //1/8 chance each floor
}
}
return false;
}
public static boolean intStoneNeeded(){
//one stone on floors 1-3
return !LimitedDrops.INT_STONE.dropped() && Random.Int(4-depth) == 0;
}
public static boolean trinketCataNeeded(){
//one trinket catalyst on floors 1-3
return !LimitedDrops.TRINKET_CATA.dropped() && Random.Int(4-depth) == 0;
}
public static boolean labRoomNeeded(){
//one laboratory each floor set, in floor 3 or 4, 1/2 chance each floor
int region = 1+depth/5;
if (region > LimitedDrops.LAB_ROOM.count){
int floorThisRegion = depth%5;
if (floorThisRegion >= 4 || (floorThisRegion == 3 && Random.Int(2) == 0)){
return true;
}
}
return false;
}
// 1/4
// 3/4 * 1/3 = 3/12 = 1/4
// 3/4 * 2/3 * 1/2 = 6/24 = 1/4
// 1/4
private static final String INIT_VER = "init_ver";
private static final String VERSION = "version";
private static final String SEED = "seed";

View File

@@ -70,16 +70,16 @@ public class TrapMechanism extends Trinket {
}
if (mech.levelFeels.isEmpty()){
Random.pushGenerator(Dungeon.seed+1);
mech.levelFeels.add(true);
mech.levelFeels.add(true);
mech.levelFeels.add(true);
mech.levelFeels.add(false);
mech.levelFeels.add(false);
mech.levelFeels.add(false);
for (int i = 0; i <= mech.shuffles; i++) {
Random.shuffle(mech.levelFeels);
}
mech.shuffles++;
mech.levelFeels.add(true);
mech.levelFeels.add(true);
mech.levelFeels.add(true);
mech.levelFeels.add(false);
mech.levelFeels.add(false);
mech.levelFeels.add(false);
for (int i = 0; i <= mech.shuffles; i++) {
Random.shuffle(mech.levelFeels);
}
mech.shuffles++;
Random.popGenerator();
}

View File

@@ -219,18 +219,16 @@ public abstract class Level implements Bundlable {
Dungeon.LimitedDrops.ARCANE_STYLI.count++;
addItemToSpawn( new Stylus() );
}
//one scroll of transmutation is guaranteed to spawn somewhere on chapter 2-4
int enchChapter = (int)((Dungeon.seed / 10) % 3) + 1;
if ( Dungeon.depth / 5 == enchChapter &&
Dungeon.seed % 4 + 1 == Dungeon.depth % 5){
if ( Dungeon.enchStoneNeeded() ){
Dungeon.LimitedDrops.ENCH_STONE.drop();
addItemToSpawn( new StoneOfEnchantment() );
}
if ( Dungeon.depth == ((Dungeon.seed % 3) + 1)){
if ( Dungeon.intStoneNeeded() ){
Dungeon.LimitedDrops.INT_STONE.drop();
addItemToSpawn( new StoneOfIntuition() );
}
if ( Dungeon.depth == (((Dungeon.seed+1) % 3) + 1)){
if ( Dungeon.trinketCataNeeded() ){
Dungeon.LimitedDrops.TRINKET_CATA.drop();
addItemToSpawn( new TrinketCatalyst());
}

View File

@@ -131,8 +131,9 @@ public abstract class SpecialRoom extends Room {
public static void initForFloor(){
floorSpecials = (ArrayList<Class<?extends Room>>) runSpecials.clone();
//laboratory rooms spawn at set intervals every chapter, on 3rd or 4th floor
if (Dungeon.depth%5 == (Dungeon.seed%2 + 3)){
//laboratory rooms spawn on floor 3 or 4 each chapter
if (Dungeon.labRoomNeeded()){
Dungeon.LimitedDrops.LAB_ROOM.count++;
floorSpecials.add(0, LaboratoryRoom.class);
}
}