-+-+-+-+-+-+-+-+ START OF PART 23 -+-+-+-+-+-+-+-+ X BEGIN X place_trap(y1,x1,1,randint(max_trapa)); X flag := true; X END; X count := count + 1; X until((flag) or (count > 5)); X END; X END; X`20 X `20 X`7B Place a trap with a given displacement of point `7D X procedure vault_monster(y,x,num : integer); X var X i1,y1,x1 : integer; X BEGIN X for i1 := 1 to num do X BEGIN X y1 := y; X x1 := x; X summon_monster(y1,x1,true); X END; X END; X`20 X`20 X`7B Builds a room at a row,column coordinate `7D X procedure build_room(yval,xval : integer); X var X y_height,y_depth,x_left,x_right,i1,i2 : integer; X cur_floor : floor_type; X BEGIN X if (dun_level <= randint(25)) then X cur_floor := lopen_floor `7B Floor with light `7D X else X cur_floor := dopen_floor; `7B Dark floor `7D X y_height := yval - randint(4); X y_depth := yval + randint(3); X x_left := xval - randint(11); X x_right := xval + randint(11); X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X BEGIN X cave`5Bi1,i2`5D.fval := cur_floor.ftval; X cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X END; X for i1 := (y_height - 1) to (y_depth + 1) do X BEGIN X cave`5Bi1,x_left-1`5D.fval := rock_wall1.ftval; X cave`5Bi1,x_left-1`5D.fopen := rock_wall1.ftopen; X cave`5Bi1,x_right+1`5D.fval := rock_wall1.ftval; X cave`5Bi1,x_right+1`5D.fopen := rock_wall1.ftopen; X END; X for i1 := x_left to x_right do X BEGIN X cave`5By_height-1,i1`5D.fval := rock_wall1.ftval; X cave`5By_height-1,i1`5D.fopen := rock_wall1.ftopen; X cave`5By_depth+1,i1`5D.fval := rock_wall1.ftval; X cave`5By_depth+1,i1`5D.fopen := rock_wall1.ftopen; X END X END; X`20 X`20 X`7B Builds a room at a row,column coordinate X Type 1 unusual rooms are several overlapping rectangular ones `7D X procedure build_type1(yval,xval : integer); X var X y_height,y_depth,x_left,x_right,i0,i1,i2 : integer; X cur_floor : floor_type; X BEGIN X if (dun_level <= randint(25)) then X cur_floor := lopen_floor `7B Floor with light `7D X else X cur_floor := dopen_floor; `7B Dark floor `7D X for i0 := 1 to (1 + randint(2)) do X BEGIN X y_height := yval - randint(4); X y_depth := yval + randint(3); X x_left := xval - randint(11); X x_right := xval + randint(11); X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X BEGIN X cave`5Bi1,i2`5D.fval := cur_floor.ftval; X cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X END; X for i1 := (y_height - 1) to (y_depth + 1) do X BEGIN X with cave`5Bi1,x_left-1`5D do X if (fval <> cur_floor.ftval) then X BEGIN X fval := rock_wall1.ftval; X fopen := rock_wall1.ftopen; X END; X with cave`5Bi1,x_right+1`5D do X if (fval <> cur_floor.ftval) then X BEGIN X fval := rock_wall1.ftval; X fopen := rock_wall1.ftopen; X END; X END; X for i1 := x_left to x_right do X BEGIN X with cave`5By_height-1,i1`5D do X if (fval <> cur_floor.ftval) then X BEGIN X fval := rock_wall1.ftval; X fopen := rock_wall1.ftopen; X END; X with cave`5By_depth+1,i1`5D do X if (fval <> cur_floor.ftval) then X BEGIN X fval := rock_wall1.ftval; X fopen := rock_wall1.ftopen; X END; X END; X END; X END; X`20 X`20 X`7B Builds an unusual room at a row,column coordinate`20 X Type 2 unusual rooms all have an inner room: X 1 - Just an inner room with one door X 2 - An inner room within an inner room X 3 - An inner room with pillar(s) X 4 - Inner room has a maze`20 X 5 - A set of four inner rooms `7D X procedure build_type2(yval,xval : integer); X var X y_height,y_depth,x_left,x_right,i1,i2 : integer; X cur_floor : floor_type; X BEGIN X if (dun_level <= randint(30)) then X cur_floor := lopen_floor `7B Floor with light `7D X else X cur_floor := dopen_floor; `7B Dark floor `7D X y_height := yval - 4; X y_depth := yval + 4; X x_left := xval - 11; X x_right := xval + 11; X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X BEGIN X cave`5Bi1,i2`5D.fval := cur_floor.ftval; X cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X END; X for i1 := (y_height - 1) to (y_depth + 1) do X BEGIN X cave`5Bi1,x_left-1`5D.fval := rock_wall1.ftval; X cave`5Bi1,x_left-1`5D.fopen := rock_wall1.ftopen; X cave`5Bi1,x_right+1`5D.fval := rock_wall1.ftval; X cave`5Bi1,x_right+1`5D.fopen := rock_wall1.ftopen; X END; X for i1 := x_left to x_right do X BEGIN X cave`5By_height-1,i1`5D.fval := rock_wall1.ftval; X cave`5By_height-1,i1`5D.fopen := rock_wall1.ftopen; X cave`5By_depth+1,i1`5D.fval := rock_wall1.ftval; X cave`5By_depth+1,i1`5D.fopen := rock_wall1.ftopen; X END; X`7B The inner room `7D X y_height := y_height + 2; X y_depth := y_depth - 2; X x_left := x_left + 2; X x_right := x_right - 2; X for i1 := (y_height - 1) to (y_depth + 1) do X BEGIN X cave`5Bi1,x_left-1`5D.fval := 8; X cave`5Bi1,x_right+1`5D.fval := 8; X END; X for i1 := x_left to x_right do X BEGIN X cave`5By_height-1,i1`5D.fval := 8; X cave`5By_depth+1,i1`5D.fval := 8; X END; X`7B Inner room varitions `7D`20 X CASE randint(5) of X 1 : BEGIN `7B Just an inner room... `7D X CASE randint(4) of `7B Place a door `7D X 1 : place_secret_door(y_height-1,xval); X 2 : place_secret_door(y_depth+1,xval); `20 X 3 : place_secret_door(yval,x_left-1); X 4 : place_secret_door(yval,x_right+1); X END; X vault_monster(yval,xval,1); X END; X 2 : BEGIN `7B Treasure Vault `7D X CASE randint(4) of `7B Place a door `7D X 1 : place_secret_door(y_height-1,xval); X 2 : place_secret_door(y_depth+1,xval); X 3 : place_secret_door(yval,x_left-1); X 4 : place_secret_door(yval,x_right+1); X END; X for i1 := yval-1 to yval+1 do X BEGIN X cave`5Bi1,xval-1`5D.fval := 8; X cave`5Bi1,xval+1`5D.fval := 8; X END; X cave`5Byval-1,xval`5D.fval := 8; X cave`5Byval+1,xval`5D.fval := 8; X CASE randint(4) of `7B Place a door `7D X 1 : place_locked_door(yval-1,xval); X 2 : place_locked_door(yval+1,xval); X 3 : place_locked_door(yval,xval-1); X 4 : place_locked_door(yval,xval+1); X END; X`7B Place an object in the treasure vault `7D X CASE randint(10) of X 1 : place_up_stairs(yval,xval); X 2 : place_down_stairs(yval,xval); X otherwise place_object(yval,xval); X END; X`7B Guard the treasure well `7D X vault_monster(yval,xval,2+randint(3)); X`7B If the monsters don't get 'em.`7D X vault_trap(yval,xval,4,10,2+randint(3)); X END; X 3 : BEGIN `7B Inner pillar(s).`7D X CASE randint(4) of `7B Place a door `7D X 1 : place_secret_door(y_height-1,xval); X 2 : place_secret_door(y_depth+1,xval); X 3 : place_secret_door(yval,x_left-1); X 4 : place_secret_door(yval,x_right+1); X END; X for i1 := yval-1 to yval+1 do X for i2 := xval-1 to xval+1 do X cave`5Bi1,i2`5D.fval := 8; X if (randint(2) = 1) then X BEGIN X CASE randint(2) of X 1 : BEGIN X for i1 := yval-1 to yval+1 do X for i2 := xval-6 to xval-4 do X cave`5Bi1,i2`5D.fval := 8; X for i1 := yval-1 to yval+1 do X for i2 := xval+4 to xval+6 do X cave`5Bi1,i2`5D.fval := 8; X END; X 2 : BEGIN X for i1 := yval-1 to yval+1 do X for i2 := xval-7 to xval-5 do X cave`5Bi1,i2`5D.fval := 8; X for i1 := yval-1 to yval+1 do X for i2 := xval+5 to xval+7 do X cave`5Bi1,i2`5D.fval := 8; X END; X END; X if (randint(3) = 1) then `7B Inner rooms `7D X BEGIN X for i1 := xval-5 to xval+5 do X BEGIN `20 X cave`5Byval-1,i1`5D.fval := 8; X cave`5Byval+1,i1`5D.fval := 8; X END; X CASE randint(2) of X 1 : place_secret_door(yval+1,xval-3); X 2 : place_secret_door(yval-1,xval-3); X END; X CASE randint(2) of X 1 : place_secret_door(yval+1,xval+3); X 2 : place_secret_door(yval-1,xval+3); X END; X if (randint(3) = 1) then place_object(yval,xval-2) V; X if (randint(3) = 1) then place_object(yval,xval+2) V; X vault_monster(yval,xval-2,randint(2)); X vault_monster(yval,xval+2,randint(2)); X END; X END; X END; X 4 : BEGIN `7B Maze inside..`7D X CASE randint(4) of `7B Place a door `7D X 1 : place_secret_door(y_height-1,xval); X 2 : place_secret_door(y_depth+1,xval); X 3 : place_secret_door(yval,x_left-1); X 4 : place_secret_door(yval,x_right+1); X END; X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X if (odd(i2+i1)) then X cave`5Bi1,i2`5D.fval := 8; X`7B Monsters just love mazes.`7D X vault_monster(yval,xval-5,randint(3)); X vault_monster(yval,xval+5,randint(3)); X`7B Traps make them entertaining.`7D X vault_trap(yval,xval-3,2,8,randint(3)); X vault_trap(yval,xval+3,2,8,randint(3)); X`7B Mazes should have some treasure too.. `7D X for i1 := 1 to 3 do X random_object(yval,xval,1); X END; X`09`095 : BEGIN `7B four small rooms ...`7D X`09`09`09for i1 := y_height to y_depth do X`09`09`09 cave`5Bi1,xval`5D.fval:=8; X`09`09`09for i1 := x_left to x_right do X`09`09`09 cave`5Byval,i1`5D.fval := 8; X`09`09`09CASE randint(3) of X`09`09`09 1 : BEGIN X`09`09`09`09i1 := randint(10); X`09`09`09`09place_secret_door(y_height-1,xval-i1); X`09`09`09`09place_secret_door(y_height-1,xval+i1); X`09`09`09`09place_secret_door(y_depth+1,xval-i1); X`09`09`09`09place_secret_door(y_depth+1,xval+i1); X`09`09`09 END; X`09`09`09 2 : BEGIN X`09`09`09`09i1 := randint(3); X`09`09`09`09place_secret_door(yval+i1,x_left-1); X`09`09`09`09place_secret_door(yval-i1,x_left-1); X`09`09`09`09place_secret_door(yval+i1,x_right+1); X`09`09`09`09place_secret_door(yval-i1,x_right+1) X`09`09`09 END; X`09`09`09 3 : BEGIN `7B make them dig for it ... REB`7D X`09`09`09`09place_secret_door(yval,xval); X`09`09`09 place_secret_door(y_height,xval) X`09`09`09 END X END; X`7B Treasure in each one.`7D X random_object(yval,xval,2+randint(2)); X`7B Gotta have some monsters.`7D X vault_monster(yval+2,xval-4,randint(2)); X vault_monster(yval+2,xval+4,randint(2)); X vault_monster(yval-2,xval-4,randint(2)); X vault_monster(yval-2,xval+4,randint(2)); X END; X END; X END; X `20 X `20 X`7B Builds a room at a row,column coordinate`20 X Type 3 unusual rooms are cross shaped `7D X procedure build_type3(yval,xval : integer); X var X y_height,y_depth,x_left,x_right,i0,i1,i2 : integer; X cur_floor : floor_type; X BEGIN X if (dun_level <= randint(25)) then X cur_floor := lopen_floor `7B Floor with light `7D X else X cur_floor := dopen_floor; `7B Dark floor `7D X i0 := 2 + randint(2); X y_height := yval - i0; X y_depth := yval + i0; X x_left := xval - 1; X x_right := xval + 1; X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X BEGIN +-+-+-+-+-+-+-+- END OF PART 23 +-+-+-+-+-+-+-+-