diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 23:00:11 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-27 23:00:11 +1000 |
commit | d1b7b6522f3fd5ee07df0445cf32f0bc01989d9a (patch) | |
tree | ecc2af6f84b88c5104a200e236a9f2a0ad009188 /crawl-ref/source/mon-place.cc | |
parent | b5068662183d41698414e728f64579bf3544cbaa (diff) | |
download | crawl-ref-d1b7b6522f3fd5ee07df0445cf32f0bc01989d9a.tar.gz crawl-ref-d1b7b6522f3fd5ee07df0445cf32f0bc01989d9a.zip |
Re-roll random HP after adjusting HD in monster specs.
Diffstat (limited to 'crawl-ref/source/mon-place.cc')
-rw-r--r-- | crawl-ref/source/mon-place.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index 749489cf30..718223fa6c 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -1036,6 +1036,8 @@ static int _place_monster_aux(const mgen_data &mg, { coord_def fpos; + const monsterentry *m_ent = get_monster_data(mg.cls); + monsters* mon = get_free_monster(); if (!mon) return (-1); @@ -1155,7 +1157,17 @@ static int _place_monster_aux(const mgen_data &mg, mon->mname = mg.mname; if (mg.hd != 0) + { mon->hit_dice = mg.hd; + // Re-roll HP. + int hp = hit_points(mg.hd, m_ent->hpdice[1], m_ent->hpdice[2]); + // But only for monsters with random HP. + if (hp > 0) + { + mon->max_hit_points = hp; + mon->hit_points = hp; + } + } if (mg.hp != 0) { |