summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-act.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-13 15:38:23 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-13 17:19:02 -0700
commitd22ebac678fa1c1d0a60048a72ba445e3ed190d1 (patch)
treea63ccd59b4bb01408be9fc5843c20f2f878e2cd2 /crawl-ref/source/mon-act.cc
parent5562ea36cc1ba917da155a9dd93e6bf71d022771 (diff)
downloadcrawl-ref-d22ebac678fa1c1d0a60048a72ba445e3ed190d1.tar.gz
crawl-ref-d22ebac678fa1c1d0a60048a72ba445e3ed190d1.zip
Separate 'permanent' and 'temporary' monster hit dice
As part of a wider scheme to make draining temporary.
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r--crawl-ref/source/mon-act.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 0738645d39..949493ee6d 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -79,6 +79,29 @@ static spell_type _map_wand_to_mspell(wand_type kind);
// [dshaligram] Doesn't need to be extern.
static coord_def mmov;
+/**
+ * Get the monster's "hit dice".
+ *
+ * @return The monster's HD.
+ */
+int monster::get_hit_dice() const
+{
+ const int base_hd = get_experience_level();
+ //TODO: add the ench!
+ return base_hd;
+}
+
+/**
+ * Get the monster's "experience level" - their hit dice, unmodified by
+ * temporary enchantments (draining).
+ *
+ * @return The monster's XL.
+ */
+int monster::get_experience_level() const
+{
+ return hit_dice;
+}
+
static const coord_def mon_compass[8] =
{
coord_def(-1,-1), coord_def(0,-1), coord_def(1,-1), coord_def(1,0),
@@ -1098,7 +1121,7 @@ static bool _setup_wand_beam(bolt& beem, monster* mons)
return false;
// set up the beam
- int power = 30 + mons->hit_dice;
+ int power = 30 + mons->get_hit_dice();
bolt theBeam = mons_spell_beam(mons, mzap, power);
beem = _generate_item_beem(beem, theBeam, mons);
@@ -2727,7 +2750,7 @@ static bool _jelly_divide(monster* parent)
if (!mons_class_flag(parent->type, M_SPLITS))
return false;
- const int reqd = max(parent->hit_dice * 8, 50);
+ const int reqd = max(parent->get_experience_level() * 8, 50);
if (parent->hit_points < reqd)
return false;