From 0b4fe745accdb743bc998e42282efb08c5b4ccd1 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 18 May 2012 15:41:45 +0200 Subject: Lua: Move handling of spell descriptions to C --- lib/mods/theme/core/s_aux.lua | 35 ++++------------------------------- lib/mods/theme/scpt/s_stick.lua | 4 ++-- 2 files changed, 6 insertions(+), 33 deletions(-) (limited to 'lib/mods') diff --git a/lib/mods/theme/core/s_aux.lua b/lib/mods/theme/core/s_aux.lua index 76f01637..b0c500a6 100644 --- a/lib/mods/theme/core/s_aux.lua +++ b/lib/mods/theme/core/s_aux.lua @@ -72,14 +72,16 @@ function finish_spell(must_i) spell(i).skill_level = s.level __spell_spell[i] = s.spell __spell_info[i] = s.info - __spell_desc[i] = s.desc + local j,desc + for j,desc in s.desc do + spell_description_add_line(i, desc) + end return i end -- Creates the school books array __spell_spell = {} __spell_info = {} -__spell_desc = {} __spell_school = {} -- Find a spell by name @@ -234,15 +236,6 @@ function spell_school_name(s) return sch_str end --- Output the desc when sued as a device -function print_device_desc(s) - local index, desc - - for index, desc in __spell_desc[s] do - text_out("\n" .. desc) - end -end - function check_affect(s, name, default) local s_ptr = __tmp_spells[s] local a @@ -389,26 +382,6 @@ function get_stick_charges(spl) return __tmp_spells[spl].stick.charge[1] + randint(__tmp_spells[spl].stick.charge[2]); end --- Get activation desc -function get_activation_desc(spl) - local turns - if type(__tmp_spells[spl].activate) == 'number' then - turns = __tmp_spells[spl].activate - else - turns = __tmp_spells[spl].activate[1] .. '+d' .. __tmp_spells[spl].activate[2] - end - return __tmp_spells[spl].desc[1] .. ' every ' .. turns .. ' turns' -end - --- Compute the timeout of an activation -function get_activation_timeout(spl) - if type(__tmp_spells[spl].activate) == 'number' then - return __tmp_spells[spl].activate - else - return __tmp_spells[spl].activate[1] + randint(__tmp_spells[spl].activate[2]) - end -end - -- Fire off the spell function activate_activation(spl, item) __spell_spell[spl](item) diff --git a/lib/mods/theme/scpt/s_stick.lua b/lib/mods/theme/scpt/s_stick.lua index 20d70856..554ca045 100644 --- a/lib/mods/theme/scpt/s_stick.lua +++ b/lib/mods/theme/scpt/s_stick.lua @@ -264,7 +264,7 @@ DEVICE_RADAGAST = add_spell ["mana_max"] = 0, ["fail"] = 10, ["random"] = -1, - ["activate"] = 15000, + ["activate"] = { 15000, 0 }, ["spell"] = function() return device_radagast() end, ["info"] = function() return device_radagast_info() end, ["desc"] = { @@ -281,7 +281,7 @@ DEVICE_VALAROMA = add_spell ["mana_max"] = 0, ["fail"] = 25, ["random"] = -1, - ["activate"] = 250, + ["activate"] = { 250, 0 }, ["spell"] = function() return device_valaroma() end, ["info"] = function() return device_valaroma_info() end, ["desc"] = { -- cgit v1.2.3