diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-31 08:41:27 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-12-31 08:41:27 +0000 |
commit | 86d488e3efa0b1d8ec12223527235e3ef3a5fec2 (patch) | |
tree | 88b3d97a6f74ea6eb21405b3072e1e1a9c6830b0 /crawl-ref/source/mapdef.cc | |
parent | 496a1b4c58651aa28878db51bb1d5f3534d8a0a5 (diff) | |
download | crawl-ref-86d488e3efa0b1d8ec12223527235e3ef3a5fec2.tar.gz crawl-ref-86d488e3efa0b1d8ec12223527235e3ef3a5fec2.zip |
Add arena mode, activated on the command-line by 'crawl -arena "monster v monster"' (eg: crawl -arena "Sigmund v Jessica") to let monsters fight each other undisturbed by the player. Good to examine monster AI and monster behaviour when the player is AWOL.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8059 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r-- | crawl-ref/source/mapdef.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index af02c2b429..f9b0c14001 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -2090,6 +2090,22 @@ 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"); + if (!mon_str.empty() && isdigit(mon_str[0])) + { + // Look for space after initial digits. + std::string::size_type pos = + mon_str.find_first_not_of("0123456789"); + if (pos != std::string::npos && mon_str[pos] == ' ') + { + const std::string mcount = mon_str.substr(0, pos); + const int count = atoi(mcount.c_str()); + if (count >= 1 && count <= 99) + mspec.quantity = count; + + mon_str = mon_str.substr(pos); + } + } + // place:Elf:7 to choose monsters appropriate for that level, // for example. const std::string place = strip_tag_prefix(mon_str, "place:"); @@ -2179,8 +2195,9 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) } else if (mons_class_itemuse(mid) < MONUSE_STARTING_EQUIPMENT) { - error = make_stringf("Monster '%s' can't use items.", - mon_str.c_str()); + if (mid != MONS_DANCING_WEAPON || mspec.items.size() > 1) + error = make_stringf("Monster '%s' can't use items.", + mon_str.c_str()); } } |