summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/halo.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-08 10:01:11 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-08 10:02:38 +0100
commit6a883aea39bceefb34718c699ee3877d33b6d2ba (patch)
tree7dfc750f9da300c069643661ec329b969515c897 /crawl-ref/source/halo.cc
parent14710e6fd41d63a20a68342b6604d48de3a6b621 (diff)
downloadcrawl-ref-6a883aea39bceefb34718c699ee3877d33b6d2ba.tar.gz
crawl-ref-6a883aea39bceefb34718c699ee3877d33b6d2ba.zip
Add a general halo interface to actor.
Also convert the TSO halo to use this. actor::haloed() is still specific to the player TSO halo.
Diffstat (limited to 'crawl-ref/source/halo.cc')
-rw-r--r--crawl-ref/source/halo.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/crawl-ref/source/halo.cc b/crawl-ref/source/halo.cc
new file mode 100644
index 0000000000..555df0048b
--- /dev/null
+++ b/crawl-ref/source/halo.cc
@@ -0,0 +1,34 @@
+#include "AppHdr.h"
+
+#include "actor.h"
+#include "player.h"
+#include "monster.h"
+#include "religion.h"
+
+// TODO: generalize.
+bool actor::haloed() const
+{
+ return (you.inside_halo(pos()));
+}
+
+bool actor::inside_halo(const coord_def &c) const
+{
+ int r = halo_radius();
+ return ((c - pos()).abs() <= r * r && see_cell(c));
+}
+
+int player::halo_radius() const
+{
+ if (you.religion == GOD_SHINING_ONE && you.piety >= piety_breakpoint(0)
+ && !you.penance[GOD_SHINING_ONE])
+ {
+ return std::min(LOS_RADIUS, you.piety / 20);
+ }
+
+ return 0;
+}
+
+int monsters::halo_radius() const
+{
+ return 0;
+}