From f40c8b034ef6e86494e5484b92dba0914a3b5a10 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Tue, 25 Jan 2011 09:23:50 +0000 Subject: [PATCH] tone down randomness of NPC inscriptions a bit git-svn-id: http://svn.net-core.org/repos/t-engine4@2498 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Actor.lua | 4 +++- .../tome/class/interface/ActorInscriptions.lua | 12 +++++++++++- game/modules/tome/resolvers.lua | 13 ++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index c180b74eb4..32fb2522d5 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -683,7 +683,9 @@ function _M:onHeal(value, src) if self:hasEffect(self.EFF_UNSTOPPABLE) then return 0 end - return value * (self.healing_factor or 1) + value = value * (self.healing_factor or 1) + print("[HEALING]", self.uid, self.name, "for", value) + return value end --- Called before taking a hit, it's the chance to check for shields diff --git a/game/modules/tome/class/interface/ActorInscriptions.lua b/game/modules/tome/class/interface/ActorInscriptions.lua index 587e47aeb9..59776e66ea 100644 --- a/game/modules/tome/class/interface/ActorInscriptions.lua +++ b/game/modules/tome/class/interface/ActorInscriptions.lua @@ -111,7 +111,17 @@ function _M:getInscriptionData(name) assert(fake or self.inscriptions_data[name], "unknown inscription "..name) local d = table.clone(fake or self.inscriptions_data[name]) d.inc_stat = 0 - if d.use_stat and d.use_stat_mod then d.inc_stat = self:getStat(d.use_stat) * d.use_stat_mod end + if d.use_any_stat and d.use_stat_mod then + local max = math.max( + self:getStr(), + self:getDex(), + self:getCon(), + self:getMag(), + self:getWil(), + self:getCun() + ) * d.use_any_stat + d.inc_stat = max * d.use_stat_mod + elseif d.use_stat and d.use_stat_mod then d.inc_stat = self:getStat(d.use_stat) * d.use_stat_mod end return d end diff --git a/game/modules/tome/resolvers.lua b/game/modules/tome/resolvers.lua index ee60d7f74e..8b1c19cc07 100644 --- a/game/modules/tome/resolvers.lua +++ b/game/modules/tome/resolvers.lua @@ -243,12 +243,18 @@ end --- Random bonus based on level, more strict resolvers.current_level = 1 function resolvers.mbonus_level(max, add, pricefct, step) - return {__resolver="mbonus", max, add, pricefct} -- mbonus_level does not work really well, skip it for now + return {__resolver="mbonus_level", max, add, step or 10, pricefct} -- mbonus_level does not work really well, skip it for now end function resolvers.calc.mbonus_level(t, e) + local max = resolvers.mbonus_max_level + local ml = 1 + math.floor((resolvers.current_level - 1) / t[3]) - local maxl = 1 + math.floor((resolvers.mbonus_max_level - 1) / t[3]) - local v = math.ceil(rng.mbonus(t[1], resolvers.current_level, resolvers.mbonus_max_level) * ml / maxl) + (t[2] or 0) + ml = util.bound(rng.float(ml, ml * 1.6), 1, 6) + + local maxl = 1 + math.floor((max - 1) / t[3]) + local power = 1 + math.log10(ml / maxl) + + local v = math.ceil(rng.mbonus(t[1], resolvers.current_level, max) * power) + (t[2] or 0) if e.cost and t[4] then local ap, nv = t[4](e, v) @@ -382,6 +388,7 @@ function resolvers.calc.inscriptions(t, e) o = game.zone:makeEntity(game.level, "object", {type="scroll", subtype=t[2]}, nil, true) end if o and o.inscription_talent and o.inscription_data then + o.inscription_data.use_any_stat = 0.7 -- Cheat a beat to scale inscriptions nicely e:setInscription(nil, o.inscription_talent, o.inscription_data, false, false, nil, true, true) end end -- GitLab