diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-01 09:26:40 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-01 09:26:40 +0000 |
commit | 3e4e26b227d45f1a3f33a3adf1ff25f3b02a79dc (patch) | |
tree | bf100acfc5d1644f40ca927e0eb5f4a3ff810e79 /crawl-ref/source/spells3.cc | |
parent | 94e3fadcc3e1c6931409d6a4b7e1cb714ec94076 (diff) | |
download | crawl-ref-3e4e26b227d45f1a3f33a3adf1ff25f3b02a79dc.tar.gz crawl-ref-3e4e26b227d45f1a3f33a3adf1ff25f3b02a79dc.zip |
Make initial sanctuary be circular in shape rather than square.
Remove non-harmless clouds when laying down sanctuary, and don't allow
non-harmless clouds to speard into sanctuary or be placed on it.
Don't let explosions spread into sanctuary (probably needs a flavour message).
If a giant spore or ball lightning somehow explodes while in sanctuary
then give a message about Zin containing it's explosion, and skip the
call to explosion().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6284 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r-- | crawl-ref/source/spells3.cc | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index edc387f6e2..c117b049f0 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1675,11 +1675,11 @@ bool cast_sanctuary(const int power) // radius could also be influenced by Inv // and would then have to be stored globally. - const int radius = 5; - const int pattern = random2(4); - int count = 0; - int monster = NON_MONSTER; - monsters *mon = NULL; + const int radius = 5; + const int pattern = random2(4); + int scare_count = 0; + int cloud_count = 0; + monsters *seen_mon = NULL; for (int x = -radius; x <= radius; x++) for (int y = -radius; y <= radius; y++) @@ -1688,6 +1688,11 @@ bool cast_sanctuary(const int power) int posy = you.y_pos + y; int dist = _inside_circle(posx, posy, radius); + if (dist == -1) + continue; + + coord_def pos(posx, posy); + // forming patterns if (pattern == 0 // outward rays && (x == 0 || y == 0 || x == y || x == -y) @@ -1706,42 +1711,58 @@ bool cast_sanctuary(const int power) env.map[posx][posy].property = FPROP_SANCTUARY_2; // white // scare all attacking monsters inside sanctuary - if (dist != -1) + int monster = mgrd[posx][posy]; + if (monster != NON_MONSTER) { - monster = mgrd[posx][posy]; + monsters* mon = &menv[monster]; - if (monster != NON_MONSTER) + if (!mons_wont_attack(mon)) { - mon = &menv[monster]; - - if (!mons_wont_attack(mon)) + if (mons_is_mimic(mon->type)) { - if (mons_is_mimic(mon->type)) + mimic_alert(mon); + if(you.can_see(mon)) { - mimic_alert(mon); - if(you.can_see(mon)) - count++; + scare_count++; + seen_mon = mon; } - else if (mon->add_ench(mon_enchant(ENCH_FEAR, 0, - KC_YOU))) - { - behaviour_event(mon, ME_SCARE, MHITYOU); + } + 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++; + // Check to see that monster is actually fleeing, + // since plants can't flee. + if (mons_is_fleeing(mon) && you.can_see(mon)) + { + scare_count++; + seen_mon = mon; } } - } // if (monster != NON_MONSTER) - } // if (dist != -1) + } + } // if (monster != NON_MONSTER) + + if (!is_harmless_cloud(cloud_type_at(pos))) + { + delete_cloud(env.cgrid[posx][posy]); + if (see_grid(pos)) + cloud_count++; + } } // radius loop - if (count == 1) - simple_monster_message(mon, " turns to flee the light!"); - else if (count > 0) + if (scare_count == 1 && seen_mon != NULL) + simple_monster_message(seen_mon, " turns to flee the light!"); + else if (scare_count > 0) mpr("The monsters scatter in all directions!"); + if (cloud_count == 1) + mprf(MSGCH_GOD, "By Zin's power, the foul cloud within the " + " Sanctuary is swept away."); + else if (cloud_count > 1) + mprf(MSGCH_GOD, "By Zin's power, all foul fumes within the " + " Sanctuary are swept away."); + return (true); } |