diff options
-rw-r--r-- | crawl-ref/source/enum.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 35 | ||||
-rw-r--r-- | crawl-ref/source/religion.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 9 |
4 files changed, 31 insertions, 18 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 64b6193955..5ef53a802a 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -723,6 +723,7 @@ enum command_type enum conduct_type { + DID_NOTHING, DID_NECROMANCY = 1, // vamp/drain/pain wpns, Zong/Curses DID_HOLY, // holy wrath wpns, holy word scrolls DID_UNHOLY, // demon wpns, demon spells diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 11fa48009e..d8ee95913d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -4065,30 +4065,35 @@ bool god_hates_rod(const item_def& item) return (is_spellbook_type(item, true, god_hates_spell_type)); } -bool good_god_hates_item_handling(const item_def &item) +conduct_type good_god_hates_item_handling(const item_def &item) { - return (is_good_god(you.religion) && is_evil_item(item) - && (is_demonic(item) || item_type_known(item))); + if (!is_good_god(you.religion) || !is_evil_item(item)) + return DID_NOTHING; + if (is_demonic(item)) + return DID_UNHOLY; + if (item_type_known(item)) + return DID_NECROMANCY; + return DID_NOTHING; } -bool god_hates_item_handling(const item_def &item) +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 (true); + return (DID_CHAOS); break; case GOD_FEAWN: if (item_type_known(item) && is_evil_item(item)) - return (true); + return (DID_NECROMANCY); break; case GOD_SHINING_ONE: { if (!item_type_known(item)) - return (false); + return (DID_NOTHING); switch (item.base_type) { @@ -4096,7 +4101,7 @@ bool god_hates_item_handling(const item_def &item) { const int item_brand = get_weapon_brand(item); if (item_brand == SPWPN_VENOM) - return (true); + return (DID_POISON); break; } @@ -4104,13 +4109,13 @@ bool god_hates_item_handling(const item_def &item) { const int item_brand = get_ammo_brand(item); if (item_brand == SPMSL_POISONED || item_brand == SPMSL_CURARE) - return (true); + return (DID_POISON); break; } case OBJ_STAVES: if (item.sub_type == STAFF_POISON) - return (true); + return (DID_POISON); break; default: @@ -4121,7 +4126,7 @@ bool god_hates_item_handling(const item_def &item) case GOD_YREDELEMNUL: if (item_type_known(item) && is_holy_item(item)) - return (true); + return (DID_HOLY); break; case GOD_TROG: @@ -4129,7 +4134,7 @@ bool god_hates_item_handling(const item_def &item) && item.sub_type != BOOK_MANUAL && item.sub_type != BOOK_DESTRUCTION) { - return (true); + return (DID_SPELL_MEMORISE); } break; @@ -4140,10 +4145,10 @@ bool god_hates_item_handling(const item_def &item) if (item_type_known(item) && (god_hates_spellbook(item) || god_hates_rod(item))) { - return (true); - } + return (NUM_CONDUCTS); // FIXME: get the specific reason, if it + } // will ever be needed for spellbooks. - return (false); + return (DID_NOTHING); } bool god_hates_spell_type(spell_type spell, god_type god) diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index b9009157c3..9aabab95a1 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -139,8 +139,8 @@ bool is_holy_rod(const item_def& item); bool is_evil_rod(const item_def& item); bool is_chaotic_rod(const item_def& item); bool god_hates_rod(const item_def& item); -bool good_god_hates_item_handling(const item_def &item); -bool god_hates_item_handling(const item_def &item); +conduct_type good_god_hates_item_handling(const item_def &item); +conduct_type god_hates_item_handling(const item_def &item); bool god_hates_spell_type(spell_type spell, god_type god = you.religion); // NOTE: As of now, these two functions only say if a god won't give a diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 83e14e2816..a534f0f862 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1582,6 +1582,7 @@ bool summon_holy_warrior(int pow, god_type god, int spell, bool cast_tukimas_dance(int pow, god_type god, bool force_hostile) { bool success = true; + conduct_type why; const int dur = std::min(2 + (random2(pow) / 5), 6); @@ -1662,7 +1663,6 @@ bool cast_tukimas_dance(int pow, god_type god, bool force_hostile) mitm[i].flags |= ISFLAG_THROWN; mprf("%s dances into the air!", you.inv[wpn].name(DESC_CAP_YOUR).c_str()); - you.inv[wpn].quantity = 0; destroy_item(menv[monster].inv[MSLOT_WEAPON]); @@ -1670,6 +1670,13 @@ bool cast_tukimas_dance(int pow, god_type god, bool force_hostile) menv[monster].colour = mitm[i].colour; burden_change(); + if ((why = god_hates_item_handling(you.inv[wpn])) + || (why = good_god_hates_item_handling(you.inv[wpn]))) + { + simple_god_message(" booms: How dare you animate that foul thing!"); + did_god_conduct(why, 10, true, &menv[monster]); + } + return (true); } |