Skip to content
Snippets Groups Projects
Commit 872cea90 authored by dg's avatar dg
Browse files

Overhauled the speeds system. Now when a talent or object grants +X% foo speed...

Overhauled the speeds system. Now when a talent or object grants +X% foo speed it means you can do X% more of action foo in the same time. So if you get a 100% combat speed increase you will attack twice as fast


git-svn-id: http://svn.net-core.org/repos/t-engine4@3144 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3c82d3ec
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 37 deletions
......@@ -66,7 +66,7 @@ function _M:tick()
if e and e.act and e.energy then
-- print("<ENERGY", e.name, e.uid, "::", e.energy.value, self.paused, "::", e.player)
if e.energy.value < self.energy_to_act then
e.energy.value = (e.energy.value or 0) + self.energy_per_tick * (e.energy.mod or 1)
e.energy.value = (e.energy.value or 0) + self.energy_per_tick * (e.energy.mod or 1) * (e.global_speed or 1)
end
if e.energy.value >= self.energy_to_act then
e.energy.used = false
......@@ -82,7 +82,7 @@ function _M:tick()
e = arr[i]
if e and e.act and e.energy then
if e.energy.value < self.energy_to_act then
e.energy.value = (e.energy.value or 0) + self.energy_per_tick * (e.energy.mod or 1)
e.energy.value = (e.energy.value or 0) + self.energy_per_tick * (e.energy.mod or 1) * (e.global_speed or 1)
end
if e.energy.value >= self.energy_to_act then
e.energy.used = false
......
......@@ -74,9 +74,11 @@ function _M:init(t, no_default)
self.combat_atk = 0
self.combat_apr = 0
self.combat_dam = 0
self.global_speed = 1
self.movement_speed = 1
self.combat_physcrit = 0
self.combat_physspeed = 0
self.combat_spellspeed = 0
self.combat_physspeed = 1
self.combat_spellspeed = 1
self.combat_spellcrit = 0
self.combat_spellpower = 0
self.combat_mindpower = 0
......
......@@ -440,6 +440,8 @@ function _M:getTextualDesc()
if w.invisible then desc:add(("Invisibility: %d"):format(w.invisible), true) end
if w.movement_speed then desc:add(("Movement speed: %d%%"):format(w.movement_speed * 100), true) end
if w.combat_physspeed then desc:add(("Combat speed: %d%%"):format(w.combat_physspeed * 100), true) end
if w.combat_spellspeed then desc:add(("Casting speed: %d%%"):format(w.combat_spellspeed * 100), true) end
if w.healing_factor then desc:add(("Increases all healing by %d%%"):format(w.healing_factor * 100), true) end
......
......@@ -552,7 +552,7 @@ end
--- Gets the weapon speed
function _M:combatSpeed(weapon)
weapon = weapon or self.combat or {}
return self.combat_physspeed + (weapon.physspeed or 1)
return (weapon.physspeed or 1) / self.combat_physspeed
end
--- Gets the crit rate
......@@ -679,7 +679,7 @@ end
--- Gets spellspeed
function _M:combatSpellSpeed()
return self.combat_spellspeed + 1
return 1 / self.combat_spellspeed
end
--- Computes physical crit for a damage
......@@ -832,10 +832,7 @@ end
--- Computes movement speed
function _M:combatMovementSpeed()
local v = util.bound(1 + (self.movement_speed or 0), 0.2, 10)
if v >= 1 then return v
else return math.pow(0.4, 1 - v)
end
return (self.base_movement_speed or 1) / self.movement_speed
end
--- Check if the actor has a gem bomb in quiver
......
......@@ -104,7 +104,7 @@ newBirthDescriptor
cut_immune = 1,
stun_immune = 0.5,
fear_immune = 1,
energy = {mod=0.8},
global_speed = 0.8,
},
experience = 1.4,
}
......
......@@ -29,7 +29,6 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=1, },
stats = { str=12, dex=10, mag=3, con=13 },
energy = { mod=1 },
combat_armor = 1, combat_def = 1,
combat = { dam=resolvers.levelup(resolvers.mbonus(36, 10), 1, 1), atk=15, apr=7, dammod={str=0.6} },
max_life = resolvers.rngavg(10,20), life_rating = 6,
......@@ -58,7 +57,7 @@ newEntity{ base = "BASE_NPC_AQUATIC_CRITTER",
resolvers.talents{ [Talents.T_CHAIN_LIGHTNING]=3, [Talents.T_LIGHTNING]=3 },
on_die = function(self, who)
local part = "ELECTRIC_EEL_TAIL"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......@@ -95,7 +94,7 @@ newEntity{ base = "BASE_NPC_AQUATIC_CRITTER",
resolvers.talents{ [Talents.T_GRAB]=3, },
on_die = function(self, who)
local part = "SQUID_INK"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......@@ -110,7 +109,7 @@ newEntity{ base = "BASE_NPC_AQUATIC_CRITTER",
resolvers.talents{ [Talents.T_GRAB]=3, [Talents.T_BLINDING_INK]=3, },
on_die = function(self, who)
local part = "SQUID_INK"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -30,7 +30,6 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=1, },
stats = { str=12, dex=10, mag=3, con=13 },
energy = { mod=1 },
combat_armor = 1, combat_def = 1,
combat = { dam=resolvers.levelup(resolvers.mbonus(46, 20), 1, 1), atk=15, apr=7, dammod={str=0.7} },
max_life = resolvers.rngavg(100,120),
......
......@@ -31,7 +31,7 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=5, },
energy = { mod=0.9 },
global_speed = 0.9,
stats = { str=18, dex=13, mag=5, con=15 },
infravision = 20,
rank = 2,
......@@ -45,7 +45,7 @@ newEntity{
resists = { [DamageType.FIRE] = 20, [DamageType.COLD] = 20, [DamageType.POISON] = 20 },
on_die = function(self, who)
local part = "BEAR_PAW"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -30,7 +30,7 @@ newEntity{
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=1, },
stats = { str=12, dex=20, mag=3, con=13 },
energy = { mod=1.2 },
global_speed = 1.2,
combat_armor = 1, combat_def = 5,
combat = { dam=5, atk=15, apr=7, dammod={str=0.6} },
infravision = 20,
......
......@@ -37,7 +37,6 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1 },
stats = { str=20, dex=52, mag=16, con=16 },
resists = { [DamageType.PHYSICAL] = 20, [DamageType.BLIGHT] = 20, [DamageType.COLD] = 50, },
......@@ -53,7 +52,7 @@ newEntity{
undead = 1,
on_die = function(self, who)
local part = "BONE_GOLEM_DUST"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -34,7 +34,7 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1.1 },
global_speed = 1.2,
stats = { str=10, dex=17, mag=3, con=7 },
combat = { dammod={str=0.6} },
combat_armor = 1, combat_def = 1,
......@@ -96,7 +96,7 @@ newEntity{ base = "BASE_NPC_CANINE",
resolvers.talents{ [Talents.T_HOWL]=3, },
on_die = function(self, who)
local part = "WARG_CLAW"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -34,7 +34,6 @@ newEntity{
autolevel = "drake",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1 },
stats = { str=20, dex=20, mag=30, con=16 },
resists = { [DamageType.COLD] = 100, },
......@@ -106,7 +105,7 @@ newEntity{ base = "BASE_NPC_COLD_DRAKE",
},
on_die = function(self, who)
local part = "ICE_WYRM_TOOTH"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -46,7 +46,6 @@ newEntity{
autolevel = "warriormage",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1 },
stats = { str=20, mag=16, con=22 },
resolvers.talents{
[Talents.T_STAMINA_POOL]=1, [Talents.T_MANA_POOL]=1,
......
......@@ -14,7 +14,7 @@ newEntity{
max_life = resolvers.rngavg(12,34),
stats = { str=1, dex=5, mag=20, con=1 },
energy = { mod=0.5 },
global_speed = 0.7,
infravision = 20,
combat_def = 1,
never_move = 1,
......@@ -53,7 +53,7 @@ newEntity{ name = "wisp",
life_rating = 1, rank = 1, size_category = 1,
autolevel = "caster",
ai = "dumb_talented_simple", ai_state = { ai_move = "move_astar", talent_in = 1 },
energy = { mod = 1 },
global_speed = 1,
stats = { str = 9, dex = 20, mag = 20 },
resolvers.talents{
[Talents.T_EXPLODE] = 3,
......
......@@ -47,7 +47,6 @@ newEntity{
autolevel = "caster",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=1, },
energy = { mod=1 },
stats = { str=20, dex=8, mag=6, con=16 },
}
......
......@@ -46,7 +46,6 @@ newEntity{
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=3, },
energy = { mod=1 },
stats = { str=20, dex=8, mag=6, con=16 },
}
......
......@@ -37,7 +37,6 @@ newEntity{
autolevel = "dexmage",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1 },
stats = { str=10, dex=8, mag=6, con=16 },
resists = { [DamageType.PHYSICAL] = 10, [DamageType.FIRE] = 100, [DamageType.COLD] = -30, },
......@@ -47,7 +46,7 @@ newEntity{
disease_immune = 1,
on_die = function(self, who)
local part = "FAEROS_ASH"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -34,7 +34,6 @@ newEntity{
autolevel = "drake",
ai = "dumb_talented_simple", ai_state = { ai_move="move_dmap", talent_in=2, },
energy = { mod=1 },
stats = { str=20, dex=20, mag=30, con=16 },
resists = { [DamageType.FIRE] = 100, },
......@@ -110,7 +109,7 @@ newEntity{ base = "BASE_NPC_FIRE_DRAKE",
},
on_die = function(self, who)
local part = "FIRE_WYRM_SALIVA"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
......@@ -30,7 +30,6 @@ newEntity{
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
autolevel = "warriormage",
ai = "dumb_talented_simple", ai_state = { ai_target="target_player_radius", sense_radius=40, talent_in=2, },
energy = { mod=1 },
stats = { str=14, dex=18, mag=20, con=12 },
rank = 2,
size_category = 3,
......
......@@ -30,7 +30,6 @@ newEntity{
drops = resolvers.drops{chance=70, nb=1, {type="money"}, {} },
autolevel = "ghoul",
ai = "dumb_talented_simple", ai_state = { talent_in=2, ai_move="move_ghoul", },
energy = { mod=1 },
stats = { str=14, dex=12, mag=10, con=12 },
rank = 2,
size_category = 3,
......@@ -46,7 +45,7 @@ newEntity{
undead = 1,
on_die = function(self, who)
local part = "GHOUL_FLESH"
if game.player:hasQuest("brotherhood-of-alchemists") then
if game.player:hasQuest("brotherhood-of-alchemists") then
game.player:hasQuest("brotherhood-of-alchemists"):need_part(who, part, self)
end
end,
......
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