summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/abl-show.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 12:46:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 12:46:08 +0000
commita86d2a52392ed50ba63ed9712c05f3574e45d695 (patch)
tree119721aaeb398f83686f783efcbf92ba5f3cd5f9 /crawl-ref/source/abl-show.cc
parent612b5c431864991b19105694131ba1314012e631 (diff)
downloadcrawl-ref-a86d2a52392ed50ba63ed9712c05f3574e45d695.tar.gz
crawl-ref-a86d2a52392ed50ba63ed9712c05f3574e45d695.zip
Fix 1974137: Stat-lowering transformations resulting in death by stat
loss. Now take to-be-removed equipment in account and don't transform in the removed equipment or the stat loss or both in combination would decrease one of your stats to (below) 0. For the vampire bat transformation, this check only happens after the ability failure check, so this could be improved. In any case, it's better than dying. Also, fix wrongly treating armour as worn when checking for stat loss by wearing. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5294 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/abl-show.cc')
-rw-r--r--crawl-ref/source/abl-show.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 7696b5589a..62be13def5 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -832,7 +832,7 @@ bool activate_ability()
return false;
}
- if ( you.duration[DUR_CONF] )
+ if (you.duration[DUR_CONF])
{
talents = your_talents(true);
if ( talents.empty() )
@@ -844,7 +844,7 @@ bool activate_ability()
}
int selected = -1;
- while ( selected < 0 )
+ while (selected < 0)
{
msg::streams(MSGCH_PROMPT) << "Use which ability? (? or * to list)"
<< std::endl;
@@ -871,7 +871,7 @@ bool activate_ability()
// try to find the hotkey
for (unsigned int i = 0; i < talents.size(); ++i)
{
- if ( talents[i].hotkey == keyin )
+ if (talents[i].hotkey == keyin)
{
selected = static_cast<int>(i);
break;
@@ -879,7 +879,7 @@ bool activate_ability()
}
// if we can't, cancel out
- if ( selected < 0 )
+ if (selected < 0)
{
mpr("You can't do that.");
crawl_state.zero_turns_taken();
@@ -894,17 +894,20 @@ bool activate_ability()
static bool _activate_talent(const talent& tal)
{
// Doing these would outright kill the player due to stat drain.
- if (tal.which == ABIL_TRAN_BAT && you.strength <= 5)
+ if (tal.which == ABIL_TRAN_BAT)
{
- mpr("You lack the strength for this transformation.");
- crawl_state.zero_turns_taken();
- return (false);
+ if (you.strength <= 5)
+ {
+ mpr("You lack the strength for this transformation.", MSGCH_WARN);
+ crawl_state.zero_turns_taken();
+ return (false);
+ }
}
else if (tal.which == ABIL_END_TRANSFORMATION
&& you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT
&& you.dex <= 5)
{
- mpr("Turning back with such low dexterity would be fatal!");
+ mpr("Turning back with such low dexterity would be fatal!", MSGCH_WARN);
more();
crawl_state.zero_turns_taken();
return (false);
@@ -1831,7 +1834,11 @@ static bool _do_ability(const ability_def& abil)
break;
case ABIL_TRAN_BAT:
- transform(100, TRAN_BAT);
+ if (!transform(100, TRAN_BAT))
+ {
+ crawl_state.zero_turns_taken();
+ return (false);
+ }
break;
case ABIL_RENOUNCE_RELIGION: