diff --git a/game/engines/default/engine/tilemaps/Tilemap.lua b/game/engines/default/engine/tilemaps/Tilemap.lua index 75751d70d27c207482a25019e54f17b5749fab79..f44b2c35d17bcce0c0d2a5142d3b9c4b6c6ae0dd 100644 --- a/game/engines/default/engine/tilemaps/Tilemap.lua +++ b/game/engines/default/engine/tilemaps/Tilemap.lua @@ -87,6 +87,23 @@ function _M:point(x, y) end end +function _M:pointIterator(sx, sy, tx, ty) + sx = sx or 1 + sy = sy or 1 + tx = tx or self.data_w + ty = ty or self.data_h + local ps = {} + for i = sx, tx do for j = sy, ty do + ps[#ps+1] = self:point(i, j) + end end + local i = 0 + return function() + if i >= #ps then return nil end + i = i + 1 + return ps[i] + end +end + point_meta = { __add = function(a, b) if type(b) == "number" then return _M:point(a.x + b, a.y + b) @@ -603,6 +620,12 @@ group_meta = { end g:updateReverse() end, + fill = function(g, map, ...) + local chars = {...} + for i, p in ipairs(g.list) do + map:put(p, (rng.table(chars))) + end + end, hasPoint = function(g, x, y) if type(x) == "table" then x, y = x.x, x.y end return g.reverse[x] and g.reverse[x][y] diff --git a/game/engines/default/engine/utils.lua b/game/engines/default/engine/utils.lua index 11434f1bedebe536c82f1483cfe7a06054d13f91..a7f0c5f32d71b7450c5c1edd30b681818131113a 100644 --- a/game/engines/default/engine/utils.lua +++ b/game/engines/default/engine/utils.lua @@ -606,6 +606,18 @@ function table.compareKeys(left, right) return result end +--- Checks if a (sub)subentry of a table exists +function table.has(t, ...) + if type(t) ~= 'table' then return false end + local args = {...} + local last = table.remove(args) + for _, key in ipairs(args) do + t = t[key] + if type(t) ~= 'table' then return false end + end + return t[last] +end + --[=[ Decends recursively through a table by the given list of keys. diff --git a/game/modules/tome/class/NicerTiles.lua b/game/modules/tome/class/NicerTiles.lua index ee844edd8069edcbda5b4754143307da6ab7ee15..57e9eb8bb6c14a7cb629797b639f77352dde1a2a 100644 --- a/game/modules/tome/class/NicerTiles.lua +++ b/game/modules/tome/class/NicerTiles.lua @@ -114,7 +114,7 @@ function _M:replaceAll(level) local r = self.repl[i] -- Safety check local og = level.map(r[1], r[2], Map.TERRAIN) - if og and (og.change_zone or og.change_level) then + if og and (og.change_zone or og.change_level) and not og.change_level_allow_nice_tile then print("[NICE TILER] *warning* refusing to remove zone/level changer at ", r[1], r[2], og.change_zone, og.change_level) else local no = overlay(self, level, "replace", r[1], r[2], r[3]) diff --git a/game/modules/tome/data/general/npcs/minor-demon.lua b/game/modules/tome/data/general/npcs/minor-demon.lua index f1f878d2f4c0dda27e081688c954b2696c3dcbd5..ac9ae743873d903230e7b3f44017ee9079c682e9 100644 --- a/game/modules/tome/data/general/npcs/minor-demon.lua +++ b/game/modules/tome/data/general/npcs/minor-demon.lua @@ -89,7 +89,7 @@ newEntity{ base = "BASE_NPC_DEMON", } newEntity{ base = "BASE_NPC_DEMON", - name = "onilug", color=colors.LIGHT_GREY, + name = "onilug", color=colors.GREY, desc = _t[[A gaunt vaguely humanoid shape featuring unadorned grey leathery skin. Its arms and legs seem somehow too long and it stands toll, projecting an ominous shadow even in darkness. Its glowing red eyes shiny with both cruelty and a deep frightening intellect.]], level_range = {10, nil}, exp_worth = 1, diff --git a/game/modules/tome/data/general/objects/boss-artifacts-maj-eyal.lua b/game/modules/tome/data/general/objects/boss-artifacts-maj-eyal.lua index 902ded6247ce8d73bd1ae43ca864e4125d18454f..d682562cd1bf4028df9b7e5428b1a35fb465ec67 100644 --- a/game/modules/tome/data/general/objects/boss-artifacts-maj-eyal.lua +++ b/game/modules/tome/data/general/objects/boss-artifacts-maj-eyal.lua @@ -1767,8 +1767,8 @@ newEntity{ base = "BASE_GAUNTLETS", define_as = "STORM_BRINGER_GAUNTLETS", talents_add_levels_filters = { {desc=_t"+1 to all lightning damage spells", filter=function(who, t, lvl) if t.is_spell and t.tactical and ( - table.get(t.tactical, "attack", "LIGHTNING") or - table.get(t.tactical, "attackarea", "LIGHTNING") + table.has(t.tactical, "attack", "LIGHTNING") or + table.has(t.tactical, "attackarea", "LIGHTNING") ) then return lvl + 1 end