diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-14 07:42:28 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-14 20:07:52 +0200 |
commit | 22290738f1f65c6b11b98c6a2db13f81dacb3d28 (patch) | |
tree | 322ab57992d057a559e622f33c6bcbebdb9b2168 /lib/mods | |
parent | 8ba6d76dc7179abe5cba19f422516dead2eceaf4 (diff) |
Lua: Move "Mandos" spell functions to C
Diffstat (limited to 'lib/mods')
-rw-r--r-- | lib/mods/theme/scpt/s_mandos.lua | 111 |
1 files changed, 10 insertions, 101 deletions
diff --git a/lib/mods/theme/scpt/s_mandos.lua b/lib/mods/theme/scpt/s_mandos.lua index 90876930..48b73c27 100644 --- a/lib/mods/theme/scpt/s_mandos.lua +++ b/lib/mods/theme/scpt/s_mandos.lua @@ -2,42 +2,6 @@ BOOK_MANDOS = 66 --- precognition timer for high-level spell [from T-Plus by Ingeborg S. Norden] - -function set_precognition(v) - local notice = FALSE - if (v < 0) then v = 0 end - if (v > 10000) then v = 10000 end - - -- Check if the state will change - if (v > 0) and (tim_precognition == 0) then - msg_print("You feel able to predict the future.") - notice = TRUE - elseif (v == 0) and (tim_precognition > 0) then - msg_print("You feel less able to predict the future.") - notice = TRUE - end - - -- set the new value - tim_precognition = v - - if (notice == TRUE) then - player.update = bor(player.update, PU_BONUS) - disturb(0,0) - end - return notice -end - --- related hooks - -add_hooks{ - [HOOK_PROCESS_WORLD] = function() - if (tim_precognition > 0) then - set_precognition(tim_precognition - 1) - end - end, -} - -- "Tears of Luthien" based on Holy Word from T-Plus MANDOS_TEARS_LUTHIEN = add_spell { @@ -50,25 +14,16 @@ MANDOS_TEARS_LUTHIEN = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(MANDOS_TEARS_LUTHIEN, 30) - local obvious = hp_player(10 * level) - obvious = is_obvious (set_stun(0), obvious) - obvious = is_obvious (set_cut(0), obvious) - obvious = is_obvious (set_afraid(0), obvious) - return obvious - end, - ["info"] = function() - local level = get_level(MANDOS_TEARS_LUTHIEN, 30) - return "heals "..(10 * level) - end, + ["spell"] = function() return mandos_tears_of_luthien_spell() end, + ["info"] = function() return mandos_tears_of_luthien_info() end, ["desc"] = { "Calls upon the spirit of Luthien to ask Mandos for healing and succour." } } -- "Spirit of the Feanturi" based on Restore Mind from T-Plus -MANDOS_SPIRIT_FEANTURI = add_spell { +MANDOS_SPIRIT_FEANTURI = add_spell +{ ["name"] = "Feanturi", ["school"] = {SCHOOL_MANDOS}, ["level"] = 10, @@ -79,33 +34,8 @@ MANDOS_SPIRIT_FEANTURI = add_spell { ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local level = get_level(MANDOS_SPIRIT_FEANTURI, 50) - local obvious - obvious = set_afraid(0) - obvious = is_obvious(set_confused(0), obvious) - - if level >= 20 then - obvious = is_obvious(do_res_stat(A_WIS, TRUE), obvious) - obvious = is_obvious(do_res_stat(A_INT, TRUE), obvious) - end - - if level >= 30 then - obvious = is_obvious(set_image(0), obvious) - obvious = is_obvious(heal_insanity(player.msane * level / 100), obvious) - end - - return obvious - end, - - ["info"] = function() - local level = get_level(MANDOS_SPIRIT_FEANTURI, 50) - if level >= 20 then - return "heals "..level.."%" - else - return "" - end - end, + ["spell"] = function() return mandos_spirit_of_the_feanturi_spell() end, + ["info"] = function() return mandos_spirit_of_the_feanturi_info() end, ["desc"] = { "Channels the power of Mandos to cure fear and confusion.", "At level 20 it restores lost INT and WIS", @@ -127,12 +57,8 @@ MANDOS_TALE_DOOM = add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - return set_precognition(5 + get_level(MANDOS_TALE_DOOM,10)) - end, - ["info"] = function() - return "dur "..(5 + get_level(MANDOS_TALE_DOOM,10)) - end, + ["spell"] = function() return mandos_tale_of_doom_spell() end, + ["info"] = function() return mandos_tale_of_doom_info() end, ["desc"] = { "Allows you to predict the future for a short time." } @@ -140,7 +66,6 @@ MANDOS_TALE_DOOM = add_spell -- "Call to the Halls" based on Call Blessed Soul from T-Plus MANDOS_CALL_HALLS= add_spell - { ["name"] = "Call to the Halls", ["school"] = {SCHOOL_MANDOS}, @@ -151,24 +76,8 @@ MANDOS_CALL_HALLS= add_spell ["piety"] = TRUE, ["stat"] = A_WIS, ["random"] = SKILL_SPIRITUALITY, - ["spell"] = function() - local y, x, m_idx - local summons = - { - test_monster_name("Experienced spirit"), - test_monster_name("Wise spirit"), - } - y, x = find_position(player.py, player.px) - m_idx = place_monster_one(y, x, summons[rand_range(1, 2)], 0, FALSE, MSTATUS_FRIEND) - if m_idx ~= 0 then - monster_set_level(m_idx, 20 + get_level(MANDOS_CALL_HALLS, 70, 0)) - return TRUE - end - end, - - ["info"] = function() - return "level "..(get_level(MANDOS_CALL_HALLS, 70)) - end, + ["spell"] = function() return mandos_call_to_the_halls_spell() end, + ["info"] = function() return mandos_call_to_the_halls_info() end, ["desc"] = { "Summons a leveled spirit from the Halls of Mandos", "to fight for you." |