From 98c69abb1f65c27d586b9af0574a9b8bfb8265a7 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 13 Apr 2012 07:44:18 +0200 Subject: Lua: Move "Earth" spell functions to C --- lib/mods/theme/scpt/s_earth.lua | 81 +++++------------------------------------ 1 file changed, 10 insertions(+), 71 deletions(-) (limited to 'lib/mods') diff --git a/lib/mods/theme/scpt/s_earth.lua b/lib/mods/theme/scpt/s_earth.lua index 23aa001c..9825fc84 100644 --- a/lib/mods/theme/scpt/s_earth.lua +++ b/lib/mods/theme/scpt/s_earth.lua @@ -9,22 +9,8 @@ STONESKIN = add_spell ["mana_max"] = 50, ["fail"] = 10, ["inertia"] = { 2, 50 }, - ["spell"] = function() - local type - if get_level(STONESKIN, 50) >= 25 then - type = SHIELD_COUNTER - else - type = 0 - end - return set_shield(randint(10) + 10 + get_level(STONESKIN, 100), 10 + get_level(STONESKIN, 50), type, 2 + get_level(STONESKIN, 5), 3 + get_level(STONESKIN, 5)) - end, - ["info"] = function() - if get_level(STONESKIN, 50) >= 25 then - return "dam "..(2 + get_level(STONESKIN, 5)).."d"..(3 + get_level(STONESKIN, 5)).." dur "..(10 + get_level(STONESKIN, 100)).."+d10 AC "..(10 + get_level(STONESKIN, 50)) - else - return "dur "..(10 + get_level(STONESKIN, 100)).."+d10 AC "..(10 + get_level(STONESKIN, 50)) - end - end, + ["spell"] = function() return earth_stone_skin() end, + ["info"] = function() return earth_stone_skin_info() end, ["desc"] = { "Creates a shield of earth around you to protect you", "At level 25 it starts dealing damage to attackers" @@ -49,15 +35,8 @@ DIG = add_spell ["max_level"] = { 1, 1 }, }, }, - ["spell"] = function() - local ret, dir - ret, dir = get_aim_dir() - if ret == FALSE then return end - return wall_to_mud(dir) - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return earth_dig() end, + ["info"] = function() return earth_dig_info() end, ["desc"] = { "Digs a hole in a wall much faster than any shovels", } @@ -81,20 +60,8 @@ STONEPRISON = add_spell ["max_level"] = { 5, 20 }, }, }, - ["spell"] = function() - local ret, x, y - if get_level(STONEPRISON, 50) >= 10 then - ret, x, y = tgt_pt() - else - y = player.py - x = player.px - end - wall_stone(y, x) - return TRUE - end, - ["info"] = function() - return "" - end, + ["spell"] = function() return earth_stone_prison() end, + ["info"] = function() return earth_stone_prison_info() end, ["desc"] = { "Creates a prison of walls around you", "At level 10 it allows you to target a monster" @@ -119,23 +86,8 @@ STRIKE = add_spell ["max_level"] = { 10, 50 }, }, }, - ["spell"] = function() - local ret, dir, rad - ret, dir = get_aim_dir() - if ret == FALSE then return end - if get_level(STRIKE, 50) >= 12 then - return fire_ball(GF_FORCE, dir, 50 + get_level(STRIKE, 50), 1) - else - return fire_ball(GF_FORCE, dir, 50 + get_level(STRIKE, 50), 0) - end - end, - ["info"] = function() - if get_level(STRIKE, 50) >= 12 then - return "dam "..(50 + get_level(STRIKE, 50)).." rad 1" - else - return "dam "..(50 + get_level(STRIKE, 50)) - end - end, + ["spell"] = function() return earth_strike() end, + ["info"] = function() return earth_strike_info() end, ["desc"] = { "Creates a micro-ball of force that will push monsters backwards", "If the monster is caught near a wall, it'll be crushed against it", @@ -162,21 +114,8 @@ SHAKE = add_spell }, }, ["inertia"] = { 2, 50 }, - ["spell"] = function() - local ret, x, y - if get_level(SHAKE, 50) >= 10 then - ret, x, y = tgt_pt() - if ret == FALSE then return end - else - x = player.px - y = player.py - end - earthquake(y, x, 4 + get_level(SHAKE, 10)); - return TRUE - end, - ["info"] = function() - return "rad "..(4 + get_level(SHAKE, 10)) - end, + ["spell"] = function() return earth_shake() end, + ["info"] = function() return earth_shake_info() end, ["desc"] = { "Creates a localised earthquake", "At level 10 it can be targeted at any location" -- cgit v1.2.3