summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-27 22:44:12 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-27 22:44:12 +1000
commitb5068662183d41698414e728f64579bf3544cbaa (patch)
tree563664592e63eac18637cf5aab8c4d7426a76b93
parent1f6a372b1d013ce9068bee8c175fb7c11c28de5e (diff)
downloadcrawl-ref-b5068662183d41698414e728f64579bf3544cbaa.tar.gz
crawl-ref-b5068662183d41698414e728f64579bf3544cbaa.zip
New tags for monster specs: "hd" and "hp". (kilobyte)
Both values override the default class values. Placing "rat hd:20" will generate a rat with a hit dice of 20, while placing "rat hp:20" will set its hp to 20.
-rw-r--r--crawl-ref/source/dungeon.cc2
-rw-r--r--crawl-ref/source/mapdef.cc8
-rw-r--r--crawl-ref/source/mapdef.h6
-rw-r--r--crawl-ref/source/mon-place.cc9
-rw-r--r--crawl-ref/source/mon-place.h9
5 files changed, 30 insertions, 4 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index bd22e31abe..abdee2f3b3 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4926,6 +4926,8 @@ int dgn_place_monster(mons_spec &mspec,
mg.number = mspec.number;
mg.colour = mspec.colour;
mg.mname = mspec.monname;
+ mg.hd = mspec.hd;
+ mg.hp = mspec.hp;
// XXX: hack.
if (mg.colour == -1)
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 93310d481c..407eaf9a6f 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2575,6 +2575,14 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
if (mspec.mlevel == TAG_UNFOUND)
mspec.mlevel = 0;
+ mspec.hd = strip_number_tag(mon_str, "hd:");
+ if (mspec.hd == TAG_UNFOUND)
+ mspec.hd = 0;
+
+ mspec.hp = strip_number_tag(mon_str, "hp:");
+ if (mspec.hp == TAG_UNFOUND)
+ mspec.hp = 0;
+
std::string colour = strip_tag_prefix(mon_str, "col:");
if (!colour.empty())
{
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index aa407a669f..8c3df25039 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -472,6 +472,8 @@ class mons_spec
bool patrolling;
bool band;
int colour;
+ int hd;
+ int hp;
item_list items;
std::string monname;
@@ -488,8 +490,8 @@ class mons_spec
: mid(id), place(), monbase(base), attitude(ATT_HOSTILE), number(num),
quantity(1), genweight(gw), mlevel(ml), fix_mons(_fixmons),
generate_awake(awaken), patrolling(false), band(false),
- colour(BLACK), items(), monname(""), explicit_spells(false),
- spells(), extra_monster_flags(0L)
+ colour(BLACK), hd(0), hp(0), items(), monname(""),
+ explicit_spells(false), spells(), extra_monster_flags(0L)
{
}
};
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index dbfad61e5c..749489cf30 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -1154,6 +1154,15 @@ static int _place_monster_aux(const mgen_data &mg,
if (mg.mname != "")
mon->mname = mg.mname;
+ if (mg.hd != 0)
+ mon->hit_dice = mg.hd;
+
+ if (mg.hp != 0)
+ {
+ mon->max_hit_points = mg.hp;
+ mon->hit_points = mg.hp;
+ }
+
// The return of Boris is now handled in monster_die(). Not setting
// this for Boris here allows for multiple Borises in the dungeon at
// the same time. - bwr
diff --git a/crawl-ref/source/mon-place.h b/crawl-ref/source/mon-place.h
index bea1c0f988..24d4765ac4 100644
--- a/crawl-ref/source/mon-place.h
+++ b/crawl-ref/source/mon-place.h
@@ -191,6 +191,10 @@ struct mgen_data
// be available (vault metadata is not preserved across game saves).
unsigned map_mask;
+ // XXX: Also rather hackish.
+ int hd;
+ int hp;
+
// XXX: Rather hackish.
std::string mname;
@@ -213,6 +217,7 @@ struct mgen_data
int monpower = you.your_level,
proximity_type prox = PROX_ANYWHERE,
level_area_type ltype = you.level_type,
+ int mhd = 0, int mhp = 0,
std::string monname = "",
std::string nas = "")
@@ -220,7 +225,7 @@ struct mgen_data
abjuration_duration(abj), summon_type(st), pos(p), foe(mfoe),
flags(monflags), god(which_god), number(monnumber), colour(moncolour),
power(monpower), proximity(prox), level_type(ltype), map_mask(0),
- mname(monname), non_actor_summoner(nas)
+ hd(mhd), hp(mhp), mname(monname), non_actor_summoner(nas)
{
ASSERT(summon_type == 0 || (abj >= 1 && abj <= 6)
|| mt == MONS_BALL_LIGHTNING);
@@ -257,7 +262,7 @@ struct mgen_data
return mgen_data(mt, BEH_HOSTILE, 0, abj, st, p,
alert ? MHITYOU : MHITNOT,
monflags, god, base, 0, BLACK, you.your_level,
- PROX_ANYWHERE, you.level_type, "", summoner);
+ PROX_ANYWHERE, you.level_type, 0, 0, "", summoner);
}
};