diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-06 20:14:35 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-06 20:14:35 +0000 |
commit | 44d7fbb36c55859117824fe25a298afbe437221b (patch) | |
tree | 8854c7d492879cb8ddda79ca91f44d964c5828a9 /crawl-ref/source/player.cc | |
parent | b847d4bad842066f8721cf68650d5087528e8486 (diff) | |
download | crawl-ref-44d7fbb36c55859117824fe25a298afbe437221b.tar.gz crawl-ref-44d7fbb36c55859117824fe25a298afbe437221b.zip |
Fix 1870427: Max hp misreported if frail and rotted.
Fix 2002931: feature_item_brand not working
No, it's not the important bugs, but at least these are bugs I can
reproduce. :P
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6433 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 4ded8c08f8..252bbe152c 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4876,6 +4876,55 @@ void set_mp(int new_amount, bool max_too) you.redraw_magic_points = true; } +// If trans is true, being berserk and/or transformed is taken into account +// here. Else, the base hp is calculated. If rotted is true, calculate the +// real max hp you'd have if the rotting was cured. +int get_real_hp(bool trans, bool rotted) +{ + int hitp; + + hitp = (you.base_hp - 5000) + (you.base_hp2 - 5000); + hitp += (you.experience_level * you.skills[SK_FIGHTING]) / 5; + + // Being berserk makes you resistant to damage. I don't know why. + if (trans && you.duration[DUR_BERSERKER]) + { + hitp *= 15; + hitp /= 10; + } + + if (trans) + { + // Some transformations give you extra hp. + switch (you.attribute[ATTR_TRANSFORMATION]) + { + case TRAN_STATUE: + hitp *= 15; + hitp /= 10; + break; + case TRAN_ICE_BEAST: + hitp *= 12; + hitp /= 10; + break; + case TRAN_DRAGON: + hitp *= 16; + hitp /= 10; + break; + } + } + + if (rotted) + hitp += player_rotted(); + + // Frail and robust mutations, and divine robustness. + hitp *= (10 + player_mutation_level(MUT_ROBUST) + + you.attribute[ATTR_DIVINE_ROBUSTNESS] + - player_mutation_level(MUT_FRAIL)); + hitp /= 10; + + return (hitp); +} + static int _get_contamination_level() { const int glow = you.magic_contamination; |