From 8947c0ad81e7b3f8d2cde4eb1c8c6317d2790f22 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 14 Apr 2008 01:11:22 +0000 Subject: Let TSO's blessings properly convert demonic weapons into non-demonic weapons. Note that demon blades now become scimitars. This will be improved later. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4224 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/itemprop.cc | 70 ++++++++++++++++++++++++++++++-------------- crawl-ref/source/itemprop.h | 1 + crawl-ref/source/religion.cc | 8 ++--- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 1feee1460f..966ee4ac7a 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -895,7 +895,7 @@ int get_ammo_brand( const item_def &item ) special_armour_type get_armour_ego_type( const item_def &item ) { // artefact armours have no ego type, must look up powers separately - if (item.base_type != OBJ_ARMOUR + if (item.base_type != OBJ_ARMOUR || (is_random_artefact( item ) && !is_unrandom_artefact( item ))) { return (SPARM_NORMAL); @@ -904,7 +904,7 @@ special_armour_type get_armour_ego_type( const item_def &item ) return (static_cast(item.special)); } -// +// // Armour information and checking functions // bool hide2armour( item_def &item ) @@ -917,36 +917,36 @@ bool hide2armour( item_def &item ) default: return (false); - case ARM_DRAGON_HIDE: - item.sub_type = ARM_DRAGON_ARMOUR; + case ARM_DRAGON_HIDE: + item.sub_type = ARM_DRAGON_ARMOUR; break; - case ARM_TROLL_HIDE: - item.sub_type = ARM_TROLL_LEATHER_ARMOUR; + case ARM_TROLL_HIDE: + item.sub_type = ARM_TROLL_LEATHER_ARMOUR; break; - case ARM_ICE_DRAGON_HIDE: - item.sub_type = ARM_ICE_DRAGON_ARMOUR; + case ARM_ICE_DRAGON_HIDE: + item.sub_type = ARM_ICE_DRAGON_ARMOUR; break; - case ARM_MOTTLED_DRAGON_HIDE: - item.sub_type = ARM_MOTTLED_DRAGON_ARMOUR; + case ARM_MOTTLED_DRAGON_HIDE: + item.sub_type = ARM_MOTTLED_DRAGON_ARMOUR; break; - case ARM_STORM_DRAGON_HIDE: - item.sub_type = ARM_STORM_DRAGON_ARMOUR; + case ARM_STORM_DRAGON_HIDE: + item.sub_type = ARM_STORM_DRAGON_ARMOUR; break; - case ARM_GOLD_DRAGON_HIDE: - item.sub_type = ARM_GOLD_DRAGON_ARMOUR; + case ARM_GOLD_DRAGON_HIDE: + item.sub_type = ARM_GOLD_DRAGON_ARMOUR; break; - case ARM_SWAMP_DRAGON_HIDE: - item.sub_type = ARM_SWAMP_DRAGON_ARMOUR; + case ARM_SWAMP_DRAGON_HIDE: + item.sub_type = ARM_SWAMP_DRAGON_ARMOUR; break; - case ARM_STEAM_DRAGON_HIDE: - item.sub_type = ARM_STEAM_DRAGON_ARMOUR; + case ARM_STEAM_DRAGON_HIDE: + item.sub_type = ARM_STEAM_DRAGON_ARMOUR; break; } @@ -1483,7 +1483,7 @@ hands_reqd_type hands_reqd( const item_def &item, size_type size ) case OBJ_WEAPONS: // Merging staff with magical staves for consistency... doing // as a special case because we want to be very flexible with - // these useful objects (we want spriggans and ogre magi to + // these useful objects (we want spriggans and ogre magi to // be able to use them). if (item.base_type == OBJ_STAVES || item.sub_type == WPN_QUARTERSTAFF) { @@ -1491,7 +1491,7 @@ hands_reqd_type hands_reqd( const item_def &item, size_type size ) ret = HANDS_TWO; else if (size > SIZE_LARGE) ret = HANDS_ONE; - else + else ret = HANDS_HALF; break; } @@ -1536,12 +1536,12 @@ hands_reqd_type hands_reqd( const item_def &item, size_type size ) ret = HANDS_TWO; break; - case OBJ_ARMOUR: // barding and body armours are unwieldy + case OBJ_ARMOUR: // barding and body armours are unwieldy if (item.sub_type == ARM_NAGA_BARDING || item.sub_type == ARM_CENTAUR_BARDING || get_armour_slot( item ) == EQ_BODY_ARMOUR) { - ret = HANDS_TWO; + ret = HANDS_TWO; } break; @@ -1596,6 +1596,32 @@ bool is_demonic( const item_def &item ) return (false); } // end is_demonic() +bool demonic2nondemonic( item_def &item ) +{ + if (item.base_type != OBJ_WEAPONS) + return (false); + + switch (item.sub_type) + { + default: + return (false); + + case WPN_DEMON_BLADE: + item.sub_type = WPN_SCIMITAR; + break; + + case WPN_DEMON_WHIP: + item.sub_type = WPN_WHIP; + break; + + case WPN_DEMON_TRIDENT: + item.sub_type = WPN_TRIDENT; + break; + } + + return (true); +} // end demonic2nondemonic() + int weapon_str_weight( const item_def &wpn ) { ASSERT (wpn.base_type == OBJ_WEAPONS || wpn.base_type == OBJ_STAVES); diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index e7dc5fcab0..d5d71661f9 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -661,6 +661,7 @@ bool is_double_ended( const item_def &item ); int double_wpn_awkward_speed( const item_def &item ); bool is_demonic( const item_def &item ); +bool demonic2nondemonic( item_def &item ); int get_vorpal_type( const item_def &item ); int get_damage_type( const item_def &item ); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index ac445368d9..9cf4d40ab2 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -915,9 +915,9 @@ static bool tso_blessing_holy_wpn(monsters *mon) set_item_ego_type(wpn, OBJ_WEAPONS, SPWPN_HOLY_WRATH); wpn.colour = YELLOW; - // Convert a demon weapon into a blessed blade. + // Convert demonic weapons into non-demonic weapons. if (is_demonic(wpn)) - wpn.sub_type = WPN_BLESSED_BLADE; + demonic2nondemonic(wpn); return true; } @@ -4158,9 +4158,9 @@ void altar_prayer() { if (bless_weapon(GOD_SHINING_ONE, SPWPN_HOLY_WRATH, YELLOW)) { - // convert demon weapons into blessed blades + // convert demonic weapons into non-demonic weapons if (is_demonic(you.inv[wpn])) - you.inv[wpn].sub_type = WPN_BLESSED_BLADE; + demonic2nondemonic(you.inv[wpn]); } } } -- cgit v1.2.3-54-g00ecf