summaryrefslogtreecommitdiff
path: root/lib/mods
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-18 15:41:45 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-24 16:46:35 +0200
commit0b4fe745accdb743bc998e42282efb08c5b4ccd1 (patch)
treec7949a1b11a9535655b94eee4ed43105b37de535 /lib/mods
parentf7e4d1b4d9da8c42f02f79c0328477dd787fecd2 (diff)
Lua: Move handling of spell descriptions to C
Diffstat (limited to 'lib/mods')
-rw-r--r--lib/mods/theme/core/s_aux.lua35
-rw-r--r--lib/mods/theme/scpt/s_stick.lua4
2 files changed, 6 insertions, 33 deletions
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"] = {