summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/abl-show.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-06 14:35:34 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-06 14:35:34 +0000
commit2772e5117bba390bc735af3dd9e0853f93a8306d (patch)
tree042d40988bfd467f0aa8b730c48ba7c1c5215dc0 /crawl-ref/source/abl-show.cc
parent3d14b002a1cf073450422eead92a4da28a53358f (diff)
downloadcrawl-ref-2772e5117bba390bc735af3dd9e0853f93a8306d.tar.gz
crawl-ref-2772e5117bba390bc735af3dd9e0853f93a8306d.zip
Fix permanent-MP abilities being usable when only temporary MP (e.g.
from a ring of magical power) is available. [2664906] This does not apply to HP costs because there's no way to abuse that. In theory it might still be possible to get negative real MP with the high/low magic mutations. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9347 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/abl-show.cc')
-rw-r--r--crawl-ref/source/abl-show.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 0c1ada0d03..2e5bbab3d5 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -988,7 +988,10 @@ static bool _activate_talent(const talent& tal)
const ability_def& abil = get_ability_def(tal.which);
// Check that we can afford to pay the costs.
- if (!enough_mp( abil.mp_cost, false ))
+ // Note that mutation shenanigans might leave us with negative MP,
+ // so don't fail in that case if there's no MP cost.
+ if (abil.mp_cost > 0
+ && !enough_mp(abil.mp_cost, false, !(abil.flags & ABFLAG_PERMANENT_MP)))
{
crawl_state.zero_turns_taken();
return (false);