summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
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;