diff options
-rw-r--r-- | lib/mods/theme/scpt/gods.lua | 16 | ||||
-rw-r--r-- | lib/scpt/gods.lua | 16 | ||||
-rw-r--r-- | src/defines.h | 1 | ||||
-rw-r--r-- | src/gods.c | 29 | ||||
-rw-r--r-- | src/util.pkg | 16 |
5 files changed, 25 insertions, 53 deletions
diff --git a/lib/mods/theme/scpt/gods.lua b/lib/mods/theme/scpt/gods.lua index 014a4423..f76a3d6a 100644 --- a/lib/mods/theme/scpt/gods.lua +++ b/lib/mods/theme/scpt/gods.lua @@ -1,21 +1,5 @@ add_hooks { - [HOOK_FOLLOW_GOD] = function(god, action) - if action == "ask" then - if not (god == GOD_MELKOR) then - local i = INVEN_WIELD - while i < INVEN_TOTAL do - -- 13 is ART_POWER - if player.inventory(i).name1 == 13 then - msg_print("The One Ring has corrupted you, and you are rejected.") - return TRUE - end - i = i + 1 - end - end - end - return FALSE - end, [HOOK_RECALC_SKILLS] = function() if not (player.pgod == GOD_NONE) and (get_skill(SKILL_ANTIMAGIC) > 0) then msg_print("You no longer believe.") diff --git a/lib/scpt/gods.lua b/lib/scpt/gods.lua index 014a4423..f76a3d6a 100644 --- a/lib/scpt/gods.lua +++ b/lib/scpt/gods.lua @@ -1,21 +1,5 @@ add_hooks { - [HOOK_FOLLOW_GOD] = function(god, action) - if action == "ask" then - if not (god == GOD_MELKOR) then - local i = INVEN_WIELD - while i < INVEN_TOTAL do - -- 13 is ART_POWER - if player.inventory(i).name1 == 13 then - msg_print("The One Ring has corrupted you, and you are rejected.") - return TRUE - end - i = i + 1 - end - end - end - return FALSE - end, [HOOK_RECALC_SKILLS] = function() if not (player.pgod == GOD_NONE) and (get_skill(SKILL_ANTIMAGIC) > 0) then msg_print("You no longer believe.") diff --git a/src/defines.h b/src/defines.h index c93abb73..04920e63 100644 --- a/src/defines.h +++ b/src/defines.h @@ -4540,7 +4540,6 @@ #define HOOK_CALC_MANA 60 #define HOOK_LOAD_END 61 #define HOOK_RECALL 62 -#define HOOK_FOLLOW_GOD 63 #define HOOK_BODY_PARTS 65 #define HOOK_APPLY_MAGIC 66 #define HOOK_PLAYER_EXP 67 @@ -44,6 +44,30 @@ void abandon_god(int god) } /* + * Check if god may be followed by player + */ +static bool_ may_follow_god(int god) +{ + if (god == GOD_MELKOR) + { + int i; + + /* Check if player has wielded The One Ring */ + for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) + { + if (p_ptr->inventory[i].name1 == ART_POWER) + { + msg_print("The One Ring has corrupted " + "you, and you are rejected."); + return FALSE; + } + } + } + /* Default is to allow */ + return TRUE; +} + +/* * Get a religion */ void follow_god(int god, bool_ silent) @@ -56,7 +80,7 @@ void follow_god(int god, bool_ silent) } /* Are we allowed ? */ - if (process_hooks(HOOK_FOLLOW_GOD, "(d,s)", god, "ask")) + if (!may_follow_god(god)) return; if (p_ptr->pgod == GOD_NONE) @@ -69,9 +93,6 @@ void follow_god(int god, bool_ silent) s_info[SKILL_UDUN].hidden = FALSE; if (!silent) msg_print("You feel the dark powers of Melkor in you. You can now use the Udun skill."); } - - /* Anything to be done? */ - process_hooks(HOOK_FOLLOW_GOD, "(d,s)", god, "done"); } } diff --git a/src/util.pkg b/src/util.pkg index 3e977785..12a28a71 100644 --- a/src/util.pkg +++ b/src/util.pkg @@ -708,22 +708,6 @@ typedef unsigned int u32b; */ #define HOOK_RECALL 62 -/** @def HOOK_FOLLOW_GOD - * @brief Player follows a god (gets religion).\n - * @param Number god \n the god to follow. - * @brief God - * @param String action \n "ask" to check if player can follow the god, or - * "done" to do something with the god. - * @brief Action - * @return Boolean \n For "ask": TRUE if player can not follow the god, - * otherwise FALSE. - * @note - * If the action is "ask" and the hook returns TRUE, follow_god() returns. - * If the action is "done" the return code is ignored. - * @note (see file gods.c) - */ -#define HOOK_FOLLOW_GOD 63 - /** @def HOOK_BODY_PARTS * @brief Calculate which body parts the player has. * @note (see file xtra1.c) |