From 891f57746c09eb035d8b7970e296679cd7ae8d02 Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Tue, 10 Jun 2014 00:17:33 +0200 Subject: [PATCH] Rare items/randarts with negative life will not always spawn with the max value --- game/modules/tome/class/Game.lua | 11 ++++------- game/modules/tome/class/GameState.lua | 10 ++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 42a5f97909..d282b736bf 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -1580,14 +1580,11 @@ function _M:setupCommands() print("===============") end end, [{"_g","ctrl"}] = function() if config.settings.cheat then - collectgarbage("collect") - local nb = 0 - for k, e in pairs(__uids) do nb = nb + 1 end - game.log("NB: " .. nb) - for z, _ in pairs(engine.Zone.__zone_store) do - game.log("Zone store: " .. z.name) + local o = game.zone:makeEntity(game.level, "object", {random_object=true}, nil, true) + if o then + o:identify(true) + game.zone:addEntity(game.level, o, "object", game.player.x, game.player.y) end - do return end local f, err = loadfile("/data/general/events/fearscape-portal.lua") print(f, err) diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua index 5ea24a01d9..5099596aa1 100644 --- a/game/modules/tome/class/GameState.lua +++ b/game/modules/tome/class/GameState.lua @@ -413,8 +413,14 @@ function _M:generateRandart(data) if type(e) == "table" then if e.__resolver and e.__resolver == "randartmax" then dst[k] = (dst[k] or 0) + e.v - if dst[k] > e.max * scale then --Adjust maximum values for higher levels - dst[k] = math.floor(e.max * scale) + if e.max < 0 then + if dst[k] < e.max * scale then --Adjust maximum values for higher levels + dst[k] = math.floor(e.max * scale) + end + else + if dst[k] > e.max * scale then --Adjust maximum values for higher levels + dst[k] = math.floor(e.max * scale) + end end else if not dst[k] then dst[k] = {} end -- GitLab