From 16a29b4560a3cb071a10d81a3286a23aca4eca40 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 10 Dec 2012 09:50:26 +0000 Subject: [PATCH] Creatures in vaults will not be able to act (nor be damaged) until the vault is opened git-svn-id: http://svn.net-core.org/repos/t-engine4@6028 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/engine/Level.lua | 2 +- .../default/engine/interface/ActorTalents.lua | 2 +- game/engines/default/engine/resolvers.lua | 4 ++-- game/modules/tome/class/Actor.lua | 2 +- game/modules/tome/class/GameState.lua | 4 ++-- game/modules/tome/class/Grid.lua | 4 ++++ game/modules/tome/class/Player.lua | 18 +++++++++++++++++ .../class/interface/ActorInscriptions.lua | 2 +- .../tome/data/maps/vaults/amon-sul-crypt.lua | 2 +- .../tome/data/maps/vaults/bandit-fortress.lua | 2 +- game/modules/tome/data/maps/vaults/circle.lua | 2 +- .../modules/tome/data/maps/vaults/diggers.lua | 2 +- .../tome/data/maps/vaults/dragon_lair.lua | 2 +- .../data/maps/vaults/forest-snake-pit.lua | 2 +- .../data/maps/vaults/greater-checkerboard.lua | 2 +- .../tome/data/maps/vaults/honey_glade.lua | 2 +- .../tome/data/maps/vaults/horror-chamber.lua | 2 +- .../tome/data/maps/vaults/lava_island.lua | 2 +- .../tome/data/maps/vaults/loot-vault.lua | 2 +- .../tome/data/maps/vaults/mage-hideout.lua | 2 +- .../data/maps/vaults/old-forest-swamp.lua | 2 +- .../tome/data/maps/vaults/orc-necromancer.lua | 2 +- .../tome/data/maps/vaults/rat-nest.lua | 2 +- .../data/maps/vaults/skeleton-mage-cabal.lua | 2 +- .../tome/data/maps/vaults/spider-den.lua | 2 +- .../tome/data/maps/vaults/thief-hideout.lua | 2 +- .../tome/data/maps/vaults/treasure1.lua | 2 +- .../tome/data/maps/vaults/trickvault.lua | 1 - .../tome/data/maps/vaults/troll-hideout.lua | 2 +- .../modules/tome/data/rooms/greater_vault.lua | 15 ++++++++++++++ game/modules/tome/data/rooms/lesser_vault.lua | 15 ++++++++++++++ .../modules/tome/data/timed_effects/other.lua | 20 +++++++++++++++++++ .../tome/data/zones/dreadfell/zone.lua | 2 +- game/modules/tome/resolvers.lua | 7 +++---- 34 files changed, 104 insertions(+), 34 deletions(-) diff --git a/game/engines/default/engine/Level.lua b/game/engines/default/engine/Level.lua index e0c06618f5..75f9639716 100644 --- a/game/engines/default/engine/Level.lua +++ b/game/engines/default/engine/Level.lua @@ -160,7 +160,7 @@ function _M:setEntitiesList(type, list, permanent) else self.entities_list[type] = list end - print("Stored entities list", type, list) +-- print("Stored entities list", type, list) end --- Gets an entity list for the level, this allows the Zone to pick objects/actors/... diff --git a/game/engines/default/engine/interface/ActorTalents.lua b/game/engines/default/engine/interface/ActorTalents.lua index 4c21f8bb70..94fd23a0fd 100644 --- a/game/engines/default/engine/interface/ActorTalents.lua +++ b/game/engines/default/engine/interface/ActorTalents.lua @@ -263,7 +263,7 @@ end -- @param nb the amount to increase the raw talent level by, default 1 -- @return true if the talent was learnt, nil and an error message otherwise function _M:learnTalent(t_id, force, nb) - print("[TALENT]", self.name, self.uid, "learning", t_id, force, nb) +-- print("[TALENT]", self.name, self.uid, "learning", t_id, force, nb) local t = _M.talents_def[t_id] if not force then diff --git a/game/engines/default/engine/resolvers.lua b/game/engines/default/engine/resolvers.lua index 4896c6c8f3..1e7e270a80 100644 --- a/game/engines/default/engine/resolvers.lua +++ b/game/engines/default/engine/resolvers.lua @@ -86,7 +86,7 @@ function resolvers.calc.talents(t, e) level = level.base lvls = true end - print("Talent resolver for", e.name, ":", tid, "=>", level) +-- print("Talent resolver for", e.name, ":", tid, "=>", level) e:learnTalent(tid, true, level) end if lvls then e._levelup_talents = levelup_talents end @@ -108,7 +108,7 @@ function resolvers.calc.rngtalent(t, e) level = level.base lvls = true end - print("RNG Talent resolver for", e.name, ":", tid, "=>", level) +-- print("RNG Talent resolver for", e.name, ":", tid, "=>", level) e:learnTalent(tid, true, level) if lvls then e._levelup_talents = levelup_talents end diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index bf86bbfb71..c0f1152854 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -610,7 +610,7 @@ function _M:act() end end if self:attr("stoned") then self.energy.value = 0 end --- if self:attr("dazed") then self.energy.value = 0 end + if self:attr("dont_act") then self.energy.value = 0 end if self:attr("sleep") and not self:attr("lucid_dreamer") then self.energy.value = 0 end if self:attr("time_stun") then self.energy.value = 0 end if self:attr("time_prison") then self.energy.value = 0 end diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua index 919356aeb0..a8fdfc7eeb 100644 --- a/game/modules/tome/class/GameState.lua +++ b/game/modules/tome/class/GameState.lua @@ -1007,7 +1007,7 @@ local loot_mod = { local default_drops = function(zone, level, what) if zone.default_drops then return zone.default_drops end local lev = util.bound(math.ceil(zone:level_adjust_level(level, "object") / 10), 1, 5) - print("[TOME ENTITY FILTER] making default loot table for", what, lev) +-- print("[TOME ENTITY FILTER] making default loot table for", what, lev) return table.clone(drop_tables[what][lev]) end @@ -1038,7 +1038,7 @@ function _M:entityFilterAlter(zone, level, type, filter) t = table.clone(t) if _G.type(filter.tome_mod) == "string" then filter.tome_mod = loot_mod[filter.tome_mod] end for k, v in pairs(filter.tome_mod) do - print(" ***** LOOT MOD", k, v) +-- print(" ***** LOOT MOD", k, v) t[k] = (t[k] or 0) * v end end diff --git a/game/modules/tome/class/Grid.lua b/game/modules/tome/class/Grid.lua index 5a04a351e7..0b2c347444 100644 --- a/game/modules/tome/class/Grid.lua +++ b/game/modules/tome/class/Grid.lua @@ -54,6 +54,8 @@ function _M:block_move(x, y, e, act, couldpass) if ret then game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened]) game:playSoundNear({x=x,y=y}, {"ambient/door_creaks/creak_%d",1,4}) + + if game.level.map.attrs(x, y, "vault_id") and e.openVault then e:openVault(game.level.map.attrs(x, y, "vault_id")) end end end, "Open", "Leave") end @@ -64,6 +66,8 @@ function _M:block_move(x, y, e, act, couldpass) else game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened]) game:playSoundNear({x=x,y=y}, {"ambient/door_creaks/creak_%d",1,4}) + + if game.level.map.attrs(x, y, "vault_id") and e.openVault then e:openVault(game.level.map.attrs(x, y, "vault_id")) end end return true elseif self.door_opened and not couldpass then diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index d00d61c06a..4fa241d2fd 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -201,6 +201,22 @@ function _M:describeFloor(x, y, force) end end +function _M:openVault(vault_id) + local v = game.level.vaults_list[vault_id] + if not v then return end + + print("Vault id", vault_id, "opens:", v.x, v.y, v.w, v.h) + for i = v.x, v.x + v.w - 1 do for j = v.y, v.y + v.h - 1 do + if game.level.map.attrs(i, j, "vault_id") == vault_id then + game.level.map.attrs(i, j, "vault_id", false) + local act = game.level.map(i, j, Map.ACTOR) + if act and not act.player then + act:removeEffect(act.EFF_VAULTED, true, true) + end + end + end end +end + function _M:move(x, y, force) local ox, oy = self.x, self.y local moved = mod.class.Actor.move(self, x, y, force) @@ -217,6 +233,8 @@ function _M:move(x, y, force) game.level.map.attrs(self.x, self.y, "walked", true) if self.describeFloor then self:describeFloor(self.x, self.y) end + + if not force and game.level.map.attrs(self.x, self.y, "vault_id") and not game.level.map.attrs(self.x, self.y, "vault_only_door_open") then self:openVault(game.level.map.attrs(self.x, self.y, "vault_id")) end end -- if not force and ox == self.x and oy == self.y and self.tryPlayerSlide then diff --git a/game/modules/tome/class/interface/ActorInscriptions.lua b/game/modules/tome/class/interface/ActorInscriptions.lua index 8b483b5874..9234b41506 100644 --- a/game/modules/tome/class/interface/ActorInscriptions.lua +++ b/game/modules/tome/class/interface/ActorInscriptions.lua @@ -99,7 +99,7 @@ function _M:setInscription(id, name, data, cooldown, vocal, src, bypass_max_same if src and src.obj then data.item_name = src.obj:getName{do_color=true, no_count=true}:toTString() end self.inscriptions_data[name] = data self.inscriptions[id] = name - print("Inscribing on "..self.name..": "..tostring(name)) +-- print("Inscribing on "..self.name..": "..tostring(name)) self:learnTalent(self["T_"..name], true, 1, {no_unlearn=true}) local t = self:getTalentFromId(self["T_"..name]) if cooldown then self:startTalentCooldown(t) end diff --git a/game/modules/tome/data/maps/vaults/amon-sul-crypt.lua b/game/modules/tome/data/maps/vaults/amon-sul-crypt.lua index f23d93c546..20b6ab5970 100644 --- a/game/modules/tome/data/maps/vaults/amon-sul-crypt.lua +++ b/game/modules/tome/data/maps/vaults/amon-sul-crypt.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile('.', "FLOOR") defineTile('#', "WALL") diff --git a/game/modules/tome/data/maps/vaults/bandit-fortress.lua b/game/modules/tome/data/maps/vaults/bandit-fortress.lua index 7c74cff6d2..298e7a8082 100644 --- a/game/modules/tome/data/maps/vaults/bandit-fortress.lua +++ b/game/modules/tome/data/maps/vaults/bandit-fortress.lua @@ -18,7 +18,7 @@ -- darkgod@te4.org --bandit fortress -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} defineTile('%', "WALL") defineTile('.', "FLOOR") diff --git a/game/modules/tome/data/maps/vaults/circle.lua b/game/modules/tome/data/maps/vaults/circle.lua index fddddad503..35349b0032 100644 --- a/game/modules/tome/data/maps/vaults/circle.lua +++ b/game/modules/tome/data/maps/vaults/circle.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile('.', "FLOOR") defineTile('X', "HARDWALL") diff --git a/game/modules/tome/data/maps/vaults/diggers.lua b/game/modules/tome/data/maps/vaults/diggers.lua index b74b8dc1fc..9637fca902 100644 --- a/game/modules/tome/data/maps/vaults/diggers.lua +++ b/game/modules/tome/data/maps/vaults/diggers.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile(';', "FLOOR", nil, nil, nil, {room_map={special=false, room=false, can_open=true}}) defineTile('.', "FLOOR") diff --git a/game/modules/tome/data/maps/vaults/dragon_lair.lua b/game/modules/tome/data/maps/vaults/dragon_lair.lua index f261f4f9ab..20856126f4 100644 --- a/game/modules/tome/data/maps/vaults/dragon_lair.lua +++ b/game/modules/tome/data/maps/vaults/dragon_lair.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} startx = 25 starty = 6 diff --git a/game/modules/tome/data/maps/vaults/forest-snake-pit.lua b/game/modules/tome/data/maps/vaults/forest-snake-pit.lua index ad9555f99e..11a17f932e 100644 --- a/game/modules/tome/data/maps/vaults/forest-snake-pit.lua +++ b/game/modules/tome/data/maps/vaults/forest-snake-pit.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/maps/vaults/greater-checkerboard.lua b/game/modules/tome/data/maps/vaults/greater-checkerboard.lua index 170f9365ff..1d39a06c65 100644 --- a/game/modules/tome/data/maps/vaults/greater-checkerboard.lua +++ b/game/modules/tome/data/maps/vaults/greater-checkerboard.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile('.', "FLOOR") defineTile('#', "WALL") diff --git a/game/modules/tome/data/maps/vaults/honey_glade.lua b/game/modules/tome/data/maps/vaults/honey_glade.lua index 12c4600e4a..02b129bb88 100644 --- a/game/modules/tome/data/maps/vaults/honey_glade.lua +++ b/game/modules/tome/data/maps/vaults/honey_glade.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile('!', "ROCK_VAULT", nil, nil, nil, {room_map={special=false, room=false, can_open=true}}) defineTile(' ', "GRASS") diff --git a/game/modules/tome/data/maps/vaults/horror-chamber.lua b/game/modules/tome/data/maps/vaults/horror-chamber.lua index b7d94185e9..3e398f09f5 100644 --- a/game/modules/tome/data/maps/vaults/horror-chamber.lua +++ b/game/modules/tome/data/maps/vaults/horror-chamber.lua @@ -19,7 +19,7 @@ -- Horror Chamber -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} startx = 2 starty = 1 diff --git a/game/modules/tome/data/maps/vaults/lava_island.lua b/game/modules/tome/data/maps/vaults/lava_island.lua index 088926ca64..da3255dddb 100644 --- a/game/modules/tome/data/maps/vaults/lava_island.lua +++ b/game/modules/tome/data/maps/vaults/lava_island.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, no_vaulted=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/maps/vaults/loot-vault.lua b/game/modules/tome/data/maps/vaults/loot-vault.lua index 33c7b6e454..f86d0268b3 100644 --- a/game/modules/tome/data/maps/vaults/loot-vault.lua +++ b/game/modules/tome/data/maps/vaults/loot-vault.lua @@ -16,7 +16,7 @@ -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/maps/vaults/mage-hideout.lua b/game/modules/tome/data/maps/vaults/mage-hideout.lua index eba67bd8ec..df4c0a37ac 100644 --- a/game/modules/tome/data/maps/vaults/mage-hideout.lua +++ b/game/modules/tome/data/maps/vaults/mage-hideout.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, no_vaulted=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/maps/vaults/old-forest-swamp.lua b/game/modules/tome/data/maps/vaults/old-forest-swamp.lua index 6839c069c3..4c8110f685 100644 --- a/game/modules/tome/data/maps/vaults/old-forest-swamp.lua +++ b/game/modules/tome/data/maps/vaults/old-forest-swamp.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, no_vaulted=true} defineTile(',', "GRASS") defineTile(';', "GRASS_DARK1") diff --git a/game/modules/tome/data/maps/vaults/orc-necromancer.lua b/game/modules/tome/data/maps/vaults/orc-necromancer.lua index 7d4673cc19..bed278b2fd 100644 --- a/game/modules/tome/data/maps/vaults/orc-necromancer.lua +++ b/game/modules/tome/data/maps/vaults/orc-necromancer.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} defineTile('.', "FLOOR") diff --git a/game/modules/tome/data/maps/vaults/rat-nest.lua b/game/modules/tome/data/maps/vaults/rat-nest.lua index 8b3fc65287..76d176e2da 100644 --- a/game/modules/tome/data/maps/vaults/rat-nest.lua +++ b/game/modules/tome/data/maps/vaults/rat-nest.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, no_vaulted=true} defineTile('.', "FLOOR") defineTile('D', "DOOR") diff --git a/game/modules/tome/data/maps/vaults/skeleton-mage-cabal.lua b/game/modules/tome/data/maps/vaults/skeleton-mage-cabal.lua index 563e4b66f2..36822059a3 100644 --- a/game/modules/tome/data/maps/vaults/skeleton-mage-cabal.lua +++ b/game/modules/tome/data/maps/vaults/skeleton-mage-cabal.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile('.', "FLOOR") defineTile('D', "DOOR") diff --git a/game/modules/tome/data/maps/vaults/spider-den.lua b/game/modules/tome/data/maps/vaults/spider-den.lua index 6d31a6119d..a5bb2e27a0 100644 --- a/game/modules/tome/data/maps/vaults/spider-den.lua +++ b/game/modules/tome/data/maps/vaults/spider-den.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} startx = 7 starty = 0 diff --git a/game/modules/tome/data/maps/vaults/thief-hideout.lua b/game/modules/tome/data/maps/vaults/thief-hideout.lua index 7f10a54034..6aa4c97313 100644 --- a/game/modules/tome/data/maps/vaults/thief-hideout.lua +++ b/game/modules/tome/data/maps/vaults/thief-hideout.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/maps/vaults/treasure1.lua b/game/modules/tome/data/maps/vaults/treasure1.lua index 90149ecd58..797a277671 100644 --- a/game/modules/tome/data/maps/vaults/treasure1.lua +++ b/game/modules/tome/data/maps/vaults/treasure1.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} defineTile(';', "FLOOR", nil, nil, nil, {room_map={special=false, room=false, can_open=true}}) defineTile('.', "FLOOR") diff --git a/game/modules/tome/data/maps/vaults/trickvault.lua b/game/modules/tome/data/maps/vaults/trickvault.lua index 28807af6d4..98ebf2df07 100644 --- a/game/modules/tome/data/maps/vaults/trickvault.lua +++ b/game/modules/tome/data/maps/vaults/trickvault.lua @@ -25,7 +25,6 @@ setStatusAll{no_teleport=true} specialList("terrain", { "/data/general/grids/basic.lua", "/data/general/grids/lava.lua", - "/data/general/grids/.lua", }) defineTile('#', "HARDWALL") diff --git a/game/modules/tome/data/maps/vaults/troll-hideout.lua b/game/modules/tome/data/maps/vaults/troll-hideout.lua index 8acd39334c..18787248b0 100644 --- a/game/modules/tome/data/maps/vaults/troll-hideout.lua +++ b/game/modules/tome/data/maps/vaults/troll-hideout.lua @@ -17,7 +17,7 @@ -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -setStatusAll{no_teleport=true} +setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} diff --git a/game/modules/tome/data/rooms/greater_vault.lua b/game/modules/tome/data/rooms/greater_vault.lua index e06010327b..36d794ef0c 100644 --- a/game/modules/tome/data/rooms/greater_vault.lua +++ b/game/modules/tome/data/rooms/greater_vault.lua @@ -44,12 +44,27 @@ return function(gen, id, lev, old_lev) local w = vault_map.w local h = vault_map.h return { name="greater_vault-"..vaultid.."-"..w.."x"..h, w=w, h=h, generator = function(self, x, y, is_lit) + gen.level.vaults_list = gen.level.vaults_list or {} + gen.level.vaults_list[#gen.level.vaults_list+1] = {x=x, y=y, w=w, h=h} + local vaultuid = #gen.level.vaults_list + gen.map:import(vault_map, x, y) -- Make it a room, and make it special so that we do not tunnel through for i = x, x + w - 1 do for j = y, y + h - 1 do gen.map.room_map[i][j].special = true gen.map.room_map[i][j].room = id gen.map.attrs(i, j, "no_decay", true) + gen.map.attrs(i, j, "vault_id", vaultuid) + + -- Creatures in vaults dont get to act until it is opened + if not gen.map.attrs(i, j, "no_vaulted") and gen.map.room_map[i][j].add_entities then for _, rm in ipairs(gen.map.room_map[i][j].add_entities) do + if rm[1] == "actor" then + local act = rm[2] + if act and not act.player then + act:setEffect(act.EFF_VAULTED, 1, {}) + end + end + end end end end if vault.gen_map.startx and vault.gen_map.starty then gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="greater"} diff --git a/game/modules/tome/data/rooms/lesser_vault.lua b/game/modules/tome/data/rooms/lesser_vault.lua index fef77f3eab..6a159f50da 100644 --- a/game/modules/tome/data/rooms/lesser_vault.lua +++ b/game/modules/tome/data/rooms/lesser_vault.lua @@ -41,12 +41,27 @@ return function(gen, id, lev, old_lev) local w = vault_map.w local h = vault_map.h return { name="lesser_vault-"..vaultid.."-"..w.."x"..h, w=w, h=h, generator = function(self, x, y, is_lit) + gen.level.vaults_list = gen.level.vaults_list or {} + gen.level.vaults_list[#gen.level.vaults_list+1] = {x=x, y=y, w=w, h=h} + local vaultuid = #gen.level.vaults_list + gen.map:import(vault_map, x, y) -- Make it a room, and make it special so that we do not tunnel through for i = x, x + w - 1 do for j = y, y + h - 1 do gen.map.room_map[i][j].special = true gen.map.room_map[i][j].room = id gen.map.attrs(i, j, "no_decay", true) + gen.map.attrs(i, j, "vault_id", vaultuid) + + -- Creatures in vaults dont get to act until it is opened + if not gen.map.attrs(i, j, "no_vaulted") and gen.map.room_map[i][j].add_entities then for _, rm in ipairs(gen.map.room_map[i][j].add_entities) do + if rm[1] == "actor" then + local act = rm[2] + if act and not act.player then + act:setEffect(act.EFF_VAULTED, 1, {}) + end + end + end end end end if vault.gen_map.startx and vault.gen_map.starty then gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="lesser"} diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index 097d567ca9..913e27cac2 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -2100,3 +2100,23 @@ newEffect{ deactivate = function(self, eff) end, } + +newEffect{ + name = "VAULTED", image = "talents/time_prison.png", + desc = "In Vault", + long_desc = function(self, eff) return "The target is part of a vault and can not act until it has been openend." end, + decrease = 0, no_remove = true, + type = "other", + subtype = { vault=true }, + status = "neutral", + parameters = {}, + activate = function(self, eff) + self:effectTemporaryValue(eff, "invulnerable", 1) + self:effectTemporaryValue(eff, "dont_act", 1) + self:effectTemporaryValue(eff, "no_timeflow", 1) + self:effectTemporaryValue(eff, "status_effect_immune", 1) + self.energy.value = 0 + end, + deactivate = function(self, eff) + end, +} diff --git a/game/modules/tome/data/zones/dreadfell/zone.lua b/game/modules/tome/data/zones/dreadfell/zone.lua index deec144c21..a98324ab20 100644 --- a/game/modules/tome/data/zones/dreadfell/zone.lua +++ b/game/modules/tome/data/zones/dreadfell/zone.lua @@ -37,7 +37,7 @@ return { class = "engine.generator.map.Roomer", nb_rooms = 10, rooms = {"random_room", {"money_vault",5}, {"pit",7}, {"greater_vault",8}}, --- rooms = {"random_room", "greater_vault"}, +-- rooms = {"random_room", "lesser_vault"}, -- greater_vaults_list = {"trickvault"}, rooms_config = {pit={filters={{type="undead"}}}}, lite_room_chance = 100, diff --git a/game/modules/tome/resolvers.lua b/game/modules/tome/resolvers.lua index 356232922e..7e8bf314f7 100644 --- a/game/modules/tome/resolvers.lua +++ b/game/modules/tome/resolvers.lua @@ -54,7 +54,6 @@ function resolvers.calc.equip(t, e) if filter.autoreq and rawget(o, "require") and rawget(o, "require").stat then -- print("Autorequire stats") for s, v in pairs(rawget(o, "require").stat) do - print(s,v) if e:getStat(s) < v then e.unused_stats = e.unused_stats - (v - e:getStat(s)) e:incStat(s, v - e:getStat(s)) @@ -67,7 +66,7 @@ function resolvers.calc.equip(t, e) end -- Do not drop it unless it is an ego or better - if not o.unique then o.no_drop = true print(" * "..o.name.." => no drop") end + if not o.unique then o.no_drop = true --[[print(" * "..o.name.." => no drop")]] end if filter.force_drop then o.no_drop = nil end if filter.never_drop then o.no_drop = true end game.zone:addEntity(game.level, o, "object") @@ -215,7 +214,7 @@ function resolvers.calc.store(t, e) return true end e.store = game:getStore(t) - print("[STORE] created for entity", t, e, e.name) +-- print("[STORE] created for entity", t, e, e.name) -- Delete the origin field return nil @@ -442,7 +441,7 @@ function resolvers.calc.sustains_at_birth(_, e) local t = self:getTalentFromId(tid) if t and t.mode == "sustained" then self.energy.value = game.energy_to_act - print("===== activating sustain", self.name, tid) +-- print("===== activating sustain", self.name, tid) self:useTalent(tid) end end -- GitLab