From 2772e5117bba390bc735af3dd9e0853f93a8306d Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 6 Mar 2009 14:35:34 +0000 Subject: 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 --- crawl-ref/source/abl-show.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/abl-show.cc') 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); -- cgit v1.2.3-54-g00ecf