summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/teleport.cc
diff options
context:
space:
mode:
authorBrendan Hickey <brendan@bhickey.net>2012-11-17 09:54:47 -0800
committerAdam Borowski <kilobyte@angband.pl>2012-11-18 01:49:19 +0100
commitf42eaf392e9765c9eb890e05fa5f6d902062ea47 (patch)
treeb81cddb3f5a7eb90a4a62859f0d8df9bb5129adc /crawl-ref/source/teleport.cc
parentc09303161bb72cb5fe4a535ed348e09d6a648628 (diff)
downloadcrawl-ref-f42eaf392e9765c9eb890e05fa5f6d902062ea47.tar.gz
crawl-ref-f42eaf392e9765c9eb890e05fa5f6d902062ea47.zip
Disjunction
Level 8 translocation spell. Blinks away everything with diminishing probability with: P(~blink) = 0.8^(1/(dist+1)/(dist-1)) Over 10 ticks, a monster adjacent to the caster will blink with probability 0.9. Monsters may be blinked repeatedly.
Diffstat (limited to 'crawl-ref/source/teleport.cc')
-rw-r--r--crawl-ref/source/teleport.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc
index e38dc1c460..aa026b691b 100644
--- a/crawl-ref/source/teleport.cc
+++ b/crawl-ref/source/teleport.cc
@@ -155,13 +155,12 @@ void blink_other_close(actor* victim, const coord_def &target)
victim->blink_to(dest);
}
-// Blink the monster away from its foe.
-bool blink_away(monster* mon)
+// Blink a monster away from the caster.
+bool blink_away(monster* mon, actor* caster)
{
- actor* foe = mon->get_foe();
- if (!foe || !mon->can_see(foe))
+ if (!mon->can_see(caster))
return false;
- coord_def dest = random_space_weighted(mon, foe, false, false);
+ coord_def dest = random_space_weighted(mon, caster, false, false);
if (dest.origin())
return false;
bool success = mon->blink_to(dest);
@@ -169,6 +168,15 @@ bool blink_away(monster* mon)
return success;
}
+// Blink the monster away from its foe.
+bool blink_away(monster* mon)
+{
+ actor* foe = mon->get_foe();
+ if (!foe)
+ return false;
+ return blink_away(mon, foe);
+}
+
// Blink the monster within range but at distance to its foe.
void blink_range(monster* mon)
{