diff options
-rw-r--r-- | lib/core/init.lua | 1 | ||||
-rw-r--r-- | lib/core/powers.lua | 79 | ||||
-rw-r--r-- | lib/core/s_aux.lua | 8 | ||||
-rw-r--r-- | lib/mods/theme/core/init.lua | 1 | ||||
-rw-r--r-- | lib/mods/theme/core/powers.lua | 79 | ||||
-rw-r--r-- | lib/mods/theme/core/s_aux.lua | 8 | ||||
-rw-r--r-- | src/externs.h | 1 | ||||
-rw-r--r-- | src/lua_bind.c | 9 | ||||
-rw-r--r-- | src/spells.pkg | 15 |
9 files changed, 16 insertions, 185 deletions
diff --git a/lib/core/init.lua b/lib/core/init.lua index 9a9ec1ee..11b812d5 100644 --- a/lib/core/init.lua +++ b/lib/core/init.lua @@ -14,7 +14,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "powers.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") diff --git a/lib/core/powers.lua b/lib/core/powers.lua deleted file mode 100644 index dfd5f44b..00000000 --- a/lib/core/powers.lua +++ /dev/null @@ -1,79 +0,0 @@ --- --- Helper functions for magic powers --- - -__magic_powers = {} - -function add_magic(m) - local i, ret - - if type(m.spell_list) ~= "table" then - error("add_magic called without a table") - end - - -- Ok iterate over all the powers to add - local index, p, max - - -- First, count them - max = 0 - for index, p in m.spell_list do - max = max + 1 - end - - -- Now register it - ret = {} - i = new_magic_power(max) - ret.spells = i - ret.max = max - ret.fail_fct = m.fail - if m.stat then - ret.stat = m.stat - else - ret.stat = A_INT - end - if m.get_level then - ret.get_current_level = m.get_level - else - ret.get_current_level = function() - return player.lev - end - end - - -- And add each spells - max = 0 - ret.info = {} - ret.spell = {} - for index, p in m.spell_list do - assert(p.name, "No name for the spell!") - assert(p.desc, "No desc for the spell!") - assert(p.mana, "No mana for the spell!") - assert(p.level, "No level for the spell!") - assert(p.fail, "No fail for the spell!") - assert(p.info, "No info for the spell!") - assert(p.spell, "No spell for the spell!") - - get_magic_power(i, max).name = p.name - get_magic_power(i, max).desc = p.desc - get_magic_power(i, max).mana_cost = p.mana - get_magic_power(i, max).min_lev = p.level - get_magic_power(i, max).fail = p.fail - ret.info[max] = p.info - ret.spell[max] = p.spell - - max = max + 1 - end - - return ret -end - -function __get_magic_info(power) - return __current_magic_power_info[power]() -end - --- Get the level of a power -function get_level_power(s, max, min) - if not max then max = 50 end - if not min then min = 1 end - - return value_scale(s.get_current_level(), 50, max, min) -end diff --git a/lib/core/s_aux.lua b/lib/core/s_aux.lua index abd1269d..1cc74765 100644 --- a/lib/core/s_aux.lua +++ b/lib/core/s_aux.lua @@ -276,6 +276,14 @@ function get_power_name(s) end end +-- Get the level of a power +function get_level_power(s, max, min) + if not max then max = 50 end + if not min then min = 1 end + + return value_scale(s.get_current_level(), 50, max, min) +end + -- Changes the amount of power(mana, piety, whatever) for the spell function adjust_power(s, x) if check_affect(s, "piety", FALSE) then diff --git a/lib/mods/theme/core/init.lua b/lib/mods/theme/core/init.lua index 9a9ec1ee..11b812d5 100644 --- a/lib/mods/theme/core/init.lua +++ b/lib/mods/theme/core/init.lua @@ -14,7 +14,6 @@ tome_dofile_anywhere(ANGBAND_DIR_CORE, "util.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "player.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "objects.lua") tome_dofile_anywhere(ANGBAND_DIR_CORE, "monsters.lua") -tome_dofile_anywhere(ANGBAND_DIR_CORE, "powers.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") diff --git a/lib/mods/theme/core/powers.lua b/lib/mods/theme/core/powers.lua deleted file mode 100644 index dfd5f44b..00000000 --- a/lib/mods/theme/core/powers.lua +++ /dev/null @@ -1,79 +0,0 @@ --- --- Helper functions for magic powers --- - -__magic_powers = {} - -function add_magic(m) - local i, ret - - if type(m.spell_list) ~= "table" then - error("add_magic called without a table") - end - - -- Ok iterate over all the powers to add - local index, p, max - - -- First, count them - max = 0 - for index, p in m.spell_list do - max = max + 1 - end - - -- Now register it - ret = {} - i = new_magic_power(max) - ret.spells = i - ret.max = max - ret.fail_fct = m.fail - if m.stat then - ret.stat = m.stat - else - ret.stat = A_INT - end - if m.get_level then - ret.get_current_level = m.get_level - else - ret.get_current_level = function() - return player.lev - end - end - - -- And add each spells - max = 0 - ret.info = {} - ret.spell = {} - for index, p in m.spell_list do - assert(p.name, "No name for the spell!") - assert(p.desc, "No desc for the spell!") - assert(p.mana, "No mana for the spell!") - assert(p.level, "No level for the spell!") - assert(p.fail, "No fail for the spell!") - assert(p.info, "No info for the spell!") - assert(p.spell, "No spell for the spell!") - - get_magic_power(i, max).name = p.name - get_magic_power(i, max).desc = p.desc - get_magic_power(i, max).mana_cost = p.mana - get_magic_power(i, max).min_lev = p.level - get_magic_power(i, max).fail = p.fail - ret.info[max] = p.info - ret.spell[max] = p.spell - - max = max + 1 - end - - return ret -end - -function __get_magic_info(power) - return __current_magic_power_info[power]() -end - --- Get the level of a power -function get_level_power(s, max, min) - if not max then max = 50 end - if not min then min = 1 end - - return value_scale(s.get_current_level(), 50, max, min) -end diff --git a/lib/mods/theme/core/s_aux.lua b/lib/mods/theme/core/s_aux.lua index abd1269d..1cc74765 100644 --- a/lib/mods/theme/core/s_aux.lua +++ b/lib/mods/theme/core/s_aux.lua @@ -276,6 +276,14 @@ function get_power_name(s) end end +-- Get the level of a power +function get_level_power(s, max, min) + if not max then max = 50 end + if not min then min = 1 end + + return value_scale(s.get_current_level(), 50, max, min) +end + -- Changes the amount of power(mana, piety, whatever) for the spell function adjust_power(s, x) if check_affect(s, "piety", FALSE) then diff --git a/src/externs.h b/src/externs.h index f3f565ac..49771fe6 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1775,7 +1775,6 @@ extern bool_ select_module(void); /* lua_bind.c */ extern magic_power *grab_magic_power(magic_power *m_ptr, int num); extern bool_ get_magic_power(int *sn, magic_power *powers, int max_powers, void (*power_info)(char *p, int power), int plev, int cast_stat); -extern magic_power *new_magic_power(int num); extern bool_ lua_spell_success(magic_power *spell, int stat, char *oups_fct); extern object_type *new_object(void); diff --git a/src/lua_bind.c b/src/lua_bind.c index 04c0f7d9..d4751257 100644 --- a/src/lua_bind.c +++ b/src/lua_bind.c @@ -16,15 +16,6 @@ #include "tolua.h" extern lua_State *L; -/* - * Get a new magic type - */ -magic_power *new_magic_power(int num) -{ - magic_power *m_ptr; - C_MAKE(m_ptr, num, magic_power); - return (m_ptr); -} magic_power *grab_magic_power(magic_power *m_ptr, int num) { return (&m_ptr[num]); diff --git a/src/spells.pkg b/src/spells.pkg index 9ea21079..e785de0d 100644 --- a/src/spells.pkg +++ b/src/spells.pkg @@ -2132,21 +2132,6 @@ struct magic_power cptr desc; }; -/** @fn *new_magic_power(int num) - * @dgonly - * @brief Create a wiped array of "num" magic powers.\n - * @param num Number \n num is the number of magic powers. - * @brief Number - * @return magic_power \n Array of magic powers. - * @note - * Get a new magic type\n\n - * Note: do not call this function directly.\n - * Please use add_magic() in powers.lua instead.\n - * By order of DG. - * @note (see file lua_bind.c) - */ -extern magic_power *new_magic_power(int num); - /** @fn get_magic_power(magic_power *m_ptr, int num); * @dgonly * @brief Get magic power number "num" from array "m_ptr" of magic powers.\n |