From a1ea029b205648b5b81d264ae7009cd1d31b2af2 Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 18 Apr 2008 06:14:22 +0000 Subject: Clean up TSO artefact handling some more, and fix indentation. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4322 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/randart.cc | 144 ++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 71 deletions(-) (limited to 'crawl-ref/source/randart.cc') diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 8f1c8d4f2a..5e87296e72 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -59,98 +59,100 @@ static bool god_fits_artefact(const god_type which_god, const item_def &item) switch (which_god) { case GOD_BEOGH: - if (brand == SPWPN_ORC_SLAYING) - return (false); // goes against orcish theme - break; + if (brand == SPWPN_ORC_SLAYING) + return (false); // goes against orcish theme + break; case GOD_ELYVILON: // peaceful healer god, no weapons, no berserking - if (item.base_type == OBJ_WEAPONS) - return (false); + if (item.base_type == OBJ_WEAPONS) + return (false); - if (item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_RAGE) - return (false); + if (item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_RAGE) + return (false); - if (randart_wpn_property( item, RAP_ANGRY ) - || randart_wpn_property( item, RAP_BERSERK )) - { - return (false); - } - break; + if (randart_wpn_property( item, RAP_ANGRY ) + || randart_wpn_property( item, RAP_BERSERK )) + { + return (false); + } + break; case GOD_OKAWARU: // precision fighter - if (item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_INACCURACY) - return (false); - break; + if (item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_INACCURACY) + return (false); + break; case GOD_ZIN: - if (item.base_type == OBJ_JEWELLERY && item.sub_type == RING_HUNGER) - return (false); // goes against food theme + if (item.base_type == OBJ_JEWELLERY && item.sub_type == RING_HUNGER) + return (false); // goes against food theme - if (randart_wpn_property( item, RAP_MUTAGENIC )) - return (false); // goes against anti-mutagenic theme - break; + if (randart_wpn_property( item, RAP_MUTAGENIC )) + return (false); // goes against anti-mutagenic theme + break; case GOD_SHINING_ONE: // holiness, honourable combat - if (item.base_type == OBJ_WEAPONS && brand != SPWPN_HOLY_WRATH) - { - return (false); - } - - if (randart_wpn_property( item, RAP_INVISIBLE ) - || randart_wpn_property( item, RAP_STEALTH ) > 0) - { - return (false); - } - - if (randart_wpn_property( item, RAP_AC ) < 0 - || randart_wpn_property( item, RAP_EVASION ) < 0 - || randart_wpn_property( item, RAP_STRENGTH ) < 0 - || randart_wpn_property( item, RAP_INTELLIGENCE ) < 0 - || randart_wpn_property( item, RAP_DEXTERITY ) < 0 - || randart_wpn_property( item, RAP_FIRE ) < 0 - || randart_wpn_property( item, RAP_COLD ) < 0 - || randart_wpn_property( item, RAP_NOISES ) - || randart_wpn_property( item, RAP_PREVENT_SPELLCASTING ) - || randart_wpn_property( item, RAP_CAUSE_TELEPORTATION ) - || randart_wpn_property( item, RAP_PREVENT_TELEPORTATION ) - || randart_wpn_property( item, RAP_ANGRY ) - || randart_wpn_property( item, RAP_METABOLISM ) - || randart_wpn_property( item, RAP_MUTAGENIC ) - || randart_wpn_property( item, RAP_ACCURACY ) < 0 - || randart_wpn_property( item, RAP_DAMAGE ) < 0) - { - return (false); // filter out negative effects - } - - break; + if (item.base_type == OBJ_WEAPONS && brand != SPWPN_HOLY_WRATH) + { + return (false); + } + + if (randart_wpn_property( item, RAP_INVISIBLE ) + || randart_wpn_property( item, RAP_STEALTH ) > 0) + { + return (false); + } + + if (is_blessed(item)) // remove negative effects on blessed weapons + { + if (randart_wpn_property( item, RAP_AC ) < 0 + || randart_wpn_property( item, RAP_EVASION ) < 0 + || randart_wpn_property( item, RAP_STRENGTH ) < 0 + || randart_wpn_property( item, RAP_INTELLIGENCE ) < 0 + || randart_wpn_property( item, RAP_DEXTERITY ) < 0 + || randart_wpn_property( item, RAP_FIRE ) < 0 + || randart_wpn_property( item, RAP_COLD ) < 0 + || randart_wpn_property( item, RAP_NOISES ) + || randart_wpn_property( item, RAP_PREVENT_SPELLCASTING ) + || randart_wpn_property( item, RAP_CAUSE_TELEPORTATION ) + || randart_wpn_property( item, RAP_PREVENT_TELEPORTATION ) + || randart_wpn_property( item, RAP_ANGRY ) + || randart_wpn_property( item, RAP_METABOLISM ) + || randart_wpn_property( item, RAP_MUTAGENIC ) + || randart_wpn_property( item, RAP_ACCURACY ) < 0 + || randart_wpn_property( item, RAP_DAMAGE ) < 0) + { + return (false); + } + } + break; case GOD_LUGONU: // corruption - if (item.base_type == OBJ_WEAPONS && brand != SPWPN_DISTORTION) - return (false); - break; + if (item.base_type == OBJ_WEAPONS && brand != SPWPN_DISTORTION) + return (false); + break; case GOD_SIF_MUNA: case GOD_KIKUBAAQUDGHA: case GOD_VEHUMET: - if (randart_wpn_property( item, RAP_PREVENT_SPELLCASTING )) - return (false); - break; + if (randart_wpn_property( item, RAP_PREVENT_SPELLCASTING )) + return (false); + break; case GOD_TROG: // hates anything enhancing magic - if (item.base_type == OBJ_JEWELLERY && (item.sub_type == RING_WIZARDRY - || item.sub_type == RING_FIRE || item.sub_type == RING_ICE - || item.sub_type == RING_MAGICAL_POWER)) - { - return (false); - } - if (brand == SPWPN_PAIN) // involves magic - return (false); - - if (randart_wpn_property( item, RAP_MAGICAL_POWER )) - return (false); + if (item.base_type == OBJ_JEWELLERY && (item.sub_type == RING_WIZARDRY + || item.sub_type == RING_FIRE || item.sub_type == RING_ICE + || item.sub_type == RING_MAGICAL_POWER)) + { + return (false); + } + if (brand == SPWPN_PAIN) // involves magic + return (false); + + if (randart_wpn_property( item, RAP_MAGICAL_POWER )) + return (false); default: - break; + break; } return (true); -- cgit v1.2.3-54-g00ecf