summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;