From 8ba6d76dc7179abe5cba19f422516dead2eceaf4 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sun, 13 May 2012 20:55:29 +0200 Subject: Lua: Move "Aule" spell functions to C --- lib/mods/theme/scpt/s_aule.lua | 157 +++-------------------------------------- 1 file changed, 9 insertions(+), 148 deletions(-) (limited to 'lib') diff --git a/lib/mods/theme/scpt/s_aule.lua b/lib/mods/theme/scpt/s_aule.lua index d3ca4733..75a121b1 100644 --- a/lib/mods/theme/scpt/s_aule.lua +++ b/lib/mods/theme/scpt/s_aule.lua @@ -13,27 +13,8 @@ AULE_FIREBRAND = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local type, rad - local level = get_level(AULE_FIREBRAND) - type = GF_FIRE - - if (get_level(AULE_FIREBRAND) > 30) then - type = GF_HOLY_FIRE - end - - rad = 0 - if (level >= 15) then - rad = 1 - end - return set_project(level + randint(20), - type, 4 + level, rad, - bor(PROJECT_STOP, PROJECT_KILL)) - end, - ["info"] = function() - local level = get_level(AULE_FIREBRAND) - return "dur "..(level).."+d20 dam "..(4 + level).."/blow" - end, + ["spell"] = function() return aule_firebrand_spell() end, + ["info"] = function() return aule_firebrand_info() end, ["desc"] = { "Imbues your melee weapon with fire to deal more damage", "At level 15 it spreads over a 1 radius zone around your target", @@ -52,58 +33,8 @@ AULE_ENCHANT_WEAPON = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(AULE_ENCHANT_WEAPON) - local num_h, num_d, num_p - - local ret, item, obj - - num_h = 1 + randint(level/12) - num_d = 0 - num_p = 0 - if (level >= 5) then - num_d = 1 + randint(level/12) - end - if (level >= 45) then - num_p = 1 - end - --return enchant_spell(num_h, num_d, 0, num_p) - - ret, item = get_item("Which object do you want to enchant?", - "You have no objects to enchant.", - bor(USE_INVEN), - function (obj) - if obj.name1 > 0 then return FALSE end - if (obj.tval == TV_MSTAFF) then - return TRUE - elseif (obj.tval == TV_BOW) then - return TRUE - elseif (obj.tval == TV_HAFTED) then - return TRUE - elseif (obj.tval == TV_POLEARM) then - return TRUE - elseif (obj.tval == TV_SWORD) then - return TRUE - elseif (obj.tval == TV_AXE) then - return TRUE - end - return FALSE - end - ) - if ret == FALSE then return FALSE end - - obj = get_object(item) - - obj.to_h = obj.to_h + num_h - obj.to_d = obj.to_d + num_h - obj.pval = obj.pval + num_p - - return TRUE - - end, - ["info"] = function() - return "tries "..(1 + get_level(AULE_ENCHANT_WEAPON)/12) - end, + ["spell"] = function() return aule_enchant_weapon_spell() end, + ["info"] = function() return aule_enchant_weapon_info() end, ["desc"] = { "Tries to enchant a weapon to-hit", "At level 5 it also enchants to-dam", @@ -122,66 +53,8 @@ AULE_ENCHANT_ARMOUR = add_spell { ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(AULE_ENCHANT_ARMOUR) - local num_h, num_d, num_a, num_p - local ret, item, obj - - num_a = 1 + randint(level/10) - num_h = 0 - num_d = 0 - num_p = 0 - if (level >= 20) then - num_h = 1 - num_d = 1 - end - if (level >= 40) then - num_p = 1 - end - --return enchant_spell(num_h, num_d, num_a, num_p) - - ret, item = get_item("Which object do you want to enchant?", - "You have no objects to enchant.", - bor(USE_INVEN), - function (obj) - if obj.name1 > 0 then return FALSE end - if (obj.tval == TV_BOOTS) then - return TRUE - elseif (obj.tval == TV_GLOVES) then - return TRUE - elseif (obj.tval == TV_HELM) then - return TRUE - elseif (obj.tval == TV_CROWN) then - return TRUE - elseif (obj.tval == TV_SHIELD) then - return TRUE - elseif (obj.tval == TV_CLOAK) then - return TRUE - elseif (obj.tval == TV_SOFT_ARMOR) then - return TRUE - elseif (obj.tval == TV_HARD_ARMOR) then - return TRUE - elseif (obj.tval == TV_DRAG_ARMOR) then - return TRUE - end - return FALSE - end - ) - if ret == FALSE then return FALSE end - - obj = get_object(item) - - obj.to_h = obj.to_h + num_h - obj.to_d = obj.to_d + num_h - obj.pval = obj.pval + num_p - obj.to_a = obj.to_a + num_h - - return TRUE - - end, - ["info"] = function() - return "tries "..(1 + get_level(AULE_ENCHANT_ARMOUR)/10) - end, + ["spell"] = function() return aule_enchant_armour_spell() end, + ["info"] = function() return aule_enchant_armour_info() end, ["desc"] = { "Tries to enchant a piece of armour", "At level 20 it also enchants to-hit and to-dam", @@ -201,22 +74,10 @@ AULE_CHILD = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local y, x, m_idx - - y, x = find_position(player.py, player.px) - m_idx = place_monster_one(y, x, test_monster_name("Dwarven warrior"), 0, FALSE, MSTATUS_FRIEND) - - if m_idx ~= 0 then - monster_set_level(m_idx, 20 + get_level(AULE_CHILD, 70, 0)) - return TRUE - end - end, - ["info"] = function() - return "level "..(20 + get_level(AULE_CHILD, 70)) - end, + ["spell"] = function() return aule_child_spell() end, + ["info"] = function() return aule_child_info() end, ["desc"] = { "Summons a levelled Dwarven warrior to help you battle the forces", "of Morgoth" } -} \ No newline at end of file +} -- cgit v1.2.3