v0.8.0: adjusted levelgen so that it is unaffected by held items and meta progression
This commit is contained in:
parent
fd38cfc155
commit
1f033200f6
|
@ -206,20 +206,6 @@ public abstract class Level implements Bundlable {
|
|||
addItemToSpawn( new StoneOfIntuition() );
|
||||
}
|
||||
|
||||
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
||||
if (rose != null && rose.isIdentified() && !rose.cursed){
|
||||
//aim to drop 1 petal every 2 floors
|
||||
int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3);
|
||||
|
||||
for (int i=1; i <= petalsNeeded; i++) {
|
||||
//the player may miss a single petal and still max their rose.
|
||||
if (rose.droppedPetals < 11) {
|
||||
addItemToSpawn(new DriedRose.Petal());
|
||||
rose.droppedPetals++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Dungeon.depth > 1) {
|
||||
switch (Random.Int( 10 )) {
|
||||
case 0:
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.journal.GuidePage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||
|
@ -329,6 +330,9 @@ public abstract class RegularLevel extends Level {
|
|||
}
|
||||
}
|
||||
|
||||
//use a separate generator for this to prevent held items and meta progress from affecting levelgen
|
||||
Random.pushGenerator( Dungeon.seedCurDepth() );
|
||||
|
||||
Item item = Bones.get();
|
||||
if (item != null) {
|
||||
int cell = randomDropCell();
|
||||
|
@ -339,6 +343,26 @@ public abstract class RegularLevel extends Level {
|
|||
drop( item, cell ).setHauntedIfCursed(1f).type = Heap.Type.REMAINS;
|
||||
}
|
||||
|
||||
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
||||
if (rose != null && rose.isIdentified() && !rose.cursed){
|
||||
//aim to drop 1 petal every 2 floors
|
||||
int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3);
|
||||
|
||||
for (int i=1; i <= petalsNeeded; i++) {
|
||||
//the player may miss a single petal and still max their rose.
|
||||
if (rose.droppedPetals < 11) {
|
||||
item = new DriedRose.Petal();
|
||||
int cell = randomDropCell();
|
||||
drop( item, cell ).type = Heap.Type.HEAP;
|
||||
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||
map[cell] = Terrain.GRASS;
|
||||
losBlocking[cell] = false;
|
||||
}
|
||||
rose.droppedPetals++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//guide pages
|
||||
Collection<String> allPages = Document.ADVENTURERS_GUIDE.pages();
|
||||
ArrayList<String> missingPages = new ArrayList<>();
|
||||
|
@ -366,6 +390,8 @@ public abstract class RegularLevel extends Level {
|
|||
drop( p, cell );
|
||||
}
|
||||
|
||||
Random.popGenerator();
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Room> rooms() {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
|
@ -28,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||
import com.watabou.utils.Graph;
|
||||
import com.watabou.utils.PathFinder;
|
||||
|
@ -188,6 +190,11 @@ public abstract class RegularPainter extends Painter {
|
|||
}
|
||||
}
|
||||
|
||||
//entrance doors on floor 2 are hidden if the player hasn't beaten the first boss
|
||||
if (Dungeon.depth == 2 && !Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1) && r instanceof EntranceRoom){
|
||||
d.type = Room.Door.Type.HIDDEN;
|
||||
}
|
||||
|
||||
switch (d.type) {
|
||||
case EMPTY:
|
||||
l.map[door] = Terrain.EMPTY;
|
||||
|
|
|
@ -58,6 +58,10 @@ public class EntranceRoom extends StandardRoom {
|
|||
} while (level.findMob(level.entrance) != null);
|
||||
Painter.set( level, level.entrance, Terrain.ENTRANCE );
|
||||
|
||||
//use a separate generator here so meta progression doesn't affect levelgen
|
||||
Random.pushGenerator();
|
||||
|
||||
//places the first guidebook page on floor 1
|
||||
if (Dungeon.depth == 1 && !Document.ADVENTURERS_GUIDE.hasPage(Document.GUIDE_INTRO_PAGE)){
|
||||
int pos;
|
||||
do {
|
||||
|
@ -70,27 +74,21 @@ public class EntranceRoom extends StandardRoom {
|
|||
level.drop( p, pos );
|
||||
}
|
||||
|
||||
if (Dungeon.depth == 2){
|
||||
if (!Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1)){
|
||||
for (Room.Door door : connected.values()) {
|
||||
door.set( Door.Type.HIDDEN );
|
||||
}
|
||||
}
|
||||
|
||||
if (!Document.ADVENTURERS_GUIDE.hasPage(Document.GUIDE_SEARCH_PAGE)){
|
||||
int pos;
|
||||
do {
|
||||
//can't be on bottom row of tiles
|
||||
pos = level.pointToCell(new Point( Random.IntRange( left + 1, right - 1 ),
|
||||
Random.IntRange( top + 1, bottom - 2 )));
|
||||
} while (pos == level.entrance || level.findMob(level.entrance) != null);
|
||||
GuidePage p = new GuidePage();
|
||||
p.page(Document.GUIDE_SEARCH_PAGE);
|
||||
level.drop( p, pos );
|
||||
}
|
||||
|
||||
//places the third guidebook page on floor 2
|
||||
if (Dungeon.depth == 2 && !Document.ADVENTURERS_GUIDE.hasPage(Document.GUIDE_SEARCH_PAGE)){
|
||||
int pos;
|
||||
do {
|
||||
//can't be on bottom row of tiles
|
||||
pos = level.pointToCell(new Point( Random.IntRange( left + 1, right - 1 ),
|
||||
Random.IntRange( top + 1, bottom - 2 )));
|
||||
} while (pos == level.entrance || level.findMob(level.entrance) != null);
|
||||
GuidePage p = new GuidePage();
|
||||
p.page(Document.GUIDE_SEARCH_PAGE);
|
||||
level.drop( p, pos );
|
||||
}
|
||||
|
||||
Random.popGenerator();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user