summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorelliptic <hyperelliptical@gmail.com>2014-05-07 13:17:55 -0400
committerelliptic <hyperelliptical@gmail.com>2014-05-07 13:17:55 -0400
commit167b67a7dc8d7dafb67f5636fe167065640b028d (patch)
tree6c2e2eb5e81f52c27bfd864a9db925ff31afed4b /crawl-ref/source/fight.cc
parent0591e77993c0ef35acc4543c25bdee3d4fbf685d (diff)
downloadcrawl-ref-167b67a7dc8d7dafb67f5636fe167065640b028d.tar.gz
crawl-ref-167b67a7dc8d7dafb67f5636fe167065640b028d.zip
Remove more instances where directing a cleave at empty space is optimal.
c876910 made some progress towards this, but left situations like o@o oo. where the player must attack the empty space in order to be guaranteed to hit all the monsters. Now attacking any direction will hit all the monsters in this situation. This is implemented by making the cleave targetter try to go more than 3-4 squares around in each direction if the attacker is next to at least one wall. Walls still stop cleaving as normal, so in the situation O@o the player has to choose whether to hit the ogre or the five orcs, as before.
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 53a911d78a..c677cfd9ba 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -633,7 +633,17 @@ void get_cleave_targets(const actor* attacker, const coord_def& def, int dir,
const coord_def atk = attacker->pos();
coord_def atk_vector = def - atk;
- const int num = behind ? 4 : 3;
+ int num = behind ? 4 : 3;
+ // Let the cleave try to go farther around if we are sure that this
+ // won't overlap with going in the other direction.
+ for (adjacent_iterator ai(atk); ai; ++ai)
+ {
+ if (cell_is_solid(*ai))
+ {
+ num = 7;
+ break;
+ }
+ }
for (int i = 0; i < num; ++i)
{