summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/target.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-09-23 23:11:32 +0200
committerRaphael Langella <raphael.langella@gmail.com>2012-09-24 00:38:40 +0200
commit0824a09233b68e3b6e38e62765e2e486b7478514 (patch)
tree59c227d214c141ca01509095dac2ef8c1813d962 /crawl-ref/source/target.cc
parent07b43754a526a36cfb49bc4bdd99fa40b989a9f9 (diff)
downloadcrawl-ref-0824a09233b68e3b6e38e62765e2e486b7478514.tar.gz
crawl-ref-0824a09233b68e3b6e38e62765e2e486b7478514.zip
Only do handle_phase_attempted() once when cleaving.
It fixes a number of issues: * You get a single stop attack prompt for all targets * No more fumbling for each target * Hunger cost isn't multiplied by targets Still broken for ctrl+dir attacks.
Diffstat (limited to 'crawl-ref/source/target.cc')
-rw-r--r--crawl-ref/source/target.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/target.cc b/crawl-ref/source/target.cc
index 246fb7c942..15f0ee19ae 100644
--- a/crawl-ref/source/target.cc
+++ b/crawl-ref/source/target.cc
@@ -6,6 +6,7 @@
#include "coord.h"
#include "coordit.h"
#include "env.h"
+#include "fight.h"
#include "godabil.h"
#include "itemprop.h"
#include "libutil.h"
@@ -469,6 +470,25 @@ aff_type targetter_reach::is_affected(coord_def loc)
return AFF_NO;
}
+targetter_cleave::targetter_cleave(const actor* act, coord_def target)
+{
+ ASSERT(act);
+ agent = act;
+ origin = act->pos();
+ aim = target;
+ list<actor*> act_targets;
+ get_all_cleave_targets(act->pos(), target, act_targets);
+ while (!act_targets.empty())
+ {
+ targets.insert(act_targets.front()->pos());
+ act_targets.pop_front();
+ }
+}
+
+aff_type targetter_cleave::is_affected(coord_def loc)
+{
+ return targets.count(loc) ? AFF_YES : AFF_NO;
+}
targetter_cloud::targetter_cloud(const actor* act, int range,
int count_min, int count_max) :