v0.2.2a: made the study room type a bit more interesting.
This commit is contained in:
parent
dc4232de2a
commit
d560a6e2d3
|
@ -21,6 +21,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
@ -144,23 +146,40 @@ public class StandardPainter extends Painter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly.
|
||||||
private static void paintStudy( Level level, Room room ) {
|
private static void paintStudy( Level level, Room room ) {
|
||||||
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
|
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
|
||||||
fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );
|
fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );
|
||||||
|
|
||||||
for (Point door : room.connected.values()) {
|
for (Room.Door door : room.connected.values()) {
|
||||||
|
if (door.type == Room.Door.Type.LOCKED){
|
||||||
|
//sneaky sneaky...
|
||||||
|
level.addItemToSpawn(new PotionOfLiquidFlame());
|
||||||
|
} else {
|
||||||
if (door.x == room.left) {
|
if (door.x == room.left) {
|
||||||
set( level, door.x + 1, door.y, Terrain.EMPTY );
|
set(level, door.x + 1, door.y, Terrain.EMPTY);
|
||||||
} else if (door.x == room.right) {
|
} else if (door.x == room.right) {
|
||||||
set( level, door.x - 1, door.y, Terrain.EMPTY );
|
set(level, door.x - 1, door.y, Terrain.EMPTY);
|
||||||
} else if (door.y == room.top) {
|
} else if (door.y == room.top) {
|
||||||
set( level, door.x, door.y + 1, Terrain.EMPTY );
|
set(level, door.x, door.y + 1, Terrain.EMPTY);
|
||||||
} else if (door.y == room.bottom) {
|
} else if (door.y == room.bottom) {
|
||||||
set( level, door.x , door.y - 1, Terrain.EMPTY );
|
set(level, door.x, door.y - 1, Terrain.EMPTY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set( level, room.center(), Terrain.PEDESTAL );
|
set( level, room.center(), Terrain.PEDESTAL );
|
||||||
|
if (Random.Int(2) != 0){
|
||||||
|
Item prize = level.findPrizeItem();
|
||||||
|
if (prize != null) {
|
||||||
|
level.drop(prize, (room.center().x + room.center().y * level.WIDTH));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
level.drop(Generator.random( Random.oneOf(
|
||||||
|
Generator.Category.POTION,
|
||||||
|
Generator.Category.SCROLL)), (room.center().x + room.center().y * level.WIDTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void paintBridge( Level level, Room room ) {
|
private static void paintBridge( Level level, Room room ) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user