diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 077096f64307a5ea8435c30fb448e1dc9fa6a246..b88e98e47db41cd56cca60a09a9e0c49d4e974e0 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -1207,12 +1207,15 @@ function _M:setupCommands() end end, [{"_g","ctrl"}] = function() if config.settings.cheat then -- self:registerDialog(require("mod.dialogs.DownloadCharball").new()) - local f, err = loadfile("/data/general/events/cultists.lua") - print(f, err) - setfenv(f, setmetatable({level=self.level, zone=self.zone}, {__index=_G})) - print(pcall(f)) +-- local f, err = loadfile("/data/general/events/cultists.lua") +-- print(f, err) +-- setfenv(f, setmetatable({level=self.level, zone=self.zone}, {__index=_G})) +-- print(pcall(f)) + + local o = game.zone:makeEntity(game.level, "object", {type="weapon", random_object=true}, nil, true) + o:identify(true) + game.zone:addEntity(game.level, o, "object", game.player.x,game.player.y) --- FINISH CULTISTS EVENT end end, [{"_f","ctrl"}] = function() if config.settings.cheat then diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua index 3b8af24e2af631536f139822616ef890d3e64e72..146cd626db3e82bce2e468c5b011c4ed5522a292 100644 --- a/game/modules/tome/class/GameState.lua +++ b/game/modules/tome/class/GameState.lua @@ -286,8 +286,8 @@ function _M:generateRandart(data) local p = game.zone:pickEntity(list) if p then for t, _ in pairs(p.theme) do if themes[t] and randart_name_rules[t] then power_themes[t] = (power_themes[t] or 0) + 1 end end - powers[p.name] = p - powers[#powers+1] = p + powers[p.name] = p:clone() + powers[#powers+1] = powers[p.name] end end print("Selected powers:") table.print(powers) @@ -399,7 +399,7 @@ function _M:generateRandart(data) local i = 0 while hpoints > 0 and #powers >0 do i = util.boundWrap(i + 1, 1, #powers) - local p = powers[i]:clone() + local p = powers[i] if p.points <= hpoints then print(" * adding power: "..p.name) if p.wielder then @@ -417,6 +417,7 @@ function _M:generateRandart(data) if p.copy then merger(o, p.copy) end end hpoints = hpoints - p.points + p.points = p.points * 1.5 end o:resolve() o:resolve(nil, true) @@ -429,7 +430,7 @@ function _M:generateRandart(data) while hpoints > 0 do i = util.boundWrap(i + 1, 1, #bias_powers) - local p = bias_powers[i] and bias_powers[i]:clone() + local p = bias_powers[i] and bias_powers[i] if p and p.points <= hpoints * 2 then if p.wielder then o.wielder = o.wielder or {} @@ -439,6 +440,7 @@ function _M:generateRandart(data) print(" * adding bias power: "..p.name) end hpoints = hpoints - (p and p.points or 1) * 2 + if p then p.points = p.points * 1.5 end end -- Power source if none diff --git a/game/modules/tome/data/general/events/cultists.lua b/game/modules/tome/data/general/events/cultists.lua index 1f805216ced89930307560fc742241e4adbb4d44..61a2e73f3b5eb2f34e8aa81d0c55099aba9cc3b1 100644 --- a/game/modules/tome/data/general/events/cultists.lua +++ b/game/modules/tome/data/general/events/cultists.lua @@ -38,6 +38,8 @@ end local Talents = require("engine.interface.ActorTalents") +game.level.event_cultists = {sacrifice = 0, kill = 0} + for i, p in ipairs(list) do local g = game.level.map(p.x, p.y, engine.Map.TERRAIN):cloneFull() g.name = "monolith" @@ -45,6 +47,7 @@ for i, p in ipairs(list) do g.add_displays = g.add_displays or {} g.add_displays[#g.add_displays+1] = mod.class.Grid.new{image="terrain/moonstone_0"..rng.range(1,8)..".png", display_y=-1, display_h=2, z=18} g.nice_tiler = nil + g.is_monolith = true game.zone:addEntity(game.level, g, "terrain", p.x, p.y) local m = mod.class.NPC.new{ @@ -75,18 +78,74 @@ for i, p in ipairs(list) do }, resolvers.talents{ [Talents.T_BONE_SHIELD]={base=2, every=10, max=5}, - [Talents.T_BLOOD_SPRAY]={base=5, every=10, max=7}, - [Talents.T_DRAIN]={base=5, every=10, max=7}, - [Talents.T_SOUL_ROT]={base=5, every=10, max=7}, - [Talents.T_BLOOD_GRASP]={base=4, every=10, max=6}, - [Talents.T_BONE_SPEAR]={base=5, every=10, max=7}, + [Talents.T_BLOOD_SPRAY]={base=2, every=10, max=7}, + [Talents.T_DRAIN]={base=2, every=10, max=7}, + [Talents.T_SOUL_ROT]={base=2, every=10, max=7}, + [Talents.T_BLOOD_GRASP]={base=2, every=10, max=6}, + [Talents.T_BONE_SPEAR]={base=2, every=10, max=7}, }, resolvers.sustains_at_birth(), resolvers.inscriptions(1, "rune"), is_cultist_event = true, + monolith_x = p.x, + monolith_y = p.y, + on_die = function(self) + local g = game.level.map(self.monolith_x, self.monolith_y, engine.Map.TERRAIN) + if not g or not g.is_monolith then return end + if self.self_sacrifice then + self:doEmote(rng.table{"My soul for her!", "The Dark Queen shall reign!", "Take me! Take me!", "From death comes life!"}, 60) + g.add_displays[#g.add_displays].image = g.add_displays[#g.add_displays].image:gsub("/moonstone_0", "/darkgreen_moonstone_0") + g.name = "corrupted monolith" + game.level.event_cultists.sacrifice = game.level.event_cultists.sacrifice + 1 + else + self:doEmote(rng.table{"This is too soon!", "No the ritual will weaken!"}, 60) + g.add_displays[#g.add_displays].image = g.add_displays[#g.add_displays].image:gsub("/moonstone_0", "/bluish_moonstone_0") + g.name = "disrupted monolith" + game.level.event_cultists.kill = game.level.event_cultists.kill + 1 + end + g:removeAllMOs() + game.level.map:updateMap(self.monolith_x, self.monolith_y) + if not game.level.turn_counter then + game.level.turn_counter = 10 * 150 + game.level.max_turn_counter = 10 * 150 + require("engine.ui.Dialog"):simplePopup("Cultist", "The cultist soul seems to be absorbed by the strange stone he was guarding. You feel like something is about to happen...") + end + end, } m:resolve() m:resolve(nil, true) game.zone:addEntity(game.level, m, "actor", p.x-1, p.y) end +game.zone.cultist_event_levels = game.zone.cultist_event_levels or {} +game.zone.cultist_event_levels[level.level] = true + +if not game.zone.cultist_event_on_turn then game.zone.cultist_event_on_turn = game.zone.on_turn or function() end end +game.zone.on_turn = function() + if game.zone.cultist_event_on_turn then game.zone.cultist_event_on_turn() end + if not game.zone.cultist_event_levels[game.level.level] then return end + + if game.level.turn_counter then + game.level.turn_counter = game.level.turn_counter - 1 + game.player.changed = true + if game.level.turn_counter < 0 then + game.level.turn_counter = nil + + elseif game.level.turn_counter == 10 * 130 or + game.level.turn_counter == 10 * 110 or + game.level.turn_counter == 10 * 90 or + game.level.turn_counter == 10 * 70 or + game.level.turn_counter == 10 * 50 or + game.level.turn_counter == 10 * 30 then + local cultists = {} + for uid, e in pairs(game.level.entities) do if e.is_cultist_event then cultists[#cultists+1] = e end end + if #cultists > 0 then + local c = rng.table(cultists) + game.logSeen(c, "%s pulls a dagger and opens his own chest, piercing his beating heart. The stone glows with malevolent colors.", c.name:capitalize()) + c.self_sacrifice = true + c:die() + end + end + end +end + return true diff --git a/game/modules/tome/data/gfx/shockbolt/terrain/moonstone_01.png b/game/modules/tome/data/gfx/shockbolt/terrain/moonstone_01.png index 2ef60a63fc408c8000dbcd8f0349d15aa3033585..90f1e7a3c0c2ae3105e8a2fb502034d0f276bf6c 100644 Binary files a/game/modules/tome/data/gfx/shockbolt/terrain/moonstone_01.png and b/game/modules/tome/data/gfx/shockbolt/terrain/moonstone_01.png differ diff --git a/game/modules/tome/data/talents/gifts/summon-distance.lua b/game/modules/tome/data/talents/gifts/summon-distance.lua index 35eb40b44ca0c9c8c1ad7937d7e6044c84de890f..5bfb9bda09112e514043f552b099658ce429ac93 100644 --- a/game/modules/tome/data/talents/gifts/summon-distance.lua +++ b/game/modules/tome/data/talents/gifts/summon-distance.lua @@ -261,6 +261,7 @@ newTalent{ inc_stats = { wil=15 + (self:mindCrit(self:combatMindpower(2)) * self:getTalentLevel(t) / 5), cun=15 + (self:mindCrit(self:combatMindpower(1.7)) * self:getTalentLevel(t) / 5), + con=10 + self:getTalentLevelRaw(self.T_RESILIENCE)*2, }, level_range = {self.level, self.level}, exp_worth = 0,