diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 08:27:35 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 08:27:35 +0000 |
commit | a915659e84b798acb94dc06b4a3c2b61d7484316 (patch) | |
tree | 4886069311c263410fc866b6a3d3586e85e078eb /crawl-ref/source/spells3.cc | |
parent | 04b39d34b1eaffd6223743966efab334caf08e8c (diff) | |
download | crawl-ref-a915659e84b798acb94dc06b4a3c2b61d7484316.tar.gz crawl-ref-a915659e84b798acb94dc06b4a3c2b61d7484316.zip |
Multiple sanctuary fixes:
* Set sanctuary floor property before checking if monster will flee.
* Make mimics teleport away, since they can't move.
* Don't count as fleeing monsters which can't flee, like plants.
* Don't tell the player about unseen fleeing monsters.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6213 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r-- | crawl-ref/source/spells3.cc | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index bc1a5c8a5f..edc387f6e2 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1688,24 +1688,6 @@ bool cast_sanctuary(const int power) int posy = you.y_pos + y; int dist = _inside_circle(posx, posy, radius); - // scare all attacking monsters inside sanctuary - if (dist != -1) - { - monster = mgrd[posx][posy]; - - if (monster != NON_MONSTER) - { - mon = &menv[monster]; - - if (!mons_wont_attack(mon) - && mon->add_ench(mon_enchant(ENCH_FEAR, 0, KC_YOU))) - { - behaviour_event(mon, ME_SCARE, MHITYOU); - count++; - } - } - } - // forming patterns if (pattern == 0 // outward rays && (x == 0 || y == 0 || x == y || x == -y) @@ -1713,7 +1695,7 @@ bool cast_sanctuary(const int power) && (dist >= (radius-1)*(radius-1) && dist <= radius*radius || dist >= (radius/2-1)*(radius/2-1) && dist <= radius*radius/4) - || pattern == 2 // latticed + || pattern == 2 // latticed && (x%2 == 0 || y%2 == 0) || pattern == 3 // cross-like && (abs(x)+abs(y) < 5 && x != y && x != -y)) @@ -1722,7 +1704,38 @@ bool cast_sanctuary(const int power) } else env.map[posx][posy].property = FPROP_SANCTUARY_2; // white - } + + // scare all attacking monsters inside sanctuary + if (dist != -1) + { + monster = mgrd[posx][posy]; + + if (monster != NON_MONSTER) + { + mon = &menv[monster]; + + if (!mons_wont_attack(mon)) + { + if (mons_is_mimic(mon->type)) + { + mimic_alert(mon); + if(you.can_see(mon)) + count++; + } + else if (mon->add_ench(mon_enchant(ENCH_FEAR, 0, + KC_YOU))) + { + behaviour_event(mon, ME_SCARE, MHITYOU); + + // Check to see that monster is actually fleeing, + // since plants can't flee. + if (mons_is_fleeing(mon) && you.can_see(mon)) + count++; + } + } + } // if (monster != NON_MONSTER) + } // if (dist != -1) + } // radius loop if (count == 1) simple_monster_message(mon, " turns to flee the light!"); |