From 1b9ce2b53e26ed2d983efb9da10eb2be89d6d705 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 30 May 2012 05:33:44 +0200 Subject: Lua: Migrate spell schools to C --- lib/core/init.lua | 1 - lib/core/s_aux.lua | 147 ---------------- lib/mods/theme/core/init.lua | 1 - lib/mods/theme/core/s_aux.lua | 146 ---------------- lib/mods/theme/scpt/init.lua | 4 +- lib/mods/theme/scpt/spells.lua | 385 ----------------------------------------- lib/scpt/init.lua | 4 +- lib/scpt/spells.lua | 293 ------------------------------- 8 files changed, 6 insertions(+), 975 deletions(-) delete mode 100644 lib/core/s_aux.lua delete mode 100644 lib/mods/theme/core/s_aux.lua delete mode 100644 lib/mods/theme/scpt/spells.lua delete mode 100644 lib/scpt/spells.lua (limited to 'lib') diff --git a/lib/core/init.lua b/lib/core/init.lua index 35f820d3..23c76461 100644 --- a/lib/core/init.lua +++ b/lib/core/init.lua @@ -16,7 +16,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "s_aux.lua") -- Load the ingame contextual help tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua") diff --git a/lib/core/s_aux.lua b/lib/core/s_aux.lua deleted file mode 100644 index 860892ae..00000000 --- a/lib/core/s_aux.lua +++ /dev/null @@ -1,147 +0,0 @@ --- Functions to help with spells, do not touch - -__schools = {} -__schools_num = 0 - -function add_school(s) - __schools[__schools_num] = s - - __schools_num = __schools_num + 1 - return (__schools_num - 1) -end - -function finish_school(i) - local s - - s = __schools[i] - assert(s.name, "No school name!") - assert(s.skill, "No school skill!") - - -- Need hooks? - if s.hooks then - add_hooks(s.hooks) - end - - new_school(i, s.name, s.skill) -end - --- Creates the school books array -__spell_school = {} - --- Find if the school is under the influence of a god, returns nil or the level -function get_god_level(sch) - if __schools[sch].gods[player.pgod] then - return (s_info[__schools[sch].gods[player.pgod].skill + 1].value * __schools[sch].gods[player.pgod].mul) / __schools[sch].gods[player.pgod].div - else - return nil - end -end - --- Change this fct if I want to switch to learnable spells -function get_level_school(s, max, min) - local lvl, sch, num, bonus - local allow_spell_power = TRUE - - lvl = 0 - num = 0 - bonus = 0 - - -- No max specified ? assume 50 - if not max then - max = 50 - end - if not min then - min = 1 - end - - -- Do we pass tests? - if check_spell_depends(s) ~= TRUE then - return min, "n/a" - end - - local index = 0 - while 1 do - sch = spell_get_school_idx(s, index) - if sch == -1 then - break - end - index = index + 1 - - local r, s, p, ok = 0, 0, 0, 0 - - -- Does it require we worship a specific god? - if __schools[sch].god then - if __schools[sch].god ~= player.pgod then - if min then return min, "n/a" - else return 1, "n/a" end - end - end - - -- Take the basic skill value - r = s_info[(school(sch).skill) + 1].value - - -- Do we pass tests? - if __schools[sch].depend then - if __schools[sch].depend() ~= TRUE then - return min, "n/a" - end - end - - -- Are we under sorcery effect ? - if __schools[sch].sorcery then - s = s_info[SKILL_SORCERY + 1].value - end - - -- Are we affected by spell power ? - -- All teh schools must allow it for it to work - if not __schools[sch].spell_power then - allow_spell_power = nil - end - - -- Are we under a god effect ? - if __schools[sch].gods then - p = get_god_level(sch) - if not p then p = 0 end - end - - -- Find the higher - ok = r - if ok < s then ok = s end - if ok < p then ok = p end - - -- Do we need to add a special bonus ? - if __schools[sch].bonus_level then - bonus = bonus + (__schools[sch].bonus_level() * (SKILL_STEP / 10)) - end - - -- All schools must be non zero to be able to use it - if ok == 0 then return min, "n/a" end - - -- Apply it - lvl = lvl + ok - num = num + 1 - end - - -- Add the Spellpower skill as a bonus - if allow_spell_power then - bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 10)) - end - - -- Add bonus from objects - bonus = bonus + (player.to_s * (SKILL_STEP / 10)) - - -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative - -- The loss of information should be negligible since 1 skill = 1000 internally - lvl = (lvl / num) / 10 - lvl = lua_get_level(s, lvl, max, min, bonus) - - return lvl, nil -end - --- The real get_level, works for schooled magic and for innate powers -function get_level(s, max, min) - if not max then max = 50 end - if not min then min = 1 end - return %get_level(s, max, min) -end - diff --git a/lib/mods/theme/core/init.lua b/lib/mods/theme/core/init.lua index 35f820d3..23c76461 100644 --- a/lib/mods/theme/core/init.lua +++ b/lib/mods/theme/core/init.lua @@ -16,7 +16,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "building.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "dungeon.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "s_aux.lua") -- Load the ingame contextual help tome_dofile_anywhere(ANGBAND_DIR_CORE, "help.lua") diff --git a/lib/mods/theme/core/s_aux.lua b/lib/mods/theme/core/s_aux.lua deleted file mode 100644 index 3e98ec94..00000000 --- a/lib/mods/theme/core/s_aux.lua +++ /dev/null @@ -1,146 +0,0 @@ --- Functions to help with spells, do not touch - -__schools = {} -__schools_num = 0 - -function add_school(s) - __schools[__schools_num] = s - - __schools_num = __schools_num + 1 - return (__schools_num - 1) -end - -function finish_school(i) - local s - - s = __schools[i] - assert(s.name, "No school name!") - assert(s.skill, "No school skill!") - - -- Need hooks? - if s.hooks then - add_hooks(s.hooks) - end - - new_school(i, s.name, s.skill) -end - --- Creates the school books array -__spell_school = {} - --- Find if the school is under the influence of a god, returns nil or the level -function get_god_level(sch) - if __schools[sch].gods[player.pgod] then - return (s_info[__schools[sch].gods[player.pgod].skill + 1].value * __schools[sch].gods[player.pgod].mul) / __schools[sch].gods[player.pgod].div - else - return nil - end -end - --- Change this fct if I want to switch to learnable spells -function get_level_school(s, max, min) - local lvl, sch, num, bonus - local allow_spell_power = TRUE - - lvl = 0 - num = 0 - bonus = 0 - - -- No max specified ? assume 50 - if not max then - max = 50 - end - if not min then - min = 1 - end - - -- Do we pass tests? - if check_spell_depends(s) ~= TRUE then - return min, "n/a" - end - - local index = 0 - while 1 do - sch = spell_get_school_idx(s, index) - if sch == -1 then - break - end - index = index + 1 - - local r, s, p, ok = 0, 0, 0, 0 - - -- Does it require we worship a specific god? - if __schools[sch].god then - if __schools[sch].god ~= player.pgod then - if min then return min, "n/a" - else return 1, "n/a" end - end - end - - -- Take the basic skill value - r = s_info[(school(sch).skill) + 1].value - - -- Do we pass tests? - if __schools[sch].depend then - if __schools[sch].depend() ~= TRUE then - return min, "n/a" - end - end - - -- Are we under sorcery effect ? - if __schools[sch].sorcery then - s = s_info[SKILL_SORCERY + 1].value - end - - -- Are we affected by spell power ? - -- All teh schools must allow it for it to work - if not __schools[sch].spell_power then - allow_spell_power = nil - end - - -- Are we under a god effect ? - if __schools[sch].gods then - p = get_god_level(sch) - if not p then p = 0 end - end - - -- Find the higher - ok = r - if ok < s then ok = s end - if ok < p then ok = p end - - -- Do we need to add a special bonus ? - if __schools[sch].bonus_level then - bonus = bonus + (__schools[sch].bonus_level() * (SKILL_STEP / 10)) - end - - -- All schools must be non zero to be able to use it - if ok == 0 then return min, "n/a" end - - -- Apply it - lvl = lvl + ok - num = num + 1 - end - - -- Add the Spellpower skill as a bonus - if allow_spell_power then - bonus = bonus + (get_skill_scale(SKILL_SPELL, 20) * (SKILL_STEP / 10)) - end - - -- Add bonus from objects - bonus = bonus + (player.to_s * (SKILL_STEP / 10)) - - -- / 10 because otherwise we can overflow a s32b and we can use a u32b because the value can be negative - -- The loss of information should be negligible since 1 skill = 1000 internally - lvl = (lvl / num) / 10 - lvl = lua_get_level(s, lvl, max, min, bonus) - - return lvl, nil -end - --- The real get_level, works for schooled magic and for innate powers -function get_level(s, max, min) - if not max then max = 50 end - if not min then min = 1 end - return %get_level(s, max, min) -end diff --git a/lib/mods/theme/scpt/init.lua b/lib/mods/theme/scpt/init.lua index a65db8ac..af4ba3d9 100644 --- a/lib/mods/theme/scpt/init.lua +++ b/lib/mods/theme/scpt/init.lua @@ -15,7 +15,9 @@ tome_dofile("stores.lua") tome_dofile("mkeys.lua") -- Add the schools of magic -tome_dofile("spells.lua") +schools_init() +school_spells_init() +init_school_books() -- Post-spell creation initialization initialize_bookable_spells() diff --git a/lib/mods/theme/scpt/spells.lua b/lib/mods/theme/scpt/spells.lua deleted file mode 100644 index e37d922f..00000000 --- a/lib/mods/theme/scpt/spells.lua +++ /dev/null @@ -1,385 +0,0 @@ --- --- This file takes care of the schools of magic --- - --- Create the schools -SCHOOL_MANA = add_school -{ - ["name"] = "Mana", - ["skill"] = SKILL_MANA, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Varda provides the Mana school at 1/4 the prayer skill - [GOD_VARDA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 4, - }, - -- Eru Iluvatar provides the Mana school at half the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, - ["hooks"] = - { - [HOOK_CALC_MANA] = function(msp) - if get_skill(SKILL_MANA) >= 35 then - msp = msp + (msp * ((get_skill(SKILL_MANA) - 34)) / 100) - return TRUE, msp - end - end - }, -} -SCHOOL_FIRE = add_school -{ - ["name"] = "Fire", - ["skill"] = SKILL_FIRE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Aule provides the Fire school at 3/5 the prayer skill - [GOD_AULE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 3, - ["div"] = 5, - }, - }, -} -SCHOOL_AIR = add_school -{ - ["name"] = "Air", - ["skill"] = SKILL_AIR, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Air school at 2/3 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 2, - ["div"] = 3, - }, - }, -} -SCHOOL_WATER = add_school -{ - ["name"] = "Water", - ["skill"] = SKILL_WATER, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Water school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - -- Ulmo provides the Water school at 3/5 the prayer skill - [GOD_ULMO] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 3, - ["div"] = 5, - }, - }, -} -SCHOOL_EARTH = add_school -{ - ["name"] = "Earth", - ["skill"] = SKILL_EARTH, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Tulkas provides the Earth school at 4/5 the prayer skill - [GOD_TULKAS] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 4, - ["div"] = 5, - }, - -- Yavanna Kementari provides the Earth school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - - -- Aule provides the Earth school at 1/3 the prayer skill - [GOD_AULE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - }, -} -SCHOOL_CONVEYANCE = add_school -{ - ["name"] = "Conveyance", - ["skill"] = SKILL_CONVEYANCE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Conveyance school at 1/2 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_GEOMANCY = add_school -{ - ["name"] = "Geomancy", - ["skill"] = SKILL_GEOMANCY, - ["spell_power"] = TRUE, - -- Require to wield a Mage Staff, as the spells requries the caster to stomp the floor with it - ["depend"] = function() - -- Require at least one point in each school - if get_skill(SKILL_FIRE) == 0 then return end - if get_skill(SKILL_AIR) == 0 then return end - if get_skill(SKILL_EARTH) == 0 then return end - if get_skill(SKILL_WATER) == 0 then return end - - local obj = get_object(INVEN_WIELD) - if (obj.k_idx > 0) and (obj.tval == TV_MSTAFF) then return TRUE end - end, -} -SCHOOL_DIVINATION = add_school -{ - ["name"] = "Divination", - ["skill"] = SKILL_DIVINATION, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Eru Iluvatar provides the Divination school at 2/3 the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 2, - ["div"] = 3, - }, - -- Mandos the Divination school at 1/3 the prayer skill - [GOD_MANDOS] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - }, -} -SCHOOL_TEMPORAL = add_school -{ - ["name"] = "Temporal", - ["skill"] = SKILL_TEMPORAL, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Temporal school at 1/6 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 6, - }, - -- Mandos provides the Temporal school at 1/4 the prayer skill - [GOD_MANDOS] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 4, - }, - }, -} -SCHOOL_NATURE = add_school -{ - ["name"] = "Nature", - ["skill"] = SKILL_NATURE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Nature school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - -- Ulmo provides the Nature school at 1/2 the prayer skill - [GOD_ULMO] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_META = add_school -{ - ["name"] = "Meta", - ["skill"] = SKILL_META, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Meta school at 1/3 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - -- Varda provides the Meta school at 1/2 the prayer skill - [GOD_VARDA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_MIND = add_school -{ - ["name"] = "Mind", - ["skill"] = SKILL_MIND, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Eru Iluvatar provides the Mind school at 1/3 the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - -- Melkor Bauglir provides the Mind school at 1/3 the prayer skill - [GOD_MELKOR] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - }, -} -SCHOOL_UDUN = add_school -{ - ["name"] = "Udun", - ["skill"] = SKILL_UDUN, - ["bonus_level"] = function() - return ((player.lev * 2) / 3) - end, -} -SCHOOL_DEMON = add_school -{ - ["name"] = "Demon", - ["skill"] = SKILL_DAEMON, - ["no_random"] = TRUE, -} - --- The God specific schools, all tied to the prayer skill -SCHOOL_ERU = add_school -{ - ["name"] = "Eru Iluvatar", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_ERU, -} -SCHOOL_MANWE = add_school -{ - ["name"] = "Manwe Sulimo", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_MANWE, -} -SCHOOL_TULKAS = add_school -{ - ["name"] = "Tulkas", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_TULKAS, -} -SCHOOL_MELKOR = add_school -{ - ["name"] = "Melkor Bauglir", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_MELKOR, -} -SCHOOL_YAVANNA = add_school -{ - ["name"] = "Yavanna Kementari", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_YAVANNA, -} - --- New schools -SCHOOL_AULE = add_school -{ - ["name"] = "Aule the Smith", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_AULE, -} -SCHOOL_VARDA = add_school -{ - ["name"] = "Varda Elentari", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_VARDA, -} - -SCHOOL_ULMO = add_school -{ - ["name"] = "Ulmo", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_ULMO, -} - -SCHOOL_MANDOS = add_school -{ - ["name"] = "Mandos", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_MANDOS, -} - --- Not a real school, rather a palcehodler for stick only spells -SCHOOL_DEVICE = add_school -{ - ["name"] = "Device", - ["skill"] = SKILL_DEVICE, -} - --- Music "spells" -SCHOOL_MUSIC = add_school -{ - ["name"] = "Music", - ["skill"] = SKILL_MUSIC, -} - --- Initialize school spells. -school_spells_init() - --- Initialize spellbooks -init_school_books() diff --git a/lib/scpt/init.lua b/lib/scpt/init.lua index 55a6ce63..69fca70d 100644 --- a/lib/scpt/init.lua +++ b/lib/scpt/init.lua @@ -15,7 +15,9 @@ tome_dofile("stores.lua") tome_dofile("mkeys.lua") -- Add the schools of magic -tome_dofile("spells.lua") +schools_init() +school_spells_init() +init_school_books() -- Post-spell creation initialization initialize_bookable_spells() diff --git a/lib/scpt/spells.lua b/lib/scpt/spells.lua deleted file mode 100644 index 2ce7d1f3..00000000 --- a/lib/scpt/spells.lua +++ /dev/null @@ -1,293 +0,0 @@ --- --- This file takes care of the schools of magic --- - --- Create the schools -SCHOOL_MANA = add_school -{ - ["name"] = "Mana", - ["skill"] = SKILL_MANA, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Eru Iluvatar provides the Mana school at half the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, - ["hooks"] = - { - [HOOK_CALC_MANA] = function(msp) - if get_skill(SKILL_MANA) >= 35 then - msp = msp + (msp * ((get_skill(SKILL_MANA) - 34)) / 100) - return TRUE, msp - end - end - }, -} -SCHOOL_FIRE = add_school -{ - ["name"] = "Fire", - ["skill"] = SKILL_FIRE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, -} -SCHOOL_AIR = add_school -{ - ["name"] = "Air", - ["skill"] = SKILL_AIR, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Air school at 2/3 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 2, - ["div"] = 3, - }, - }, -} -SCHOOL_WATER = add_school -{ - ["name"] = "Water", - ["skill"] = SKILL_WATER, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Water school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_EARTH = add_school -{ - ["name"] = "Earth", - ["skill"] = SKILL_EARTH, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Tulkas provides the Earth school at 4/5 the prayer skill - [GOD_TULKAS] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 4, - ["div"] = 5, - }, - -- Yavanna Kementari provides the Earth school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_CONVEYANCE = add_school -{ - ["name"] = "Conveyance", - ["skill"] = SKILL_CONVEYANCE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Conveyance school at 1/2 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_GEOMANCY = add_school -{ - ["name"] = "Geomancy", - ["skill"] = SKILL_GEOMANCY, - ["spell_power"] = TRUE, - -- Require to wield a Mage Staff, as the spells requries the caster to stomp the floor with it - ["depend"] = function() - -- Require at least one point in each school - if get_skill(SKILL_FIRE) == 0 then return end - if get_skill(SKILL_AIR) == 0 then return end - if get_skill(SKILL_EARTH) == 0 then return end - if get_skill(SKILL_WATER) == 0 then return end - - local obj = get_object(INVEN_WIELD) - if (obj.k_idx > 0) and (obj.tval == TV_MSTAFF) then return TRUE end - end, -} -SCHOOL_DIVINATION = add_school -{ - ["name"] = "Divination", - ["skill"] = SKILL_DIVINATION, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Eru Iluvatar provides the Divination school at 2/3 the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 2, - ["div"] = 3, - }, - }, -} -SCHOOL_TEMPORAL = add_school -{ - ["name"] = "Temporal", - ["skill"] = SKILL_TEMPORAL, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Temporal school at 1/6 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 6, - }, - }, -} -SCHOOL_NATURE = add_school -{ - ["name"] = "Nature", - ["skill"] = SKILL_NATURE, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Yavanna Kementari provides the Nature school at 1/2 the prayer skill - [GOD_YAVANNA] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 2, - }, - }, -} -SCHOOL_META = add_school -{ - ["name"] = "Meta", - ["skill"] = SKILL_META, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Manwe Sulimo provides the Meta school at 1/3 the prayer skill - [GOD_MANWE] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - }, -} -SCHOOL_MIND = add_school -{ - ["name"] = "Mind", - ["skill"] = SKILL_MIND, - ["spell_power"] = TRUE, - ["sorcery"] = TRUE, - ["gods"] = - { - -- Eru Iluvatar provides the Mind school at 1/3 the prayer skill - [GOD_ERU] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - -- Melkor Bauglir provides the Mind school at 1/3 the prayer skill - [GOD_MELKOR] = - { - ["skill"] = SKILL_PRAY, - ["mul"] = 1, - ["div"] = 3, - }, - }, -} -SCHOOL_UDUN = add_school -{ - ["name"] = "Udun", - ["skill"] = SKILL_UDUN, - ["bonus_level"] = function() - return ((player.lev * 2) / 3) - end, -} -SCHOOL_DEMON = add_school -{ - ["name"] = "Demon", - ["skill"] = SKILL_DAEMON, - ["no_random"] = TRUE, -} - --- The God specific schools, all tied to the prayer skill -SCHOOL_ERU = add_school -{ - ["name"] = "Eru Iluvatar", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_ERU, -} -SCHOOL_MANWE = add_school -{ - ["name"] = "Manwe Sulimo", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_MANWE, -} -SCHOOL_TULKAS = add_school -{ - ["name"] = "Tulkas", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_TULKAS, -} -SCHOOL_MELKOR = add_school -{ - ["name"] = "Melkor Bauglir", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_MELKOR, -} -SCHOOL_YAVANNA = add_school -{ - ["name"] = "Yavanna Kementari", - ["skill"] = SKILL_PRAY, - ["spell_power"] = TRUE, - ["god"] = GOD_YAVANNA, -} - --- Not a real school, rather a palcehodler for stick only spells -SCHOOL_DEVICE = add_school -{ - ["name"] = "Device", - ["skill"] = SKILL_DEVICE, -} - --- Music "spells" -SCHOOL_MUSIC = add_school -{ - ["name"] = "Music", - ["skill"] = SKILL_MUSIC, -} - --- Initialize school spells. -school_spells_init() - --- Initialize spellbooks -init_school_books() -- cgit v1.2.3