|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.dungeon.AbstractLevelGenerator wyvern.kernel.dungeon.DungeonGenerator
Engine for creating a Nethack-style dungeon level. This class is NOT thread-safe; you should make sure you only call it from one thread. You can call generate() multiple times, however, to make new levels.
Nested Class Summary |
Nested classes inherited from class wyvern.kernel.dungeon.DungeonConstants |
DungeonConstants.Blockage, DungeonConstants.RoomType, DungeonConstants.TrapCount |
Field Summary | |
protected int |
blockage_
|
protected int |
density_
|
protected java.lang.String |
door_
|
protected int |
doorHP_
|
protected int[][] |
doorType_
|
protected int |
eastmost_
|
protected java.lang.String |
exits_
|
protected int |
height_
|
protected int[][] |
itemLocs_
|
protected int[][] |
maze_
|
protected int[][] |
monsterLocs_
|
protected int |
northmost_
|
protected int |
numGroups_
|
protected int |
numRooms_
|
protected int |
numSpecialRooms_
|
protected Room[][] |
roomCache_
|
protected int |
roomMin_
|
protected int |
roomRand_
|
protected java.util.ArrayList |
rooms_
|
protected int |
southmost_
|
protected int |
special_
|
protected int |
specialX_
|
protected int |
specialY_
|
protected java.lang.String |
stair_
|
protected int[][] |
submaze_
|
protected int |
traps_
|
protected java.lang.String |
wall_
|
protected int |
westmost_
|
protected int |
width_
|
Fields inherited from class wyvern.kernel.dungeon.AbstractLevelGenerator |
DEFAULT_HEIGHT, DEFAULT_WIDTH, floor_, oobTerrain_, stairsDown_, stairsUp_, terrain_ |
Fields inherited from interface wyvern.kernel.dungeon.DungeonConstants |
CORNER, DEFAULT_DEFAULT_TERRAIN, DEFAULT_DENSITY, DEFAULT_DOOR, DEFAULT_DOOR_HP, DEFAULT_DUNGEON_HEIGHT, DEFAULT_DUNGEON_WIDTH, DEFAULT_EXIT_TYPE, DEFAULT_FLOOR, DEFAULT_ROOM_MIN, DEFAULT_ROOM_RAND, DEFAULT_STAIR, DEFAULT_WALL, DOOR, DOWNSTAIR, EAST, EDGEDOOR, FLOOR, FRIENDLY, GENERIC, LOCKEDDOOR, MAX_DUNGEON_HEIGHT, MAX_DUNGEON_WIDTH, MINROOMS, NEVERLOCKED, NEVERTRAPPED, NODOOR, NORMAL, NORMALDOOR, NORTH, ONEDOORWALL, POWERFUL, SECRETDOOR, SOUTH, TRAPPEDDOOR, TRAPPEDSPACE, TREASURE, TUNNEL, UPSTAIR, VERYPOWERFUL, WALL, WEAK, WEST |
Constructor Summary | |
DungeonGenerator()
Constructs a new generator. |
|
DungeonGenerator(int w,
int h)
Constructs a new DungeonGenerator |
Method Summary | |
void |
addDownstair(GameMap map,
int x,
int y)
Adds the staircase down. |
protected void |
addLever(GameObject gate,
GameMap map,
int type)
Adds levers for the "door", if the door-type is a Gate. |
void |
addStairs()
Places up & down staircases if applicable. |
void |
addTraps()
Puts down random traps throughout the dungeon. |
void |
addUpstair(GameMap map,
int x,
int y)
Adds the staircase up. |
void |
connectRooms()
Digs tunnels between existing rooms. |
void |
createSpecialRoom(int type)
Creates a shop, lair, vault, snare, etc. |
Room |
digFrom(int startX,
int startY,
int xz,
int yz,
int endX,
int endY)
|
Room |
digTunnel(Room r1,
Room r2)
|
void |
eraseMap()
|
GameMap |
generate(java.lang.Class mapclass)
Generates a new dungeon subclassed from the specified map class. |
void |
generateLair()
A lair is a room full of a bunch of related monsters. |
GameMap |
generateMap(java.lang.Class mapclass)
Produces a wyvern GameMap from the internal data structures. |
void |
generateRooms()
Generates the "normal" rooms for the dungeon. |
void |
generateShop()
Generates a shop on the level. |
void |
generateSnare()
A snare is a square room with lots of traps and some treasure in the center. |
Room |
generateValidRoom(int bx,
int rx)
Tries to create a room somewhere in the dungeon. |
void |
generateVault()
A vault is a small, square room filled with treasure. |
int |
getBlockage()
|
java.lang.String |
getDoorArchetype()
|
int |
getDoorHP()
|
java.lang.String |
getExitType()
|
int |
getMinimumRoomSize()
|
Room |
getRoom(int x,
int y)
Returns the Room that contains (x,y). |
int |
getRoomDensity()
|
int |
getRoomRandomSize()
|
int |
getSpecialRoom()
|
java.lang.String |
getStairArchetype()
|
int |
getTraps()
|
java.lang.String |
getWallArchetype()
|
void |
makeDoor(int x1,
int y1,
int x2,
int y2)
Places a door in the dungeon. |
void |
mergeGroups(int g1,
int g2)
Each time a new room is added, the global group count is incremented. |
void |
setBlockage(int blockage)
Sets hall/door junction blockage. |
void |
setDoorArchetype(java.lang.String name)
Sets the archetype to use for the dungeon doors. |
void |
setDoorHP(int hp)
Sets the number of HP to use for doors in the dungeon. |
void |
setExitType(java.lang.String type)
Sets whether up/down stairs are desired. |
void |
setMinimumRoomSize(int size)
Sets the minimum number of squares across a room in any dimension. |
void |
setRoomDensity(int density)
Sets the density of rooms per map area. |
void |
setRoomRandomSize(int size)
Sets the maximum random amount added to the room width & height. |
void |
setSpecialRoom(int type)
Sets the special room to generate, if any. |
void |
setStairArchetype(java.lang.String name)
Sets the archetype base-name to use for the dungeon/room stairs. |
void |
setTraps(int traps)
Sets level of traps to generate. |
void |
setWallArchetype(java.lang.String name)
Sets the archetype to use for the dungeon/room walls. |
protected boolean |
useExistingLevers(GameObject gate,
GameMap map,
int type)
Tries to use the existing levers for a gate next to another gate. |
boolean |
validDoor(int x1,
int y1,
int x2,
int y2)
|
boolean |
validRoom(int x1,
int y1,
int x2,
int y2)
This function compares the coordinates of the proposed room to every existing room. |
Methods inherited from class wyvern.kernel.dungeon.AbstractLevelGenerator |
getDefaultTerrain, getDownstairArchetype, getFloorArchetype, getHeight, getOOBTerrain, getUpstairArchetype, getWidth, instantiateFloor, instantiateObject, rand, setDefaultTerrain, setDownstairArchetype, setFloorArchetype, setHeight, setOOBTerrain, setUpstairArchetype, setWidth |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int width_
protected int height_
protected int roomMin_
protected int roomRand_
protected int density_
protected int blockage_
protected int traps_
protected int special_
protected java.lang.String exits_
protected java.lang.String door_
protected java.lang.String wall_
protected java.lang.String stair_
protected int[][] maze_
protected int[][] submaze_
protected int[][] doorType_
protected int[][] monsterLocs_
protected int[][] itemLocs_
protected Room[][] roomCache_
protected java.util.ArrayList rooms_
protected int numRooms_
protected int numSpecialRooms_
protected int numGroups_
protected int specialX_
protected int specialY_
protected int northmost_
protected int southmost_
protected int eastmost_
protected int westmost_
protected int doorHP_
Constructor Detail |
public DungeonGenerator()
public DungeonGenerator(int w, int h)
Method Detail |
public GameMap generate(java.lang.Class mapclass)
generate
in class AbstractLevelGenerator
mapclass
- the class (e.g. DenseMap.class) to generate
public void generateRooms()
public void addStairs()
public boolean validRoom(int x1, int y1, int x2, int y2)
public void addTraps()
public void connectRooms()
public Room digTunnel(Room r1, Room r2)
public Room digFrom(int startX, int startY, int xz, int yz, int endX, int endY)
public void makeDoor(int x1, int y1, int x2, int y2)
public boolean validDoor(int x1, int y1, int x2, int y2)
public void createSpecialRoom(int type)
type
- "shop", "lair", "vault", etc.public void generateLair()
What we actually do is generate one critter off of a special list of lairing creatures- it will automatically surround itself with appropriate critters.
public void generateSnare()
public void generateVault()
public void generateShop()
public Room generateValidRoom(int bx, int rx)
bx
- base width/heightrx
- random range to add to width and height
public Room getRoom(int x, int y)
x
- map xy
- map y
public void eraseMap()
public void mergeGroups(int g1, int g2)
public GameMap generateMap(java.lang.Class mapclass)
mapclass
- the GameMap implementation class to use
public void addUpstair(GameMap map, int x, int y)
public void addDownstair(GameMap map, int x, int y)
protected void addLever(GameObject gate, GameMap map, int type)
gate
- the gatemap
- the maptype
- NORTH, SOUTH, EAST or WESTprotected boolean useExistingLevers(GameObject gate, GameMap map, int type)
public void setMinimumRoomSize(int size)
public int getMinimumRoomSize()
public void setRoomRandomSize(int size)
public int getRoomRandomSize()
public void setRoomDensity(int density)
public int getRoomDensity()
public void setBlockage(int blockage)
public int getBlockage()
public void setTraps(int traps)
public int getTraps()
public void setSpecialRoom(int type)
public int getSpecialRoom()
public void setExitType(java.lang.String type)
public java.lang.String getExitType()
public void setDoorArchetype(java.lang.String name)
name
- the archetype to use, e.g. "walls/dungeon_door"public java.lang.String getDoorArchetype()
public void setWallArchetype(java.lang.String name)
name
- the archetype to use, e.g. "walls/dungeon_wall"public java.lang.String getWallArchetype()
public void setStairArchetype(java.lang.String name)
name
- the archetype base to use, e.g. "indoor/stairs"public java.lang.String getStairArchetype()
public void setDoorHP(int hp)
hp
- the HP to use for doorspublic int getDoorHP()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |