summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/skills2.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/skills2.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/skills2.cc')
-rw-r--r--crawl-ref/source/skills2.cc63
1 files changed, 8 insertions, 55 deletions
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index aacb6c817a..dc2fa7680e 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -2108,65 +2108,18 @@ void init_skill_order( void )
}
}
-int calc_hp(bool real_hp)
+void calc_hp()
{
- int hitp = get_real_hp(!real_hp, false);
-
- you.hp_max = hitp;
-
- deflate_hp( you.hp_max, false );
-
- return (hitp);
-} // end calc_hp()
+ you.hp_max = get_real_hp(true, false);
+ deflate_hp(you.hp_max, false);
+}
-int calc_mp(bool real_mp)
+void calc_mp()
{
- int enp;
-
- // base_magic_points2 accounts for species and magic potions
- enp = (you.base_magic_points2 - 5000);
-
- int spell_extra = (you.experience_level * you.skills[SK_SPELLCASTING]) / 4;
- int invoc_extra = (you.experience_level * you.skills[SK_INVOCATIONS]) / 6;
-
- if (spell_extra > invoc_extra)
- enp += spell_extra;
- else
- enp += invoc_extra;
-
- you.max_magic_points = stepdown_value( enp, 9, 18, 45, 100 );
-
- // this is our "rotted" base (applied after scaling):
- you.max_magic_points += (you.base_magic_points - 5000);
-
- // Yes, we really do want this duplication... this is so the stepdown
- // doesn't truncate before we apply the rotted base. We're doing this
- // the nice way. -- bwr
- if (you.max_magic_points > 50)
- you.max_magic_points = 50;
-
- // now applied after scaling so that power items are more useful -- bwr
- if (!real_mp)
- you.max_magic_points += player_magical_power();
-
- // analogous to ROBUST/FRAIL
- you.max_magic_points *= (10 + player_mutation_level(MUT_HIGH_MAGIC)
- - player_mutation_level(MUT_LOW_MAGIC));
- you.max_magic_points /= 10;
-
- if (you.max_magic_points > 50)
- you.max_magic_points = 50 + ((you.max_magic_points - 50) / 2);
-
- if (you.max_magic_points < 0)
- you.max_magic_points = 0;
-
- if (you.magic_points > you.max_magic_points)
- you.magic_points = you.max_magic_points;
-
+ you.max_magic_points = get_real_mp(true);
+ you.magic_points = std::min(you.magic_points, you.max_magic_points);
you.redraw_magic_points = true;
-
- return (you.max_magic_points);
-} // end calc_mp()
+}
unsigned int skill_exp_needed(int lev)
{