From 9de9180942450aea8ded755c94510cf6d2542a5a Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Thu, 12 Apr 2012 07:39:30 +0200 Subject: Lua: Move "Conveyance" spell functions to C --- lib/scpt/s_convey.lua | 108 ++++++-------------------------------------------- 1 file changed, 12 insertions(+), 96 deletions(-) (limited to 'lib/scpt/s_convey.lua') diff --git a/lib/scpt/s_convey.lua b/lib/scpt/s_convey.lua index e7856c43..d81af28b 100644 --- a/lib/scpt/s_convey.lua +++ b/lib/scpt/s_convey.lua @@ -9,21 +9,8 @@ BLINK = add_spell ["mana_max"] = 3, ["fail"] = 10, ["inertia"] = { 1, 5 }, - ["spell"] = function() - if get_level(BLINK, 50) >= 30 then - local oy, ox = player.py, player.px - - teleport_player(10 + get_level(BLINK, 8)) - create_between_gate(0, oy, ox) - return TRUE - else - teleport_player(10 + get_level(BLINK, 8)) - return TRUE - end - end, - ["info"] = function() - return "distance "..(10 + get_level(BLINK, 8)) - end, + ["spell"] = function() return convey_blink() end, + ["info"] = function() return convey_blink_info() end, ["desc"] = { "Teleports you on a small scale range", "At level 30 it creates void jumpgates", @@ -48,15 +35,8 @@ DISARM = add_spell ["max_level"] = { 10, 50 }, }, }, - ["spell"] = function() - local obvious - obvious = destroy_doors_touch() - if get_level(DISARM, 50) >= 10 then obvious = is_obvious(destroy_traps_touch(), obvious) end - return obvious - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return convey_disarm() end, + ["info"] = function() return convey_disarm_info() end, ["desc"] = { "Destroys doors and traps", "At level 10 it destroys doors and traps, then reveals and unlocks any secret", @@ -83,14 +63,8 @@ TELEPORT = add_spell }, }, ["inertia"] = { 1, 10 }, - ["spell"] = function() - player.energy = player.energy - (25 - get_level(TELEPORT, 50)) - teleport_player(100 + get_level(TELEPORT, 100)) - return TRUE - end, - ["info"] = function() - return "distance "..(100 + get_level(TELEPORT, 100)) - end, + ["spell"] = function() return convey_teleport() end, + ["info"] = function() return convey_teleport_info() end, ["desc"] = { "Teleports you around the level. The casting time decreases with level", } @@ -114,24 +88,8 @@ TELEAWAY = add_spell ["max_level"] = { 20, 50 }, }, }, - ["spell"] = function() - local ret, dir - - if get_level(TELEAWAY, 50) >= 20 then - return project_los(GF_AWAY_ALL, 100) - elseif get_level(TELEAWAY, 50) >= 10 then - ret, dir = get_aim_dir() - if ret == FALSE then return end - return fire_ball(GF_AWAY_ALL, dir, 100, 3 + get_level(TELEAWAY, 4)) - else - ret, dir = get_aim_dir() - if ret == FALSE then return end - return teleport_monster(dir) - end - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return convey_teleport_away() end, + ["info"] = function() return convey_teleport_away_info() end, ["desc"] = { "Teleports a line of monsters away", "At level 10 it turns into a ball", @@ -147,46 +105,8 @@ RECALL = add_spell ["mana"] = 25, ["mana_max"] = 25, ["fail"] = 60, - ["spell"] = function() - local ret, x, y, c_ptr - ret, x, y = tgt_pt() - if ret == FALSE then return end - c_ptr = cave(y, x) - if (y == player.py) and (x == player.px) then - local d = 21 - get_level(RECALL, 15) - if d < 0 then - d = 0 - end - local f = 15 - get_level(RECALL, 10) - if f < 1 then - f = 1 - end - recall_player(d, f) - return TRUE - elseif c_ptr.m_idx > 0 then - swap_position(y, x) - return TRUE - elseif c_ptr.o_idx > 0 then - set_target(y, x) - if get_level(RECALL, 50) >= 15 then - fetch(5, 10 + get_level(RECALL, 150), FALSE) - else - fetch(5, 10 + get_level(RECALL, 150), TRUE) - end - return TRUE - end - end, - ["info"] = function() - local d = 21 - get_level(RECALL, 15) - if d < 0 then - d = 0 - end - local f = 15 - get_level(RECALL, 10) - if f < 1 then - f = 1 - end - return "dur "..f.."+d"..d.." weight "..(1 + get_level(RECALL, 15)).."lb" - end, + ["spell"] = function() return convey_recall() end, + ["info"] = function() return convey_recall_info() end, ["desc"] = { "Cast on yourself it will recall you to the surface/dungeon.", "Cast at a monster you will swap positions with the monster.", @@ -213,12 +133,8 @@ PROBABILITY_TRAVEL = add_spell }, }, ["inertia"] = { 6, 40 }, - ["spell"] = function() - return set_prob_travel(randint(20) + get_level(PROBABILITY_TRAVEL, 60)) - end, - ["info"] = function() - return "dur "..get_level(PROBABILITY_TRAVEL, 60).."+d20" - end, + ["spell"] = function() return convey_probability_travel() end, + ["info"] = function() return convey_probability_travel_info() end, ["desc"] = { "Renders you immaterial, when you hit a wall you travel through it and", "instantly appear on the other side of it. You can also float up and down", -- cgit v1.2.3