summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-30 16:09:22 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-30 16:09:22 +0000
commite64fe854e624a576dca8247b01e1f7026784d7ec (patch)
tree83792b92f0fd3d3d6ba5b8ebd176e67a3861f8e0 /crawl-ref/source/religion.cc
parent9eb8b488f5f36e650c60a98a7cc0c18911a9475f (diff)
downloadcrawl-ref-e64fe854e624a576dca8247b01e1f7026784d7ec.tar.gz
crawl-ref-e64fe854e624a576dca8247b01e1f7026784d7ec.zip
Added feedback messages for which type of sacrifice value is leading: given
always when a new type becomes the leader, and 2% of the time for all sacrifices. (For Nemelexites only.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2954 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc53
1 files changed, 38 insertions, 15 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 41afb87f43..5cb96c2c4c 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3169,6 +3169,32 @@ static bool god_likes_item(god_type god, const item_def& item)
}
}
+static int leading_sacrifice_group()
+{
+ int weights[5];
+ get_pure_deck_weights(weights);
+ int best_i = -1, maxweight = -1;
+ for ( int i = 0; i < 5; ++i )
+ {
+ if ( best_i == -1 || weights[i] > maxweight )
+ {
+ maxweight = weights[i];
+ best_i = i;
+ }
+ }
+ return best_i;
+}
+
+static void give_sac_group_feedback(int which)
+{
+ ASSERT( which >= 0 && which < 5 );
+ const char* names[] = {
+ "Escape", "Destruction", "Dungeons", "Summoning", "Wonder"
+ };
+ mprf(MSGCH_GOD, "A symbol of %s coalesces before you, then vanishes.",
+ names[which]);
+}
+
void offer_items()
{
if (you.religion == GOD_NO_GOD || !god_likes_items(you.religion))
@@ -3178,13 +3204,15 @@ void offer_items()
int num_sacced = 0;
int i = igrd[you.x_pos][you.y_pos];
+
+ const int old_leading = leading_sacrifice_group();
+
while (i != NON_ITEM)
{
item_def &item(mitm[i]);
const int next = item.link; // in case we can't get it later.
const int value = item_value( item, true );
-
if (item_is_stationary(item) || !god_likes_item(you.religion, item))
{
i = next;
@@ -3203,9 +3231,8 @@ void offer_items()
if ( is_risky_sacrifice(item) ||
item.inscription.find("=p") != std::string::npos)
{
- std::string msg = "Really sacrifice ";
- msg += item.name(DESC_NOCAP_A);
- msg += "?";
+ const std::string msg =
+ "Really sacrifice " + item.name(DESC_NOCAP_A) + "?";
if (!yesno(msg.c_str()))
{
@@ -3222,17 +3249,6 @@ void offer_items()
you.attribute[ATTR_CARD_COUNTDOWN]);
#endif
}
- // Aproximate piety gain chance.
- // Value: %
- // ---------
- // 10: 9.0%
- // 20: 17.5%
- // 30: 25.5%
- // 40: 34.0%
- // 50: 42.5%
- // 60: 50.0%
- // 70: 58.0%
- // 80: 63.0%
if ((item.base_type == OBJ_CORPSES &&
one_chance_in(2+you.piety/50))
// Nemelex piety gain is fairly fast...at least
@@ -3299,6 +3315,13 @@ void offer_items()
num_sacced++;
}
+ if ( num_sacced > 0 && you.religion == GOD_NEMELEX_XOBEH )
+ {
+ const int new_leading = leading_sacrifice_group();
+ if ( old_leading != new_leading || one_chance_in(50) )
+ give_sac_group_feedback(new_leading);
+ }
+
#if DEBUG_GIFTS || DEBUG_CARDS || DEBUG_SACRIFICE
if (num_sacced > 0 && you.religion == GOD_NEMELEX_XOBEH)
show_pure_deck_chances();