v2.3.0: various small improvements to gnoll quest levelgen

This commit is contained in:
Evan Debenham
2023-11-06 16:24:26 -05:00
parent 412539b4f0
commit e750165413
5 changed files with 68 additions and 38 deletions

View File

@@ -1208,7 +1208,7 @@ public class Hero extends Char {
} else if (Dungeon.level.map[action.dst] == Terrain.MINE_BOULDER){
Splash.at(action.dst, ColorMath.random( 0x444444, 0x777766 ), 5);
Sample.INSTANCE.play( Assets.Sounds.MINE, 0.6f );
Level.set( action.dst, Terrain.EMPTY );
Level.set( action.dst, Terrain.EMPTY_DECO );
}
for (int i : PathFinder.NEIGHBOURS9) {

View File

@@ -65,6 +65,10 @@ public class MineEntrance extends EntranceRoom {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
}
int entrance;
do {
entrance = level.pointToCell(random(3));
@@ -92,10 +96,10 @@ public class MineEntrance extends EntranceRoom {
}
} else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL) {
//connections to non-secret rooms have a 7/8 chance to become empty, otherwise wall
//connections to non-secret rooms have a 9/10 chance to become empty, otherwise wall
for (Room n : connected.keySet()){
if (!(n instanceof SecretRoom) && connected.get(n).type == Door.Type.REGULAR){
if (Random.Int(8) == 0){
if (Random.Int(10) == 0){
connected.get(n).set(Door.Type.EMPTY);
} else {
connected.get(n).set(Door.Type.WALL);
@@ -119,8 +123,11 @@ public class MineEntrance extends EntranceRoom {
dist = Math.min(dist, Point.distance(p, d));
}
dist = GameMath.gate(1f, dist-0.5f, 5f);
if (Random.Float((float) Math.pow(dist, 2)) < 1f) {
float val = Random.Float((float) Math.pow(dist, 2));
if (val <= 0.75f) {
Painter.set(level, cell, Terrain.MINE_BOULDER);
} else if (val <= 3f && dist <= 3){
Painter.set(level, cell, Terrain.EMPTY_DECO);
}
}
}

View File

@@ -80,10 +80,10 @@ public class MineGiantRoom extends CaveRoom {
} else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL){
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
//connections to non-secret rooms have a 7/8 chance to become empty, otherwise wall
//connections to non-secret rooms have a 9/10 chance to become empty, otherwise wall
for (Room n : connected.keySet()){
if (!(n instanceof SecretRoom) && connected.get(n).type == Door.Type.REGULAR){
if (Random.Int(8) == 0){
if (Random.Int(10) == 0){
connected.get(n).set(Door.Type.EMPTY);
} else {
connected.get(n).set(Door.Type.WALL);
@@ -107,8 +107,11 @@ public class MineGiantRoom extends CaveRoom {
dist = Math.min(dist, Point.distance(p, d));
}
dist = GameMath.gate(1f, dist-0.5f, 3f);
if (Random.Float((float)Math.pow(dist, 2)) < 1f){
float val = Random.Float((float) Math.pow(dist, 2));
if (val <= 0.75f) {
Painter.set(level, cell, Terrain.MINE_BOULDER);
} else if (val <= 3f && dist <= 3){
Painter.set(level, cell, Terrain.EMPTY_DECO);
}
}
}

View File

@@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.RockfallTrap;
import com.watabou.utils.GameMath;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
@@ -107,10 +108,10 @@ public class MineLargeRoom extends CaveRoom {
} else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL){
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
//connections to non-secret rooms have a 7/8 chance to become empty, otherwise wall
//connections to non-secret rooms have a 9/10 chance to become empty, otherwise wall
for (Room n : connected.keySet()){
if (!(n instanceof SecretRoom) && connected.get(n).type == Door.Type.REGULAR){
if (Random.Int(8) == 0){
if (Random.Int(10) == 0){
connected.get(n).set(Door.Type.EMPTY);
} else {
connected.get(n).set(Door.Type.WALL);
@@ -126,42 +127,58 @@ public class MineLargeRoom extends CaveRoom {
}
}
int sapperPos = level.pointToCell(random(5));
GnollSapper s = new GnollSapper();
s.pos = sapperPos;
((GnollSapper)s).spawnPos = s.pos;
level.mobs.add(s);
int guardPos;
do {
guardPos = sapperPos+PathFinder.NEIGHBOURS8[Random.Int(8)];
} while (level.map[guardPos] != Terrain.EMPTY);
GnollGuard g = new GnollGuard();
g.pos = guardPos;
level.mobs.add(g);
s.linkGuard(g);
for (int i = 0; i < 3; i ++){
int barricadePos = sapperPos+PathFinder.NEIGHBOURS8[Random.Int(8)];
if (level.map[barricadePos] == Terrain.EMPTY && barricadePos != guardPos){
Painter.set(level, barricadePos, Terrain.BARRICADE);
}
}
int traps = square() > 150 ? 3 : 2;
for (int i = 0; i < traps; i ++){
Point r;
do {
r = random(2);
} while (level.map[level.pointToCell(r)] != Terrain.EMPTY
|| level.pointToCell(r) == sapperPos
|| level.pointToCell(r) == guardPos);
Painter.set(level, r, Terrain.TRAP);
level.setTrap(new RockfallTrap().reveal(), level.pointToCell(r));
}
for (Point p : getPoints()){
int cell = level.pointToCell(p);
if (level.map[cell] == Terrain.EMPTY){
if (level.map[cell] == Terrain.EMPTY
&& cell != sapperPos
&& cell != guardPos){
float dist = 1000;
for (Door d : doors){
dist = Math.min(dist, Point.distance(p, d));
}
dist = GameMath.gate(1f, dist-0.5f, 5f);
if (Random.Float((float)Math.pow(dist, 2)) < 1f){
dist = GameMath.gate(1f, dist-0.5f, 4f);
float val = Random.Float((float) Math.pow(dist, 2));
if (val <= 0.75f) {
Painter.set(level, cell, Terrain.MINE_BOULDER);
} else if (val <= 3f && dist <= 3){
Painter.set(level, cell, Terrain.EMPTY_DECO);
}
}
}
for (int i = 0; i < 4; i ++){
Point r = random(5);
if (level.map[level.pointToCell(r)] != Terrain.WALL) {
Painter.set(level, r, Terrain.BARRICADE);
}
}
//TODO refine this with barricades
Point p = random(5);
GnollSapper s = new GnollSapper();
s.pos = level.pointToCell(p);
level.mobs.add(s);
Painter.set(level, p, Terrain.EMPTY);
p = random(4);
GnollGuard g = new GnollGuard();
g.pos = level.pointToCell(p);
level.mobs.add(g);
Painter.set(level, p, Terrain.EMPTY);
s.linkGuard(g);
} else {
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
}

View File

@@ -65,10 +65,10 @@ public class MineSmallRoom extends CaveRoom {
}
} else if (Blacksmith.Quest.Type() == Blacksmith.Quest.GNOLL) {
//connections to non-secret rooms have a 7/8 chance to become empty, otherwise wall
//connections to non-secret rooms have a 9/10 chance to become empty, otherwise wall
for (Room n : connected.keySet()){
if (!(n instanceof SecretRoom) && connected.get(n).type == Door.Type.REGULAR){
if (Random.Int(8) == 0){
if (Random.Int(10) == 0){
connected.get(n).set(Door.Type.EMPTY);
} else {
connected.get(n).set(Door.Type.WALL);
@@ -92,8 +92,11 @@ public class MineSmallRoom extends CaveRoom {
dist = Math.min(dist, Point.distance(p, d));
}
dist = GameMath.gate(1f, dist, 5f);
if (Random.Float((float) Math.pow(dist, 2)) < 1f) {
float val = Random.Float((float) Math.pow(dist, 2));
if (val <= 0.75f) {
Painter.set(level, cell, Terrain.MINE_BOULDER);
} else if (val <= 3f && dist <= 2){
Painter.set(level, cell, Terrain.EMPTY_DECO);
}
}
}