summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-21 17:49:24 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-21 17:49:24 +0000
commit0a930fa79787f0e7f4b4ab2f4e223b58b58690c7 (patch)
tree7f8b16f8378873a9564c98a8e8e1104923aed5cd /crawl-ref/source/player.cc
parenta8a6b89f6b751da432faa31b9be145ec8532294f (diff)
downloadcrawl-ref-0a930fa79787f0e7f4b4ab2f4e223b58b58690c7.tar.gz
crawl-ref-0a930fa79787f0e7f4b4ab2f4e223b58b58690c7.zip
Make Zin dislike when the player takes an action that makes an already
existing mutagenic glow stronger (piety loss, no penalty). At the same time go easier on the "eat souled being" misbehaviour: increased piety loss, but give penance only for eating very intelligent monsters, so that eating goblins and the like is an option again. (Cannibalism is checked first, and has worse effects.) Also fix restriction for items offered for ?recharging. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3789 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc96
1 files changed, 63 insertions, 33 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index a1318308c9..21f3fc2ec3 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3566,6 +3566,23 @@ static void ability_increase()
}
} // end ability_increase()
+static const char * _get_rotting_how()
+{
+ ASSERT(you.rotting > 0 || you.species == SP_GHOUL);
+
+ if (you.rotting > 15)
+ return (" before your eyes");
+ if (you.rotting > 8)
+ return (" away quickly");
+ if (you.rotting > 4)
+ return (" badly");
+
+ if (you.species == SP_GHOUL)
+ return (" faster than usual");
+
+ return("");
+}
+
void display_char_status()
{
if (you.species == SP_VAMPIRE && you.hunger_state == HS_ENGORGED)
@@ -3799,19 +3816,10 @@ void display_char_status()
}
if (you.rotting || you.species == SP_GHOUL)
- {
- // I apologize in advance for the horrendous ugliness about to
- // transpire. Avert your eyes!
- mprf("Your flesh is rotting%s",
- (you.rotting > 15) ? " before your eyes." :
- (you.rotting > 8) ? " away quickly." :
- (you.rotting > 4) ? " badly." :
- ((you.species == SP_GHOUL && you.rotting) ?
- " faster than usual." : ".") );
- }
+ mprf("Your flesh is rotting%s.", _get_rotting_how());
// prints a contamination message
- contaminate_player( 0, true );
+ contaminate_player( 0, false, true );
if (you.duration[DUR_CONFUSING_TOUCH])
{
@@ -4757,12 +4765,32 @@ void set_mp(int new_amount, bool max_too)
return;
} // end set_mp()
-void contaminate_player(int change, bool statusOnly)
+static int _get_contamination_level()
{
- // get current contamination level
- int old_level;
- int new_level;
+ const int glow = you.magic_contamination;
+ if (glow > 60)
+ return (glow / 20 + 2);
+ if (glow > 40)
+ return 4;
+ if (glow > 25)
+ return 3;
+ if (glow > 15)
+ return 2;
+ if (glow > 5)
+ return 1;
+
+ return 0;
+}
+
+// controlled is true if the player actively did something to cause
+// contamination (such as drink a known potion of resistance),
+// status_only is true only for the status output
+void contaminate_player(int change, bool controlled, bool status_only)
+{
+ // get current contamination level
+ int old_level = _get_contamination_level();
+ int new_level = 0;
#if DEBUG_DIAGNOSTICS
if (change > 0 || (change < 0 && you.magic_contamination))
@@ -4772,12 +4800,6 @@ void contaminate_player(int change, bool statusOnly)
}
#endif
- old_level = (you.magic_contamination > 60)?(you.magic_contamination / 20 + 2) :
- (you.magic_contamination > 40)?4 :
- (you.magic_contamination > 25)?3 :
- (you.magic_contamination > 15)?2 :
- (you.magic_contamination > 5)?1 : 0;
-
// make the change
if (change + you.magic_contamination < 0)
you.magic_contamination = 0;
@@ -4790,13 +4812,9 @@ void contaminate_player(int change, bool statusOnly)
}
// figure out new level
- new_level = (you.magic_contamination > 60)?(you.magic_contamination / 20 + 2) :
- (you.magic_contamination > 40)?4 :
- (you.magic_contamination > 25)?3 :
- (you.magic_contamination > 15)?2 :
- (you.magic_contamination > 5)?1 : 0;
+ new_level = _get_contamination_level();
- if (statusOnly)
+ if (status_only)
{
if (new_level > 0)
{
@@ -4818,12 +4836,24 @@ void contaminate_player(int change, bool statusOnly)
return;
}
- if (new_level == old_level)
- return;
+ if (new_level != old_level)
+ {
+ mprf((change > 0) ? MSGCH_WARN : MSGCH_RECOVERY,
+ "You feel %s contaminated with magical energies.",
+ (change > 0) ? "more" : "less" );
+ }
- mprf((change > 0) ? MSGCH_WARN : MSGCH_RECOVERY,
- "You feel %s contaminated with magical energies.",
- (change > 0) ? "more" : "less" );
+ // Zin doesn't like mutations or mutagenic radiation.
+ if (you.religion == GOD_ZIN)
+ {
+ // Whenever the glow status is first reached, give a warning message.
+ if (old_level < 1 && new_level >= 1)
+ did_god_conduct(DID_CAUSE_GLOWING, 0, false);
+ // If the player actively did something to increase glowing,
+ // Zin is displeased.
+ else if (controlled && change > 0 && old_level > 0)
+ did_god_conduct(DID_CAUSE_GLOWING, 1 + new_level, true);
+ }
}
bool poison_player( int amount, bool force )
@@ -4979,7 +5009,7 @@ void haste_player( int amount )
else
{
mpr( "You feel as though your hastened speed will last longer." );
- contaminate_player(1);
+ contaminate_player(1, true); // always deliberate
}
you.duration[DUR_HASTE] += amount;