diff options
author | Brendan Hickey <brendan@bhickey.net> | 2012-11-17 09:54:47 -0800 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-11-18 01:49:19 +0100 |
commit | f42eaf392e9765c9eb890e05fa5f6d902062ea47 (patch) | |
tree | b81cddb3f5a7eb90a4a62859f0d8df9bb5129adc /crawl-ref/source/colour.cc | |
parent | c09303161bb72cb5fe4a535ed348e09d6a648628 (diff) | |
download | crawl-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/colour.cc')
-rw-r--r-- | crawl-ref/source/colour.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/colour.cc b/crawl-ref/source/colour.cc index 7d6e2c14e2..1d57158553 100644 --- a/crawl-ref/source/colour.cc +++ b/crawl-ref/source/colour.cc @@ -166,6 +166,38 @@ static int _etc_waves(int, const coord_def& loc) return CYAN; } +static int _etc_disjunction(int, const coord_def& loc) +{ + static int turns = you.num_turns; + static coord_def centre = find_centre_for(loc, AREA_DISJUNCTION); + + if (turns != you.num_turns || (centre-loc).abs() > 15) + { + centre = find_centre_for(loc, AREA_DISJUNCTION); + turns = you.num_turns; + } + + if (centre.origin()) + return MAGENTA; + + int x = loc.x - centre.x; + int y = loc.y - centre.y; + double dist = sqrt(x*x + y*y); + int parity = ((int) (dist / PI) + you.frame_no / 11) % 2 ? 1 : -1; + double dir = sin(atan2(x, y)*PI + parity * you.frame_no / 3) + 1; + switch ((int) floor(dir * 2)) + { + case 0: + return LIGHTBLUE; + case 1: + return BLUE; + case 2: + return MAGENTA; + default: + return LIGHTMAGENTA; + } +} + static int _etc_liquefied(int, const coord_def& loc) { static int turns = you.num_turns; @@ -565,6 +597,9 @@ void init_element_colours() ETC_ORB_GLOW, "orb_glow", _etc_orb_glow )); add_element_colour(new element_colour_calc( + ETC_DISJUNCTION, "disjunction", _etc_disjunction + )); + add_element_colour(new element_colour_calc( ETC_RANDOM, "random", _etc_random )); // redefined by Lua later |