Skip to content
Snippets Groups Projects
Commit 4e39c766 authored by dg's avatar dg
Browse files

Speeds now stacking is now multiplicative

git-svn-id: http://svn.net-core.org/repos/t-engine4@3145 51575b47-30f0-44d4-a5cc-537603b46e54
parent 872cea90
No related branches found
No related tags found
No related merge requests found
......@@ -454,6 +454,8 @@ function _M:check(prop, ...)
end
end
_M.temporary_values_conf = {}
--- Computes a "temporary" value into a property
-- Example: You cant to give an actor a boost to life_regen, but you do not want it to be permanent<br/>
-- You cannot simply increase life_regen, so you use this method which will increase it AND
......@@ -492,7 +494,13 @@ function _M:addTemporaryValue(prop, v, noupdate)
recursive = function(base, prop, v)
if type(v) == "number" then
-- Simple addition
base[prop] = (base[prop] or 0) + v
if self.temporary_values_conf[prop] == "mult" then
base[prop] = (base[prop] or 1) * v
elseif self.temporary_values_conf[prop] == "mult0" then
base[prop] = (base[prop] or 1) * (1 + v)
else
base[prop] = (base[prop] or 0) + v
end
self:onTemporaryValueChange(prop, v, base)
print("addTmpVal", base, prop, v, " :=: ", #t, id)
elseif type(v) == "table" then
......@@ -543,7 +551,13 @@ function _M:removeTemporaryValue(prop, id, noupdate)
recursive = function(base, prop, v)
if type(v) == "number" then
-- Simple addition
base[prop] = base[prop] - v
if self.temporary_values_conf[prop] == "mult" then
base[prop] = base[prop] / v
elseif self.temporary_values_conf[prop] == "mult0" then
base[prop] = base[prop] / (1 + v)
else
base[prop] = base[prop] - v
end
self:onTemporaryValueChange(prop, -v, base)
print("delTmpVal", prop, v)
elseif type(v) == "table" then
......
......@@ -67,6 +67,12 @@ _M.__is_actor = true
_M.stats_per_level = 3
-- Speeds are multiplicative, not additive
_M.temporary_values_conf.global_speed = "mult0"
_M.temporary_values_conf.movement_speed = "mult0"
_M.temporary_values_conf.combat_physspeed = "mult0"
_M.temporary_values_conf.combat_spellspeed = "mult0"
function _M:init(t, no_default)
-- Define some basic combat stats
self.combat_def = 0
......
......@@ -112,7 +112,7 @@ newTalent{
sustain_mana = 250,
cooldown = 30,
tactical = { BUFF = 2 },
getHaste = function(self, t) return self:getTalentLevel(t) * 0.9 end,
getHaste = function(self, t) return self:getTalentLevel(t) * 0.09 end,
activate = function(self, t)
game:playSoundNear(self, "talents/spell_generic")
local power = t.getHaste(self, t)
......@@ -130,4 +130,3 @@ newTalent{
format(100 * haste)
end,
}
......@@ -130,7 +130,7 @@ newTalent{
sustain_stamina = 30,
tactical = { BUFF = 1, STAMINA = 2 },
getSpeed = function(self, t) return 0.1 end,
getStamina = function(self, t) return self:getTalentLevel(t) * 0.015 end,
getStamina = function(self, t) return self:getTalentLevel(t) * 1.5 end,
activate = function(self, t)
return {
speed = self:addTemporaryValue("global_speed", -t.getSpeed(self, t)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment