v2.2.0: fixed into darkness challenge affecting broader levelgen
This commit is contained in:
@@ -195,10 +195,6 @@ public abstract class Level implements Bundlable {
|
|||||||
|
|
||||||
addItemToSpawn(Generator.random(Generator.Category.FOOD));
|
addItemToSpawn(Generator.random(Generator.Category.FOOD));
|
||||||
|
|
||||||
if (Dungeon.isChallenged(Challenges.DARKNESS)){
|
|
||||||
addItemToSpawn( new Torch() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Dungeon.posNeeded()) {
|
if (Dungeon.posNeeded()) {
|
||||||
addItemToSpawn( new PotionOfStrength() );
|
addItemToSpawn( new PotionOfStrength() );
|
||||||
Dungeon.LimitedDrops.STRENGTH_POTIONS.count++;
|
Dungeon.LimitedDrops.STRENGTH_POTIONS.count++;
|
||||||
@@ -243,10 +239,6 @@ public abstract class Level implements Bundlable {
|
|||||||
case 4:
|
case 4:
|
||||||
feeling = Feeling.LARGE;
|
feeling = Feeling.LARGE;
|
||||||
addItemToSpawn(Generator.random(Generator.Category.FOOD));
|
addItemToSpawn(Generator.random(Generator.Category.FOOD));
|
||||||
//add a second torch to help with the larger floor
|
|
||||||
if (Dungeon.isChallenged(Challenges.DARKNESS)){
|
|
||||||
addItemToSpawn( new Torch() );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
feeling = Feeling.TRAPS;
|
feeling = Feeling.TRAPS;
|
||||||
|
|||||||
+33
-4
@@ -22,6 +22,7 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
@@ -38,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
|
||||||
@@ -411,10 +413,30 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//use a separate generator for this to prevent held items, meta progress, and talents from affecting levelgen
|
//use separate generator(s) for this to prevent held items, meta progress, and talents from affecting levelgen
|
||||||
//we can use a random long for the seed as it will be the same long every time
|
//we can use a random long for these as they will be the same longs every time
|
||||||
Random.pushGenerator( Random.Long() );
|
|
||||||
|
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
|
if (Dungeon.isChallenged(Challenges.DARKNESS)){
|
||||||
|
int cell = randomDropCell();
|
||||||
|
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||||
|
map[cell] = Terrain.GRASS;
|
||||||
|
losBlocking[cell] = false;
|
||||||
|
}
|
||||||
|
drop( new Torch(), cell );
|
||||||
|
//add a second torch to help with the larger floor
|
||||||
|
if (feeling == Feeling.LARGE){
|
||||||
|
cell = randomDropCell();
|
||||||
|
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||||
|
map[cell] = Terrain.GRASS;
|
||||||
|
losBlocking[cell] = false;
|
||||||
|
}
|
||||||
|
drop( new Torch(), cell );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Random.popGenerator();
|
||||||
|
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
Item item = Bones.get();
|
Item item = Bones.get();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
int cell = randomDropCell();
|
int cell = randomDropCell();
|
||||||
@@ -424,7 +446,9 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
drop( item, cell ).setHauntedIfCursed().type = Heap.Type.REMAINS;
|
drop( item, cell ).setHauntedIfCursed().type = Heap.Type.REMAINS;
|
||||||
}
|
}
|
||||||
|
Random.popGenerator();
|
||||||
|
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
||||||
if (rose != null && rose.isIdentified() && !rose.cursed && Ghost.Quest.completed()){
|
if (rose != null && rose.isIdentified() && !rose.cursed && Ghost.Quest.completed()){
|
||||||
//aim to drop 1 petal every 2 floors
|
//aim to drop 1 petal every 2 floors
|
||||||
@@ -444,8 +468,10 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Random.popGenerator();
|
||||||
|
|
||||||
//cached rations try to drop in a special room on floors 2/3/4/6/7/8, to a max of 4/6
|
//cached rations try to drop in a special room on floors 2/3/4/6/7/8, to a max of 4/6
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
if (Dungeon.hero.hasTalent(Talent.CACHED_RATIONS)){
|
if (Dungeon.hero.hasTalent(Talent.CACHED_RATIONS)){
|
||||||
Talent.CachedRationsDropped dropped = Buff.affect(Dungeon.hero, Talent.CachedRationsDropped.class);
|
Talent.CachedRationsDropped dropped = Buff.affect(Dungeon.hero, Talent.CachedRationsDropped.class);
|
||||||
if (dropped.count() < 2 + 2*Dungeon.hero.pointsInTalent(Talent.CACHED_RATIONS)){
|
if (dropped.count() < 2 + 2*Dungeon.hero.pointsInTalent(Talent.CACHED_RATIONS)){
|
||||||
@@ -470,8 +496,10 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Random.popGenerator();
|
||||||
|
|
||||||
//guide pages
|
//guide pages
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
Collection<String> allPages = Document.ADVENTURERS_GUIDE.pageNames();
|
Collection<String> allPages = Document.ADVENTURERS_GUIDE.pageNames();
|
||||||
ArrayList<String> missingPages = new ArrayList<>();
|
ArrayList<String> missingPages = new ArrayList<>();
|
||||||
for ( String page : allPages){
|
for ( String page : allPages){
|
||||||
@@ -495,9 +523,11 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
drop( p, cell );
|
drop( p, cell );
|
||||||
}
|
}
|
||||||
|
Random.popGenerator();
|
||||||
|
|
||||||
//lore pages
|
//lore pages
|
||||||
//TODO a fair bit going on here, I might want to refactor/externalize this in the future
|
//TODO a fair bit going on here, I might want to refactor/externalize this in the future
|
||||||
|
Random.pushGenerator( Random.Long() );
|
||||||
if (Document.ADVENTURERS_GUIDE.allPagesFound()){
|
if (Document.ADVENTURERS_GUIDE.allPagesFound()){
|
||||||
|
|
||||||
int region = 1+(Dungeon.depth-1)/5;
|
int region = 1+(Dungeon.depth-1)/5;
|
||||||
@@ -555,7 +585,6 @@ public abstract class RegularLevel extends Level {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Random.popGenerator();
|
Random.popGenerator();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user