From 934725f25eae11ced143d86d271ef43d7da83470 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 13 Nov 2009 15:28:11 +0100 Subject: Remove arena AI forcing option. It's not strictly necessary anymore to have sensible fights with recent AI changes, and could easily be restored if required. Better to improve non-arena AI, however. --- crawl-ref/source/arena.cc | 3 -- crawl-ref/source/initfile.cc | 4 -- crawl-ref/source/mon-act.cc | 24 ---------- crawl-ref/source/mon-behv.cc | 103 ++----------------------------------------- crawl-ref/source/options.h | 1 - 5 files changed, 3 insertions(+), 132 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index 31512cd621..68170804ab 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -296,9 +296,6 @@ namespace arena { std::string spec = find_monster_spec(); - Options.arena_force_ai = - strip_bool_tag(spec, "force_ai", Options.arena_force_ai); - allow_chain_summons = !strip_tag(spec, "no_chain_summons"); allow_summons = !strip_tag(spec, "no_summons"); diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 41cc6dcca0..0c423a8ab4 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -701,10 +701,6 @@ void game_options::reset_options() arena_dump_msgs_all = false; arena_list_eq = false; - // If true, monsters are forced to target each other in arena - // mode, even when outside LOS of each other. - arena_force_ai = true; - // Sort only pickup menus by default. sort_menus.clear(); set_menu_sort("pickup: true"); diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 4a7b798619..54bf8c2afe 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -372,32 +372,8 @@ static void _handle_movement(monsters *monster) delta = you.pos() - monster->pos(); } else - { delta = monster->target - monster->pos(); - if (crawl_state.arena && Options.arena_force_ai - && !mons_is_stationary(monster)) - { - const bool ranged = (mons_has_ranged_attack(monster) - || mons_has_ranged_spell(monster)); - - // Smiters are happy if they have clear visibility through - // glass, but other monsters must go around. - const bool glass_ok = mons_has_smite_attack(monster); - - // Monsters in the arena are smarter than the norm and - // always pathfind to their targets. - if (delta.abs() > 2 - && (!ranged - || !monster->mon_see_cell(monster->target, !glass_ok))) - { - monster_pathfind mp; - if (mp.init_pathfind(monster, monster->target)) - delta = mp.next_pos(monster->pos()) - monster->pos(); - } - } - } - // Move the monster. mmov.x = (delta.x > 0) ? 1 : ((delta.x < 0) ? -1 : 0); mmov.y = (delta.y > 0) ? 1 : ((delta.y < 0) ? -1 : 0); diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index df5647d123..6868d90386 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -906,91 +906,6 @@ static void _check_wander_target(monsters *mon, bool isPacified = false, } } -static void _arena_set_foe(monsters *mons) -{ - const int mind = mons->mindex(); - - int nearest = -1; - int best_distance = -1; - - int nearest_unseen = -1; - int best_unseen_distance = -1; - for (monster_iterator other; other; ++other) - { - int i = other->mindex(); - if (mind == i) - continue; - - if (mons_aligned(mind, i)) - continue; - - // Don't fight test spawners, since they're only pseudo-monsters - // placed to spawn real monsters, plus they're impossible to - // kill. But test spawners can fight each other, to give them a - // target to spawn against. - if (other->type == MONS_TEST_SPAWNER - && mons->type != MONS_TEST_SPAWNER) - { - continue; - } - - const int distance = grid_distance(mons->pos(), other->pos()); - const bool seen = mons->can_see(*other); - - if (seen) - { - if (best_distance == -1 || distance < best_distance) - { - best_distance = distance; - nearest = i; - } - } - else - { - if (best_unseen_distance == -1 || distance < best_unseen_distance) - { - best_unseen_distance = distance; - nearest_unseen = i; - } - } - - if ((best_distance == -1 || distance < best_distance) - && mons->can_see(*other)) - - { - best_distance = distance; - nearest = i; - } - } - - if (nearest != -1) - { - mons->foe = nearest; - mons->target = menv[nearest].pos(); - mons->behaviour = BEH_SEEK; - } - else if (nearest_unseen != -1) - { - mons->target = menv[nearest_unseen].pos(); - if (mons->type == MONS_TEST_SPAWNER) - { - mons->foe = nearest_unseen; - mons->behaviour = BEH_SEEK; - } - else - mons->behaviour = BEH_WANDER; - } - else - { - mons->foe = MHITNOT; - mons->behaviour = BEH_WANDER; - } - if (mons->behaviour == BEH_WANDER) - _check_wander_target(mons); - - ASSERT(mons->foe == MHITNOT || !mons->target.origin()); -} - static void _find_all_level_exits(std::vector &e) { e.clear(); @@ -1125,21 +1040,9 @@ void handle_behaviour(monsters *mon) return; } - if (crawl_state.arena) - { - if (Options.arena_force_ai) - { - if (!mon->get_foe() || mon->target.origin() || one_chance_in(3)) - mon->foe = MHITNOT; - if (mon->foe == MHITNOT || mon->foe == MHITYOU) - _arena_set_foe(mon); - return; - } - // If we're not forcing monsters to attack, just make sure they're - // not targetting the player in arena mode. - else if (mon->foe == MHITYOU) - mon->foe = MHITNOT; - } + // Make sure monsters are not targetting the player in arena mode. + if (crawl_state.arena && mon->foe == MHITYOU) + mon->foe = MHITNOT; if (mons_wall_shielded(mon) && cell_is_solid(mon->pos())) { diff --git a/crawl-ref/source/options.h b/crawl-ref/source/options.h index 612a45816a..3abd9bc1e6 100644 --- a/crawl-ref/source/options.h +++ b/crawl-ref/source/options.h @@ -198,7 +198,6 @@ public: bool arena_dump_msgs; bool arena_dump_msgs_all; bool arena_list_eq; - bool arena_force_ai; // Messages that stop travel std::vector travel_stop_message; -- cgit v1.2.3-54-g00ecf