summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-12-12 22:09:05 +0100
committerAdam Borowski <kilobyte@angband.pl>2009-12-12 22:17:35 +0100
commitbcd6d56029d217a00de9ae0830382cba307539d4 (patch)
tree43a5dcb83fc16c15c05ed6caefe6dbc6b05fad69 /crawl-ref
parent19ed4e0af0b2fdee6b02e043626b9919daa4d1b0 (diff)
downloadcrawl-ref-bcd6d56029d217a00de9ae0830382cba307539d4.tar.gz
crawl-ref-bcd6d56029d217a00de9ae0830382cba307539d4.zip
Allow setting monster's friendliness with att:XXX.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/develop/levels/syntax.txt8
-rw-r--r--crawl-ref/source/mapdef.cc12
2 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/docs/develop/levels/syntax.txt b/crawl-ref/docs/develop/levels/syntax.txt
index 642e7f5564..4f3c3062a2 100644
--- a/crawl-ref/docs/develop/levels/syntax.txt
+++ b/crawl-ref/docs/develop/levels/syntax.txt
@@ -567,6 +567,14 @@ MONS: (list of monsters)
can be useful for customised vault monsters if an alternate tile
exists. In ASCII mode, this will do nothing.
+ You can set the monster's faction by specifying "att:" one of:
+ * att:hostile -- the default
+ * att:friendly -- tame, will follow you
+ * att:neutral -- hostile to both you and att:hostile monsters
+ * att:good_neutral -- won't actively follow anyone, can still hit
+ people (including you) when they randomly wander into them
+ * att:fellow_slime -- as att:friendly but won't follow you
+
Note that 8, 9, 0 also place monsters (see the table).
If you want to place a random monster suitable for the level
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 76dc38c452..6ef5088e02 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -3052,6 +3052,18 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
mspec.patrolling = strip_tag(mon_str, "patrolling");
mspec.band = strip_tag(mon_str, "band");
+ const std::string att = strip_tag_prefix(mon_str, "att:");
+ if (att.empty() || att == "hostile")
+ mspec.attitude = ATT_HOSTILE;
+ else if (att == "friendly")
+ mspec.attitude = ATT_FRIENDLY;
+ else if (att == "good_neutral")
+ mspec.attitude = ATT_GOOD_NEUTRAL;
+ else if (att == "fellow_slime" || att == "strict_neutral")
+ mspec.attitude = ATT_STRICT_NEUTRAL;
+ else if (att == "neutral")
+ mspec.attitude = ATT_NEUTRAL;
+
// Useful for summoned monsters.
if (strip_tag(mon_str, "seen"))
mspec.extra_monster_flags |= MF_SEEN;