From 8a07131c53fc4b56d25690aa067b2c2ebe8830dc Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 9 Oct 2023 11:43:41 -0400 Subject: [PATCH] v2.2.0: added some very basic levelgen code for fungus quest --- .../actors/mobs/npcs/Blacksmith.java | 2 +- .../shatteredpixeldungeon/levels/MiningLevel.java | 7 +++++-- .../levels/rooms/quest/MineGiantRoom.java | 10 ++++++++++ .../levels/rooms/quest/MineLargeRoom.java | 10 ++++++++++ .../levels/rooms/quest/MineSecretRoom.java | 5 +++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index 39ba6361e..37a19b75c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -374,7 +374,7 @@ public class Blacksmith extends NPC { //currently only the crystal quest is ready to play //we still roll for quest type however, to ensure seed consistency - type = 3+Random.Int(1); + type = 1+Random.Int(1); alternative = false; given = false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java index ffc2cf6ad..96eb5c7ce 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bat; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.CrystalWisp; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GnollGuard; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Spinner; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; @@ -131,8 +132,8 @@ public class MiningLevel extends CavesLevel { protected Painter painter() { return new MiningLevelPainter() .setGold(Random.NormalIntRange(42, 46)) - .setWater(0.35f, 6) - .setGrass(0.10f, 3); + .setWater(Blacksmith.Quest.Type() == Blacksmith.Quest.FUNGI ? 0.1f : 0.35f, 6) + .setGrass(Blacksmith.Quest.Type() == Blacksmith.Quest.FUNGI ? 0.65f : 0.10f, 3); } @Override @@ -142,6 +143,8 @@ public class MiningLevel extends CavesLevel { return new Bat(); case Blacksmith.Quest.CRYSTAL: return new CrystalWisp(); + case Blacksmith.Quest.FUNGI: + return new Spinner(); case Blacksmith.Quest.GNOLL: return new GnollGuard(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineGiantRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineGiantRoom.java index f36e53ffa..acf689bf8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineGiantRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineGiantRoom.java @@ -67,6 +67,16 @@ public class MineGiantRoom extends CaveRoom { level.mobs.add(m); Painter.set(level, p, Terrain.EMPTY); + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.FUNGI){ + Painter.fillEllipse(level, this, 3, Terrain.EMPTY); + + for (int i = 0; i < width()*height()/2; i ++){ + Point r = random(1); + if (level.map[level.pointToCell(r)] != Terrain.WALL) { + Painter.set(level, r, Terrain.HIGH_GRASS); + } + } + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL){ Painter.fillEllipse(level, this, 3, Terrain.EMPTY); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineLargeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineLargeRoom.java index 2f68f871e..696479126 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineLargeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineLargeRoom.java @@ -92,6 +92,16 @@ public class MineLargeRoom extends CaveRoom { level.mobs.add(m); Painter.set(level, p, Terrain.EMPTY); + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.FUNGI){ + Painter.fillEllipse(level, this, 3, Terrain.EMPTY); + + for (int i = 0; i < width() * height() / 4; i++) { + Point r = random(1); + if (level.map[level.pointToCell(r)] != Terrain.WALL) { + Painter.set(level, r, Terrain.HIGH_GRASS); + } + } + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL){ Painter.fillEllipse(level, this, 3, Terrain.EMPTY); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineSecretRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineSecretRoom.java index d6ef70648..42234dfa6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineSecretRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/MineSecretRoom.java @@ -46,6 +46,11 @@ public class MineSecretRoom extends SecretRoom { if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL) { Painter.fill(level, this, 1, Terrain.MINE_CRYSTAL); + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.FUNGI) { + Painter.fill(level, this, 1, Terrain.HIGH_GRASS); + + //random plant? + } else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL) { Painter.fill( level, this, 1, Terrain.EMPTY_SP ); level.drop(new DarkGold().quantity(Random.NormalIntRange(3, 5)), level.pointToCell(center())).type = Heap.Type.CHEST;