summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-21 13:29:21 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-21 13:29:21 +0000
commit50f7fb61fcb4481e94bef693a4d65966e14ee1f9 (patch)
treebe5a3307667a7d0dc7367d574f6bd81d987fa80a /crawl-ref/source/religion.cc
parenta627b871c5540b6cb87871f4386097cccec2b462 (diff)
downloadcrawl-ref-50f7fb61fcb4481e94bef693a4d65966e14ee1f9.tar.gz
crawl-ref-50f7fb61fcb4481e94bef693a4d65966e14ee1f9.zip
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
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc37
1 files changed, 28 insertions, 9 deletions
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;