summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mgrow.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-24 17:28:46 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-24 17:28:46 +0000
commit6df89800353b16e265eebf447d8b898469cd7bc8 (patch)
treefb20abdbf5b483a9a5f257b9dcdec7b03d338a08 /crawl-ref/source/mgrow.cc
parente63d0ce25374303ed7a08f0993eecb7d509b5eac (diff)
downloadcrawl-ref-6df89800353b16e265eebf447d8b898469cd7bc8.tar.gz
crawl-ref-6df89800353b16e265eebf447d8b898469cd7bc8.zip
Add priest promotion-re;ated fixes. Rename monsters::change_type() to
monsters::upgrade_type(), as it's more accurate, allow it to adjust HD as well as HP, and do the latter when promoting to a priest, to make sure that it ends up with the proper HD. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3860 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mgrow.cc')
-rw-r--r--crawl-ref/source/mgrow.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/crawl-ref/source/mgrow.cc b/crawl-ref/source/mgrow.cc
index 3d3a59185d..9a7f518dcb 100644
--- a/crawl-ref/source/mgrow.cc
+++ b/crawl-ref/source/mgrow.cc
@@ -98,7 +98,8 @@ static const monster_level_up *monster_level_up_target(
return (NULL);
}
-void monsters::change_type(monster_type after, bool adjust_hp)
+void monsters::upgrade_type(monster_type after, bool adjust_hd,
+ bool adjust_hp)
{
const monsterentry *orig = get_monster_data(type);
// Ta-da!
@@ -118,6 +119,13 @@ void monsters::change_type(monster_type after, bool adjust_hp)
ac += m->AC - orig->AC;
ev += m->ev - orig->ev;
+ if (adjust_hd)
+ {
+ const int minhd = dummy.hit_dice;
+ if (hit_dice < minhd)
+ hit_dice += minhd - hit_dice;
+ }
+
if (adjust_hp)
{
const int minhp = dummy.max_hit_points;
@@ -135,7 +143,7 @@ bool monsters::level_up_change()
if (const monster_level_up *lup =
monster_level_up_target(static_cast<monster_type>(type), hit_dice))
{
- change_type(lup->after, lup->adjust_hp);
+ upgrade_type(lup->after, false, lup->adjust_hp);
return (true);
}
return (false);