summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-15 20:45:21 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-15 20:45:21 +0000
commit32da929a4bcb1df6fd18310982abc041e8390907 (patch)
tree3ec5a6481e1befa954dd545fbd36f4a79b2410ba /crawl-ref/source
parent0a22591e3b05f479def2d67dc5c935aaddf072d1 (diff)
downloadcrawl-ref-32da929a4bcb1df6fd18310982abc041e8390907.tar.gz
crawl-ref-32da929a4bcb1df6fd18310982abc041e8390907.zip
Add more weapon blessing cleanups for TSO.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4248 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/itemprop.cc29
-rw-r--r--crawl-ref/source/itemprop.h3
-rw-r--r--crawl-ref/source/religion.cc17
4 files changed, 33 insertions, 18 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 83df88075c..2d8956fcd8 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -172,7 +172,7 @@ bool can_wield(const item_def *weapon, bool say_reason,
&& (!is_fixed_artefact( *weapon )
&& (weap_brand == SPWPN_HOLY_WRATH
|| (weapon->base_type == OBJ_WEAPONS
- && weapon->sub_type == WPN_BLESSED_BLADE))))
+ && is_blessed(*weapon)))))
{
SAY(mpr("This weapon will not allow you to wield it."));
return false;
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index b8218a96b6..29575844e6 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1577,7 +1577,6 @@ int double_wpn_awkward_speed( const item_def &item )
return ((base * 30 + 10) / 20 + 2);
}
-
bool is_demonic( const item_def &item )
{
if (item.base_type == OBJ_WEAPONS)
@@ -1597,7 +1596,24 @@ bool is_demonic( const item_def &item )
return (false);
} // end is_demonic()
-bool demonic2nondemonic( item_def &item, bool allow_blessed )
+bool is_blessed( const item_def &item )
+{
+ if (item.base_type == OBJ_WEAPONS)
+ {
+ switch (item.sub_type)
+ {
+ case WPN_BLESSED_BLADE:
+ return (true);
+
+ default:
+ break;
+ }
+ }
+
+ return (false);
+} // end is_demonic()
+
+bool normal2good( item_def &item, bool allow_blessed )
{
if (item.base_type != OBJ_WEAPONS)
return (false);
@@ -1608,7 +1624,10 @@ bool demonic2nondemonic( item_def &item, bool allow_blessed )
return (false);
case WPN_DEMON_BLADE:
- item.sub_type = (allow_blessed) ? WPN_BLESSED_BLADE : WPN_SCIMITAR;
+ if (!allow_blessed)
+ item.sub_type = WPN_SCIMITAR;
+ else
+ item.sub_type = WPN_BLESSED_BLADE;
break;
case WPN_DEMON_WHIP:
@@ -1621,7 +1640,7 @@ bool demonic2nondemonic( item_def &item, bool allow_blessed )
}
return (true);
-} // end demonic2nondemonic()
+} // end normal2good()
int weapon_str_weight( const item_def &wpn )
{
@@ -1823,7 +1842,7 @@ bool check_weapon_shape( const item_def &item, bool quiet, bool check_id )
if ((!check_id || item_type_known( item ))
&& ((item.base_type == OBJ_WEAPONS
- && item.sub_type == WPN_BLESSED_BLADE)
+ && is_blessed(item))
|| brand == SPWPN_HOLY_WRATH)
&& (you.is_undead || you.species == SP_DEMONSPAWN))
{
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index dbaea713a9..b9b367ef52 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -661,7 +661,8 @@ 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, bool allow_blessed = true );
+bool is_blessed( const item_def &item );
+bool normal2good( item_def &item, bool allow_blessed = true );
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 8b60c87e58..e6e5c5de1c 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -911,10 +911,9 @@ static bool _tso_blessing_holy_wpn(monsters *mon)
set_item_ego_type(wpn, OBJ_WEAPONS, SPWPN_HOLY_WRATH);
wpn.colour = YELLOW;
- // Convert demonic weapons into non-demonic weapons, not allowing
- // blessed weapons, since the holy wrath brand is the blessing.
+ // Convert demonic weapons into non-demonic weapons.
if (is_demonic(wpn))
- demonic2nondemonic(wpn, false);
+ normal2good(wpn, false);
return true;
}
@@ -4065,6 +4064,9 @@ static bool _bless_weapon( god_type god, int brand, int colour )
enchant_weapon( ENCHANT_TO_HIT, true, you.inv[wpn] );
enchant_weapon( ENCHANT_TO_DAM, true, you.inv[wpn] );
+ if ( is_good_god(god) )
+ normal2good(you.inv[wpn]);
+
you.wield_change = true;
you.num_gifts[god]++;
take_note(Note(NOTE_GOD_GIFT, you.religion));
@@ -4157,14 +4159,7 @@ static void _altar_prayer()
const int wpn = get_player_wielded_weapon();
if (wpn != -1 && get_weapon_brand(you.inv[wpn]) != SPWPN_HOLY_WRATH)
- {
- if (_bless_weapon(GOD_SHINING_ONE, SPWPN_HOLY_WRATH, YELLOW))
- {
- // convert demonic weapons into non-demonic weapons
- if (is_demonic(you.inv[wpn]))
- demonic2nondemonic(you.inv[wpn]);
- }
- }
+ _bless_weapon(GOD_SHINING_ONE, SPWPN_HOLY_WRATH, YELLOW);
}
// Lugonu blesses weapons with distortion