summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-20 10:07:45 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-20 10:07:45 +0000
commit82abef2e72f839e3d3b75ec771cdfe8219761b20 (patch)
tree242d406f409e94f250fc2f3af1d60e9599dd7268 /crawl-ref/source/mon-util.cc
parentd7f1dd21aacab1548caf9315b035a5cedab29c5f (diff)
downloadcrawl-ref-82abef2e72f839e3d3b75ec771cdfe8219761b20.tar.gz
crawl-ref-82abef2e72f839e3d3b75ec771cdfe8219761b20.zip
Fix monsters capable of LOS attack behind glass walls being ignored.
Fix monsters behind glass walls being autotargetted for spells that need a path. Fix spacing in spl-data.h, and add some comments about commenting to coding_conventions.txt. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5148 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc39
1 files changed, 25 insertions, 14 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 0906dbd7e9..df192c7a9b 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2075,18 +2075,6 @@ bool mons_should_fire(struct bolt &beam)
100));
}
-// used to determine whether or not a monster should always
-// fire this spell if selected. If not, we should use a
-// tracer.
-
-// note - this function assumes that the monster is "nearby"
-// its target!
-
-bool ms_requires_tracer(spell_type monspell)
-{
- return (spell_needs_tracer(monspell));
-}
-
// returns true if the spell is something you wouldn't want done if
// you had a friendly target.. only returns a meaningful value for
// non-beam spells
@@ -2362,12 +2350,35 @@ bool mons_is_magic_user( const monsters *mon )
return (false);
}
+// Returns true if the monster has an ability that only needs LOS to
+// affect the target.
+bool mons_has_los_ability( int mclass )
+{
+ // These two have Torment, but are handled specially.
+ if (mclass == MONS_FIEND || mclass == MONS_PIT_FIEND)
+ return (true);
+
+ // These eyes only need LOS, as well. (The other eyes use spells.)
+ if (mclass == MONS_GIANT_EYEBALL || mclass == MONS_EYE_OF_DRAINING)
+ return (true);
+
+ // Although not using spells, these are exceedingly dangerous.
+ if (mclass == MONS_SILVER_STATUE || mclass == MONS_ORANGE_STATUE)
+ return (true);
+
+ // Beholding just needs LOS.
+ if (mclass == MONS_MERMAID)
+ return (true);
+
+ return (false);
+}
+
bool mons_has_ranged_spell( const monsters *mon )
{
const int mclass = mon->type;
- // These two have Torment, but are handled specially.
- if (mclass == MONS_FIEND || mclass == MONS_PIT_FIEND)
+ // Monsters may have spell like abilities.
+ if (mons_has_los_ability(mclass))
return (true);
if (mons_class_flag( mclass, M_SPELLCASTER ))