summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-14 17:24:08 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-14 17:26:43 +0100
commit6aad7a2a186bc80f8055013e1c667c57d105b91d (patch)
treee1ba086859e21948e59eeb5293621d13a58983a3 /crawl-ref/source
parent1cc856bac7e70027177e66450635e3829be0cb62 (diff)
downloadcrawl-ref-6aad7a2a186bc80f8055013e1c667c57d105b91d.tar.gz
crawl-ref-6aad7a2a186bc80f8055013e1c667c57d105b91d.zip
Implement spell "blink close".
This allows a monster to blink close to its target.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/mon-cast.cc2
-rw-r--r--crawl-ref/source/spl-data.h13
-rw-r--r--crawl-ref/source/teleport.cc13
-rw-r--r--crawl-ref/source/teleport.h1
4 files changed, 29 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 7616162696..798dba18fd 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1295,6 +1295,8 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
blink_range(monster);
else if (spell_cast == SPELL_BLINK_AWAY)
blink_away(monster);
+ else if (spell_cast == SPELL_BLINK_CLOSE)
+ blink_close(monster);
else
{
if (spell_needs_foe(spell_cast))
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index 0b5af3f977..819edeaeef 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -609,6 +609,19 @@
false
},
+{
+ SPELL_BLINK_CLOSE, "Blink Close",
+ SPTYP_TRANSLOCATION,
+ SPFLAG_MONSTER,
+ 2,
+ 0,
+ -1, -1,
+ 0,
+ NULL,
+ false,
+ false
+},
+
// The following name was found in the hack.exe file of an early version
// of PCHACK - credit goes to its creator (whoever that may be):
{
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc
index ef9cf3a025..8b96ed6b35 100644
--- a/crawl-ref/source/teleport.cc
+++ b/crawl-ref/source/teleport.cc
@@ -140,6 +140,19 @@ void blink_range(monsters* mon)
ASSERT(success);
}
+// Blink the monster close to its foe.
+void blink_close(monsters* mon)
+{
+ actor* foe = mon->get_foe();
+ if (!foe || !mon->can_see(foe))
+ return;
+ coord_def dest = random_space_weighted(mon, foe, true);
+ if (dest.origin())
+ return;
+ bool success = mon->blink_to(dest);
+ ASSERT(success);
+}
+
bool random_near_space(const coord_def& origin, coord_def& target,
bool allow_adjacent, bool restrict_los,
bool forbid_dangerous, bool forbid_sanctuary)
diff --git a/crawl-ref/source/teleport.h b/crawl-ref/source/teleport.h
index 9d87b93301..e54a437bc6 100644
--- a/crawl-ref/source/teleport.h
+++ b/crawl-ref/source/teleport.h
@@ -7,6 +7,7 @@ class monsters;
void blink_other_close(actor* victim, const coord_def& target);
void blink_away(monsters* mon);
void blink_range(monsters* mon);
+void blink_close(monsters* mon);
bool random_near_space(const coord_def& origin, coord_def& target,
bool allow_adjacent = false, bool restrict_LOS = true,