diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-10-29 20:11:34 -0500 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-10-29 20:11:34 -0500 |
commit | e87d3c47813d6c9f61e23cedf7f17774b17e15f4 (patch) | |
tree | 72d93cec3ee652f269865faeb0846673cda844b7 /crawl-ref/source/goditem.cc | |
parent | 33606730c0524490181d3c9d63ee947e9179e511 (diff) | |
download | crawl-ref-e87d3c47813d6c9f61e23cedf7f17774b17e15f4.tar.gz crawl-ref-e87d3c47813d6c9f61e23cedf7f17774b17e15f4.zip |
Fix check for good gods' and Feawn's disliking weapons of chaos so that
it actually works. Note that the first of these is no longer in
good_god_hates_item_handling(), as weapons of chaos are only potentially
evil. Also, add wands of random effects to the list of potentially evil
items, as they might as well be wands of chaos.
Diffstat (limited to 'crawl-ref/source/goditem.cc')
-rw-r--r-- | crawl-ref/source/goditem.cc | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc index 8d33879408..1438f388dc 100644 --- a/crawl-ref/source/goditem.cc +++ b/crawl-ref/source/goditem.cc @@ -17,7 +17,6 @@ #include "externs.h" - bool is_holy_item(const item_def& item) { bool retval = false; @@ -52,6 +51,35 @@ bool is_holy_item(const item_def& item) return (retval); } +bool is_potentially_evil_item(const item_def& item) +{ + switch (item.base_type) + { + case OBJ_WEAPONS: + { + const int item_brand = get_weapon_brand(item); + if (item_brand == SPWPN_CHAOS) + return (true); + } + break; + case OBJ_MISSILES: + { + const int item_brand = get_ammo_brand(item); + if (item_brand == SPMSL_CHAOS) + return (true); + } + break; + case OBJ_WANDS: + if (item.sub_type == WAND_RANDOM_EFFECTS) + return (true); + break; + default: + break; + } + + return (false); +} + bool is_evil_item(const item_def& item) { bool retval = false; @@ -69,7 +97,6 @@ bool is_evil_item(const item_def& item) case OBJ_WEAPONS: { const int item_brand = get_weapon_brand(item); - retval = (is_demonic(item) || item_brand == SPWPN_DRAINING || item_brand == SPWPN_PAIN @@ -80,7 +107,7 @@ bool is_evil_item(const item_def& item) case OBJ_MISSILES: { const int item_brand = get_ammo_brand(item); - retval = is_demonic(item) || item_brand == SPMSL_REAPING; + retval = (item_brand == SPMSL_REAPING); break; } case OBJ_WANDS: @@ -193,6 +220,7 @@ bool is_hasty_item(const item_def& item) default: break; } + return (false); } @@ -335,12 +363,8 @@ conduct_type good_god_hates_item_handling(const item_def &item) if (is_demonic(item)) return (DID_UNHOLY); - if (item_type_known(item) - || item.base_type == OBJ_WEAPONS - && get_weapon_brand(item) == SPWPN_CHAOS) - { + if (item_type_known(item)) return (DID_NECROMANCY); - } return (DID_NOTHING); } @@ -350,20 +374,14 @@ conduct_type god_hates_item_handling(const item_def &item) switch (you.religion) { case GOD_ZIN: - if (item_type_known(item) && is_chaotic_item(item)) - return (DID_CHAOS); - break; - - case GOD_FEAWN: if (!item_type_known(item)) return (DID_NOTHING); - if (is_evil_item(item) - || item.base_type == OBJ_WEAPONS - && get_weapon_brand(item) == SPWPN_CHAOS) - { + if (is_chaotic_item(item)) + return (DID_CHAOS); + + if (is_potentially_evil_item(item)) return (DID_NECROMANCY); - } break; case GOD_SHINING_ONE: @@ -397,9 +415,17 @@ conduct_type god_hates_item_handling(const item_def &item) default: break; } + + if (is_potentially_evil_item(item)) + return (DID_NECROMANCY); break; } + case GOD_ELYVILON: + if (item_type_known(item) && is_potentially_evil_item(item)) + return (DID_NECROMANCY); + break; + case GOD_YREDELEMNUL: if (item_type_known(item) && is_holy_item(item)) return (DID_HOLY); @@ -414,6 +440,14 @@ conduct_type god_hates_item_handling(const item_def &item) } break; + case GOD_FEAWN: + if (item_type_known(item) + && is_potentially_evil_item(item) || is_evil_item(item)) + { + return (DID_NECROMANCY); + } + break; + case GOD_CHEIBRIADOS: if (item_type_known(item) && is_hasty_item(item)) return (DID_HASTY); |