diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-02 20:36:51 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-02 20:36:51 +0000 |
commit | 78edf358eefc57dbe3f7bcd257cbf6b9d319149a (patch) | |
tree | 3579a9ce46b2cb7525c914079a05246c19dbdae8 /crawl-ref/source/arena.cc | |
parent | 17125f250661e8430e320f4c05d74094235f0cf3 (diff) | |
download | crawl-ref-78edf358eefc57dbe3f7bcd257cbf6b9d319149a.tar.gz crawl-ref-78edf358eefc57dbe3f7bcd257cbf6b9d319149a.zip |
Make monster behaviour in arenas smarter, allow delay:N in arena spec to set arena_delay.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8129 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/arena.cc')
-rw-r--r-- | crawl-ref/source/arena.cc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index fdd0cc40e9..aefd29729d 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -52,6 +52,8 @@ namespace arena std::string arena_type = ""; faction faction_a(true); faction faction_b(false); + coord_def place_a, place_b; + FILE *file = NULL; int message_pos = 0; level_id place; @@ -75,6 +77,17 @@ namespace arena } } } + + for (int i = 0; i < MAX_MONSTERS; i++) + { + monsters *mon = &menv[i]; + if (!mon->alive()) + continue; + + const bool friendly = mons_friendly(mon); + // Set target to the opposite faction's home base. + mon->target = friendly ? place_b : place_a; + } } void alert_faction(bool friendly) @@ -264,6 +277,10 @@ namespace arena if (arena_type.empty()) arena_type = "default"; + const int arena_delay = strip_number_tag(spec, "delay:"); + if (arena_delay >= 0 && arena_delay < 2000) + Options.arena_delay = arena_delay; + std::string arena_place = strip_tag_prefix(spec, "arena_place:"); if (!arena_place.empty()) { @@ -313,8 +330,8 @@ namespace arena unwind_var< FixedVector<bool, NUM_MONSTERS> > uniq(you.unique_creatures); - coord_def place_a(dgn_find_feature_marker(DNGN_STONE_STAIRS_UP_I)); - coord_def place_b(dgn_find_feature_marker(DNGN_STONE_STAIRS_DOWN_I)); + place_a = dgn_find_feature_marker(DNGN_STONE_STAIRS_UP_I); + place_b = dgn_find_feature_marker(DNGN_STONE_STAIRS_DOWN_I); faction_a.place_at(place_a); faction_b.place_at(place_b); adjust_monsters(); @@ -515,8 +532,15 @@ namespace arena cursor_control coff(false); while (fight_is_on()) { - if (kbhit() && getch() == ESCAPE) - end(0, false, "Canceled contest at user request"); + if (kbhit()) + { + const int ch = getch(); + if (ch == ESCAPE || tolower(ch) == 'q' || + ch == CONTROL('G')) + { + end(0, false, "Canceled contest at user request"); + } + } viewwindow(true, false); unwind_var<coord_def> pos(you.position); |