summaryrefslogtreecommitdiff
path: root/lib/mods/theme
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-13 10:55:44 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-13 14:24:52 +0200
commit806d9737befef6ca878befbcddeb30634ce62083 (patch)
treea58a638f77664b8a2235cbefd8ad71cb1c7602be /lib/mods/theme
parent2d57accf3a3c68e7eb41571eadf54ca2c7c4607f (diff)
Lua: Move "device" spell functions to C
Diffstat (limited to 'lib/mods/theme')
-rw-r--r--lib/mods/theme/scpt/s_stick.lua252
1 files changed, 24 insertions, 228 deletions
diff --git a/lib/mods/theme/scpt/s_stick.lua b/lib/mods/theme/scpt/s_stick.lua
index 9bbd641a..20d70856 100644
--- a/lib/mods/theme/scpt/s_stick.lua
+++ b/lib/mods/theme/scpt/s_stick.lua
@@ -19,15 +19,8 @@ DEVICE_HEAL_MONSTER = add_spell
["max_level"] = { 20, 50 },
},
},
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_ball(GF_OLD_HEAL, dir, 20 + get_level(DEVICE_HEAL_MONSTER, 380), 0)
- end,
- ["info"] = function()
- return "heal "..(20 + get_level(DEVICE_HEAL_MONSTER, 380))
- end,
+ ["spell"] = function() return device_heal_monster() end,
+ ["info"] = function() return device_heal_monster_info() end,
["desc"] = {
"Heals a monster",
}
@@ -52,15 +45,8 @@ DEVICE_SPEED_MONSTER = add_spell
["max_level"] = { 20, 50 },
},
},
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
-
- return fire_ball(GF_OLD_SPEED, dir, 1, 0)
- end,
- ["info"] = function()
- return "speed +10"
- end,
+ ["spell"] = function() return device_haste_monster() end,
+ ["info"] = function() return device_haste_monster_info() end,
["desc"] = {
"Haste a monster",
}
@@ -85,13 +71,8 @@ DEVICE_WISH = add_spell
["max_level"] = { 1, 1 },
},
},
- ["spell"] = function()
- make_wish()
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return device_wish() end,
+ ["info"] = function() return device_wish_info() end,
["desc"] = {
"This grants you a wish, beware of what you ask for!",
}
@@ -116,17 +97,8 @@ DEVICE_SUMMON = add_spell
["max_level"] = { 25, 50 },
},
},
- ["spell"] = function()
- local i, obvious
- obvious = nil
- for i = 1, 4 + get_level(DEVICE_SUMMON, 30) do
- obvious = is_obvious(summon_specific(player.py, player.px, dun_level, 0), obvious)
- end
- return obvious
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return device_summon_monster() end,
+ ["info"] = function() return device_summon_monster_info() end,
["desc"] = {
"Summons hostile monsters near you",
}
@@ -151,13 +123,8 @@ DEVICE_MANA = add_spell
["max_level"] = { 20, 35 },
},
},
- ["spell"] = function()
- increase_mana((player.msp * (20 + get_level(DEVICE_MANA, 50))) / 100)
- return TRUE
- end,
- ["info"] = function()
- return "restore "..(20 + get_level(DEVICE_MANA, 50)).."%"
- end,
+ ["spell"] = function() return device_mana() end,
+ ["info"] = function() return device_mana_info() end,
["desc"] = {
"Restores a part(or all) of your mana",
}
@@ -188,12 +155,8 @@ DEVICE_NOTHING = add_spell
["max_level"] = { 1, 1},
},
},
- ["spell"] = function()
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return device_nothing() end,
+ ["info"] = function() return device_nothing_info() end,
["desc"] = {
"It does nothing.",
}
@@ -209,14 +172,8 @@ DEVICE_MAGGOT = add_spell
["fail"] = 20,
["random"] = -1,
["activate"] = { 10, 50 },
- ["spell"] = function()
- local ret, dir = get_aim_dir()
- if ret == FALSE then return end
- return fire_ball(GF_TURN_ALL, dir, 40, 2)
- end,
- ["info"] = function()
- return "power 40 rad 2"
- end,
+ ["spell"] = function() return device_maggot() end,
+ ["info"] = function() return device_maggot_info() end,
["desc"] = {
"terrify",
}
@@ -242,12 +199,8 @@ DEVICE_HOLY_FIRE = add_spell
["max_level"] = { 35, 35 },
},
},
- ["spell"] = function()
- return project_los(GF_HOLY_FIRE, 50 + get_level(DEVICE_HOLY_FIRE, 300))
- end,
- ["info"] = function()
- return "dam "..(50 + get_level(DEVICE_HOLY_FIRE, 250))
- end,
+ ["spell"] = function() return device_holy_fire() end,
+ ["info"] = function() return device_holy_fire_info() end,
["desc"] = {
"The Holy Fire created by this staff will deeply(double damage) burn",
"all that is evil.",
@@ -266,84 +219,8 @@ DEVICE_ETERNAL_FLAME = add_spell
["fail"] = 0,
["random"] = -1,
["activate"] = { 0, 0 },
- ["spell"] = function(flame_item)
- local ret, item, obj
-
- ret, item = get_item("Which object do you want to imbue?",
- "You have no objects to imbue.",
- bor(USE_INVEN),
- function (obj)
- if obj.name1 > 0 or obj.name2 > 0 then return FALSE end
- if (obj.tval == TV_SWORD) and (obj.sval == SV_LONG_SWORD) then
- return TRUE
- elseif (obj.tval == TV_MSTAFF) and (obj.sval == SV_MSTAFF) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_HEAVY_XBOW) then
- return TRUE
- elseif (obj.tval == TV_DRAG_ARMOR) and (obj.sval == SV_DRAGON_POWER) then
- return TRUE
- elseif (obj.tval == TV_HAFTED) and (obj.sval == SV_LUCERN_HAMMER) then
- return TRUE
- elseif (obj.tval == TV_POLEARM) and (obj.sval == SV_TRIDENT) then
- return TRUE
- elseif (obj.tval == TV_AXE) and (obj.sval == SV_BATTLE_AXE) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_LONG_BOW) then
- return TRUE
- elseif (obj.tval == TV_BOOMERANG) and (obj.sval == SV_BOOM_METAL) then
- return TRUE
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_SLING) then
- return TRUE
- elseif (obj.tval == TV_SWORD) and (obj.sval == SV_RAPIER) then
- return TRUE
- elseif (obj.tval == TV_AMULET) and (obj.sval == SV_AMULET_SPELL) then
- return TRUE
- end
- return FALSE
- end
- )
- if ret == FALSE then return FALSE end
-
- obj = get_object(item)
-
- if (obj.tval == TV_SWORD) and (obj.sval == SV_LONG_SWORD) then
- obj.name1 = 147
- elseif (obj.tval == TV_MSTAFF) and (obj.sval == SV_MSTAFF) then
- obj.name1 = 127
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_HEAVY_XBOW) then
- obj.name1 = 152
- elseif (obj.tval == TV_DRAG_ARMOR) and (obj.sval == SV_DRAGON_POWER) then
- obj.name1 = 17
- elseif (obj.tval == TV_HAFTED) and (obj.sval == SV_LUCERN_HAMMER) then
- obj.name1 = 241
- elseif (obj.tval == TV_POLEARM) and (obj.sval == SV_TRIDENT) then
- obj.name1 = 242
- elseif (obj.tval == TV_AXE) and (obj.sval == SV_BROAD_AXE) then
- obj.name1 = 243
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_LONG_BOW) then
- obj.name1 = 245
- elseif (obj.tval == TV_BOOMERANG) and (obj.sval == SV_BOOM_METAL) then
- obj.name1 = 247
- elseif (obj.tval == TV_BOW) and (obj.sval == SV_SLING) then
- obj.name1 = 246
- elseif (obj.tval == TV_SWORD) and (obj.sval == SV_RAPIER) then
- obj.name1 = 244
- elseif (obj.tval == TV_AMULET) and (obj.sval == SV_AMULET_SPELL) then
- obj.name1 = 248
- end
- apply_magic(obj, -1, TRUE, TRUE, TRUE)
-
- obj.found = OBJ_FOUND_SELFMADE
-
- inven_item_increase(flame_item, -1)
- inven_item_describe(flame_item)
- inven_item_optimize(flame_item)
-
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function(flame_item) return device_eternal_flame(flame_item) end,
+ ["info"] = function() return "" end,
["desc"] = {
"Imbuing an object with the eternal fire",
}
@@ -369,18 +246,8 @@ DEVICE_THUNDERLORDS = add_spell
["max_level"] = { 1, 1 },
},
},
- ["spell"] = function()
- if dun_level > 0 then
- msg_print("As you blow the horn, an Eagle of Manwe appears overhead.")
- recall_player(0, 1)
- else
- msg_print("You cannot use it there.")
- end
- return TRUE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return device_thunderlords() end,
+ ["info"] = function() return device_thunderlords_info() end,
["desc"] = {
"An Eagle of Manwe will appear to transport you quickly to the town.",
}
@@ -398,42 +265,8 @@ DEVICE_RADAGAST = add_spell
["fail"] = 10,
["random"] = -1,
["activate"] = 15000,
- ["spell"] = function()
- msg_print(TERM_GREEN, "The staff's power cleanses you completely!")
- remove_all_curse()
- do_res_stat(A_STR, TRUE)
- do_res_stat(A_CON, TRUE)
- do_res_stat(A_DEX, TRUE)
- do_res_stat(A_WIS, TRUE)
- do_res_stat(A_INT, TRUE)
- do_res_stat(A_CHR, TRUE)
- restore_level()
- clean_corruptions()
- hp_player(5000)
- heal_insanity(5000)
- set_poisoned(0)
- set_blind(0)
- set_confused(0)
- set_image(0)
- set_stun(0)
- set_cut(0)
- set_parasite(0, 0)
-
- if (player.black_breath) == TRUE then
- msg_print("The hold of the Black Breath on you is broken!")
- end
- player.black_breath = FALSE
-
- player.update = bor(player.update, PU_BONUS)
- player.window = bor(player.window, PW_PLAYER)
-
- return TRUE
- end,
-
- ["info"] = function()
- return ""
- end,
-
+ ["spell"] = function() return device_radagast() end,
+ ["info"] = function() return device_radagast_info() end,
["desc"] = {
"purity and health",
}
@@ -449,46 +282,9 @@ DEVICE_VALAROMA = add_spell
["fail"] = 25,
["random"] = -1,
["activate"] = 250,
- ["spell"] = function()
- local power = 5 * player.lev
- banish_evil(power)
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
+ ["spell"] = function() return device_valaroma() end,
+ ["info"] = function() return device_valaroma_info() end,
["desc"] = {
"banish evil (level x5)",
}
}
---[[ Template
-DEVICE_ = add_spell
-{
- ["name"] = "",
- ["school"] = {SCHOOL_DEVICE},
- ["level"] = 1,
- ["mana"] = 2,
- ["mana_max"] = 15,
- ["fail"] = 10,
- ["random"] = -1,
- ["stick"] =
- {
- ["charge"] = { 10, 5 },
- [TV_STAFF] =
- {
- ["rarity"] = 7,
- ["base_level"] = { 1, 15 },
- ["max_level"] = { 25, 50 },
- },
- },
- ["spell"] = function()
- return FALSE
- end,
- ["info"] = function()
- return ""
- end,
- ["desc"] = {
- "",
- }
-}
-]]