Skip to content
Snippets Groups Projects
Commit de0308f2 authored by dg's avatar dg
Browse files

Added monster pits to some zones, have .. fun

git-svn-id: http://svn.net-core.org/repos/t-engine4@946 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3a9ce4ab
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,8 @@ function _M:init(zone, map, level, data)
end
function _M:loadRoom(file)
local f = loadfile("/data/rooms/"..file..".lua")
local f, err = loadfile("/data/rooms/"..file..".lua")
if not f and err then error(err) end
setfenv(f, setmetatable({
Map = require("engine.Map"),
}, {__index=_G}))
......
......@@ -580,7 +580,7 @@ function _M:setupCommands()
self.player:forceLevelup(50)
self.player.esp.all = 1
self.player.esp.range = 50
self:changeLevel(1, "eruan")
self:changeLevel(1, "tol-falas")
-- self.player:grantQuest("escort-duty")
end
end,
......
......@@ -20,13 +20,16 @@
local Heightmap = require "engine.Heightmap"
return function(gen, id)
local w = rng.range(5, 12)
local h = rng.range(5, 12)
local w = rng.range(6, 10)
local h = rng.range(6, 10)
return { name="forest_clearing"..w.."x"..h, w=w, h=h, generator = function(self, x, y, is_lit)
-- make the fractal heightmap
local hm = Heightmap.new(self.w, self.h, 2, {middle=Heightmap.min, up_left=Heightmap.max, down_left=Heightmap.max, up_right=Heightmap.max, down_right=Heightmap.max})
hm:generate()
local ispit = gen.data.rooms_config and gen.data.rooms_config.forest_clearing and rng.percent(gen.data.rooms_config.forest_clearing.pit_chance)
if ispit then ispit = rng.table(gen.data.rooms_config.forest_clearing.filters) end
for i = 1, self.w do
for j = 1, self.h do
if hm.hmap[i][j] >= Heightmap.max * 5 / 6 then
......@@ -35,6 +38,13 @@ return function(gen, id)
else
gen.map.room_map[i-1+x][j-1+y].room = id
gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('.'))
if ispit then
local e = gen.zone:makeEntity(gen.level, "actor", ispit, nil, true)
if e then
gen.zone:addEntity(gen.level, e, "actor", i-1+x, j-1+y)
end
end
end
if is_lit then gen.map.lites(i-1+x, j-1+y, true) end
end
......
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return function(gen, id)
local w = rng.range(7, 12)
local h = rng.range(7, 12)
return { name="pit"..w.."x"..h, w=w, h=h, generator = function(self, x, y, is_lit)
local filter = rng.table(gen.data.rooms_config.pit.filters)
-- Draw the room
for i = 1, self.w do
for j = 1, self.h do
if i == 1 or i == self.w or j == 1 or j == self.h then
gen.map.room_map[i-1+x][j-1+y].can_open = true
gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('#'))
else
gen.map.room_map[i-1+x][j-1+y].room = id
gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('.'))
end
if is_lit then gen.map.lites(i-1+x, j-1+y, true) end
end
end
-- Draw the inner room and populate it
local doors = {}
for i = 3, self.w - 2 do
for j = 3, self.h - 2 do
if i == 3 or i == self.w - 2 or j == 3 or j == self.h - 2 then
gen.map.room_map[i-1+x][j-1+y].can_open = false
gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('#'))
doors[#doors+1] = {i-1+x, j-1+y}
else
local e = gen.zone:makeEntity(gen.level, "actor", filter, nil, true)
if e then gen.zone:addEntity(gen.level, e, "actor", i-1+x, j-1+y) end
end
if is_lit then gen.map.lites(i-1+x, j-1+y, true) end
end
end
local door = rng.table(doors)
gen.map(door[1], door[2], Map.TERRAIN, gen:resolve('+'))
end}
end
......@@ -35,6 +35,7 @@ return {
nb_rooms = 10,
edge_entrances = {2,8},
rooms = {"forest_clearing","rocky_snowy_trees"},
rooms_config = {forest_clearing={pit_chance=5, filters={{}}},
['.'] = "ROCKY_GROUND",
['T'] = "ROCKY_SNOWY_TREE",
['#'] = "MOUNTAIN_WALL",
......
......@@ -35,6 +35,7 @@ return {
nb_rooms = 10,
edge_entrances = {6,4},
rooms = {"forest_clearing"},
rooms_config = {forest_clearing={pit_chance=5, filters={{type="insect", subtype="ant"}, {type="insect"}, {type="animal", subtype="snake"}, {type="animal", subtype="canine"}}}},
['.'] = "GRASS_DARK1",
['#'] = {"TREE_DARK1","TREE_DARK2","TREE_DARK3","TREE_DARK4","TREE_DARK5","TREE_DARK6","TREE_DARK7","TREE_DARK8","TREE_DARK9","TREE_DARK10","TREE_DARK11","TREE_DARK12","TREE_DARK13","TREE_DARK14","TREE_DARK15","TREE_DARK16","TREE_DARK17","TREE_DARK18","TREE_DARK19","TREE_DARK20",},
up = "UP",
......
......@@ -33,7 +33,8 @@ return {
map = {
class = "engine.generator.map.Roomer",
nb_rooms = 10,
rooms = {"simple", "pilar", {"money_vault",5}},
rooms = {"simple", "pilar", {"money_vault",5}, {"pit",7}},
rooms_config = {pit={filters={{type="undead"}}},
lite_room_chance = 100,
['.'] = "FLOOR",
['#'] = "WALL",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment