From cf9afa2063fa9123f8653e76d17404775a34313d Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 13 Apr 2012 22:05:41 +0200 Subject: Lua: Move "Fire" spell functions to C --- lib/mods/theme/scpt/s_fire.lua | 113 ++++------------------------------------- 1 file changed, 10 insertions(+), 103 deletions(-) (limited to 'lib/mods/theme') diff --git a/lib/mods/theme/scpt/s_fire.lua b/lib/mods/theme/scpt/s_fire.lua index dbbf7604..37a75032 100644 --- a/lib/mods/theme/scpt/s_fire.lua +++ b/lib/mods/theme/scpt/s_fire.lua @@ -19,27 +19,8 @@ GLOBELIGHT = add_spell }, }, ["inertia"] = { 1, 40 }, - ["spell"] = function() - local obvious - if get_level(GLOBELIGHT, 50) >= 3 then - obvious = lite_area(10, 4) - else - lite_room(player.py, player.px) - obvious = TRUE - end - if get_level(GLOBELIGHT, 50) >= 15 then - obvious = is_obvious(fire_ball(GF_LITE, 0, 10 + get_level(GLOBELIGHT, 100), 5 + get_level(GLOBELIGHT, 6)), obvious) - player.update = bor(player.update, PU_VIEW) - end - return obvious - end, - ["info"] = function() - if get_level(GLOBELIGHT, 50) >= 15 then - return "dam "..(10 + get_level(GLOBELIGHT, 100)).." rad "..(5 + get_level(GLOBELIGHT, 6)) - else - return "" - end - end, + ["spell"] = function() return fire_globe_of_light() end, + ["info"] = function() return fire_globe_of_light_info() end, ["desc"] = { "Creates a globe of pure light", "At level 3 it starts damaging monsters", @@ -65,20 +46,8 @@ FIREFLASH = add_spell ["max_level"] = { 15, 35 }, }, }, - ["spell"] = function() - local ret, dir, type - if (get_level(FIREFLASH, 50) >= 20) then - type = GF_HOLY_FIRE - else - type = GF_FIRE - end - ret, dir = get_aim_dir() - if ret == FALSE then return end - return fire_ball(type, dir, 20 + get_level(FIREFLASH, 500), 2 + get_level(FIREFLASH, 5)) - end, - ["info"] = function() - return "dam "..(20 + get_level(FIREFLASH, 500)).." rad "..(2 + get_level(FIREFLASH, 5)) - end, + ["spell"] = function() return fire_fireflash() end, + ["info"] = function() return fire_fireflash_info() end, ["desc"] = { "Conjures a ball of fire to burn your foes to ashes", "At level 20 it turns into a ball of holy fire" @@ -104,18 +73,8 @@ FIERYAURA = add_spell }, }, ["inertia"] = { 2, 15 }, - ["spell"] = function() - local type - if (get_level(FIERYAURA, 50) >= 8) then - type = SHIELD_GREAT_FIRE - else - type = SHIELD_FIRE - end - return set_shield(randint(20) + 10 + get_level(FIERYAURA, 70), 10, type, 5 + get_level(FIERYAURA, 10), 5 + get_level(FIERYAURA, 7)) - end, - ["info"] = function() - return "dam "..(5 + get_level(FIERYAURA, 15)).."d"..(5 + get_level(FIERYAURA, 7)).." dur "..(10 + get_level(FIERYAURA, 70)).."+d20" - end, + ["spell"] = function() return fire_fiery_shield() end, + ["info"] = function() return fire_fiery_shield_info() end, ["desc"] = { "Creates a shield of fierce flames around you", "At level 8 it turns into a greater kind of flame that can not be resisted" @@ -140,21 +99,8 @@ FIREWALL = add_spell ["max_level"] = { 5, 40 }, }, }, - ["spell"] = function() - local ret, dir, type - if (get_level(FIREWALL, 50) >= 6) then - type = GF_HELL_FIRE - else - type = GF_FIRE - end - ret, dir = get_aim_dir() - if ret == FALSE then return end - fire_wall(type, dir, 40 + get_level(FIREWALL, 150), 10 + get_level(FIREWALL, 14)) - return TRUE - end, - ["info"] = function() - return "dam "..(40 + get_level(FIREWALL, 150)).." dur "..(10 + get_level(FIREWALL, 14)) - end, + ["spell"] = function() return fire_firewall() end, + ["info"] = function() return fire_firewall_info() end, ["desc"] = { "Creates a fiery wall to incinerate monsters stupid enough to attack you", "At level 6 it turns into a wall of hell fire" @@ -169,47 +115,8 @@ FIREGOLEM = add_spell ["mana"] = 16, ["mana_max"] = 70, ["fail"] = 40, - ["spell"] = function() - local m_idx, y, x, ret, item - - -- Can we reconnect ? - if do_control_reconnect() == TRUE then - msg_print("Control re-established.") - return - end - - ret, item = get_item("Which light source do you want to use to create the golem?", - "You have no light source for the golem", - bor(USE_INVEN, USE_EQUIP), - function (obj) - if (obj.tval == TV_LITE) and ((obj.sval == SV_LITE_TORCH) or (obj.sval == SV_LITE_LANTERN)) then - return TRUE - end - return FALSE - end - ) - if ret == FALSE then return TRUE end - inven_item_increase(item, -1) - inven_item_describe(item) - inven_item_optimize(item) - - -- Summon it - m_allow_special[1043 + 1] = TRUE - y, x = find_position(player.py, player.px) - m_idx = place_monster_one(y, x, 1043, 0, FALSE, MSTATUS_FRIEND) - m_allow_special[1043 + 1] = FALSE - - -- level it - if m_idx ~= 0 then - monster_set_level(m_idx, 7 + get_level(FIREGOLEM, 70)) - player.control = m_idx - monster(m_idx).mflag = bor(monster(m_idx).mflag, MFLAG_CONTROL) - end - return TRUE - end, - ["info"] = function() - return "golem level "..(7 + get_level(FIREGOLEM, 70)) - end, + ["spell"] = function() return fire_golem() end, + ["info"] = function() return fire_golem_info() end, ["desc"] = { "Creates a fiery golem and controls it", "During the control the available keylist is:", -- cgit v1.2.3