From 50f7fb61fcb4481e94bef693a4d65966e14ee1f9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 21 Nov 2007 13:29:21 +0000 Subject: Finally include Ely piety gain from Destroy Weapon depending on both current piety and item value. (Only in 0.3 up to now. Whoops.) And make "evil" weapons (demonic, vampiric, pain, draining) always give piety when destroyed. (FR1832851) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2888 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/religion.cc | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/religion.cc') diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 3c666090c9..78b047734c 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1851,6 +1851,17 @@ static bool need_water_walking() grd[you.x_pos][you.y_pos] == DNGN_DEEP_WATER; } +static bool is_evil_weapon(item_def weap) +{ + if (weap.base_type != OBJ_WEAPONS) + return false; + + return (is_demonic(weap) + || weap.special == SPWPN_VAMPIRICISM + || weap.special == SPWPN_PAIN + || weap.special == SPWPN_DRAINING); +} + bool ely_destroy_weapons() { if (you.religion != GOD_ELYVILON) @@ -1872,25 +1883,33 @@ bool ely_destroy_weapons() continue; } - std::ostream& strm = msg::streams(MSGCH_GOD); - strm << mitm[i].name(DESC_CAP_THE); - if ( mitm[i].quantity == 1 ) - strm << " shimmers and breaks into pieces." << std::endl; - else - strm << " shimmer and break into pieces." << std::endl; - const int value = item_value( mitm[i], true ); #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Destroyed weapon value: %d", value); #endif - if (random2(value) >= random2(50) + bool pgain = false; + if (is_evil_weapon(mitm[i]) + || random2(value) >= random2(250) // artefacts (incl. most randarts) + || random2(value) >= random2(100) && one_chance_in(1 + you.piety/50) || (mitm[i].base_type == OBJ_WEAPONS && (you.piety < 30 || player_under_penance()))) { + pgain = true; gain_piety(1); } - + + std::ostream& strm = msg::streams(MSGCH_GOD); + strm << mitm[i].name(DESC_CAP_THE); + + if (!pgain) + strm << " barely"; + + if ( mitm[i].quantity == 1 ) + strm << " shimmers and breaks into pieces." << std::endl; + else + strm << " shimmer and break into pieces." << std::endl; + destroy_item(i); success = true; i = next; -- cgit v1.2.3-54-g00ecf