diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-06 11:09:30 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-07 15:28:26 +0200 |
commit | 92e717a03262c95983d7a6bcaaa7da4923ce850f (patch) | |
tree | 8f01ea14d80d72759d1f8545f3ad3f58d0362605 | |
parent | 5a91c8e154a9b55fa6ccba342f26d8bd03af140d (diff) |
Lua: Remove Lua use of HOOK_QUAFF.
-rw-r--r-- | lib/mods/theme/scpt/corrupt.lua | 8 | ||||
-rw-r--r-- | lib/mods/theme/scpt/misc.lua | 12 | ||||
-rw-r--r-- | lib/scpt/corrupt.lua | 8 | ||||
-rw-r--r-- | src/cmd6.c | 20 |
4 files changed, 19 insertions, 29 deletions
diff --git a/lib/mods/theme/scpt/corrupt.lua b/lib/mods/theme/scpt/corrupt.lua index f3ae60eb..5cacd2b7 100644 --- a/lib/mods/theme/scpt/corrupt.lua +++ b/lib/mods/theme/scpt/corrupt.lua @@ -129,14 +129,6 @@ CORRUPT_DEMON_BREATH = add_corruption [HOOK_CALC_POWERS] = function() player.add_power(PWR_BR_FIRE) end, - [HOOK_QUAFF] = function(obj) - if magik(9) == TRUE then - msg_print("Your demon breath spoils the potion!") - return TRUE, FALSE - else - return FALSE - end - end, }, } diff --git a/lib/mods/theme/scpt/misc.lua b/lib/mods/theme/scpt/misc.lua index 6738b8f3..17eba40f 100644 --- a/lib/mods/theme/scpt/misc.lua +++ b/lib/mods/theme/scpt/misc.lua @@ -164,18 +164,6 @@ add_building_action end } --- function to make Melkor like it if a player quaffs potions of corruption -function melkor_potion_corruption(object) - if (player.pgod == GOD_MELKOR) then - if (object.tval == TV_POTION) and (object.sval == SV_POTION_MUTATION) then - msg_print("Your quaffing of this potion pleases Melkor!") - set_grace(player.grace + 2) - return FALSE - end - end -end -add_hook_script(HOOK_QUAFF, "melkor_potion_corruption", "melkor_potion_corruption") - -- function to check for Key of Orthanc before proceeding to the final level in Isengard add_hooks { diff --git a/lib/scpt/corrupt.lua b/lib/scpt/corrupt.lua index ff2b6541..ae9eff8c 100644 --- a/lib/scpt/corrupt.lua +++ b/lib/scpt/corrupt.lua @@ -110,14 +110,6 @@ CORRUPT_DEMON_BREATH = add_corruption [HOOK_CALC_POWERS] = function() player.add_power(PWR_BR_FIRE) end, - [HOOK_QUAFF] = function(obj) - if magik(9) == TRUE then - msg_print("Your demon breath spoils the potion!") - return TRUE, FALSE - else - return FALSE - end - end, }, } @@ -2335,6 +2335,17 @@ static bool_ quaff_potion(int tval, int sval, int pval, int pval2) case SV_POTION_MUTATION: { + /* In Theme, Melkor likes players who quaff + potions of corruption. */ + if (game_module_idx == MODULE_THEME) + { + GOD(GOD_MELKOR) + { + msg_print("Your quaffing of this potion pleases Melkor!"); + set_grace(p_ptr->grace + 2); + } + } + msg_print("You feel the dark corruptions of Morgoth coming over you!"); gain_random_corruption(0); ident = TRUE; @@ -2478,8 +2489,15 @@ void do_cmd_quaff_potion(void) /* Object level */ lev = k_info[o_ptr->k_idx].level; + /* Demon Breath corruption can spoil potions. */ + if (player_has_corruption(CORRUPT_DEMON_BREATH) && magik(9)) + { + msg_print("Your demon breath spoils the potion!"); + ident = FALSE; + } + /* Analyze the potion */ - if (process_hooks_ret(HOOK_QUAFF, "d", "(O)", o_ptr)) + else if (process_hooks_ret(HOOK_QUAFF, "d", "(O)", o_ptr)) { ident = process_hooks_return[0].num; } |