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 | |
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
-rw-r--r-- | crawl-ref/source/beam.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/cloud.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/cloud.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.cc | 21 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 77 |
5 files changed, 91 insertions, 36 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 983651bd42..1b71cd7711 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -5482,6 +5482,10 @@ static void _explosion_map( bolt &beam, int x, int y, if (count > 10*r) return; + // 3. check sanctuary + if (is_sanctuary(beam.target_x + x, beam.target_y + y)) + return; + // 3. check to see if we're blocked by something // specifically, we're blocked by WALLS. Not // statues, idols, etc. diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 863a6fcc26..aca3710b42 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -27,6 +27,7 @@ #include "player.h" #include "stuff.h" #include "terrain.h" +#include "view.h" // Returns true if this cloud spreads out as it dissipates. static unsigned char _actual_spread_rate(cloud_type type, int spread_rate) @@ -96,7 +97,8 @@ static int _spread_cloud(const cloud_struct &cloud) if (!in_bounds(x, y) || env.cgrid[x][y] != EMPTY_CLOUD - || grid_is_solid(grd[x][y])) + || grid_is_solid(grd[x][y]) + || is_sanctuary(x, y) && !is_harmless_cloud(cloud.type)) continue; int newdecay = cloud.decay / 2 + 1; @@ -225,6 +227,9 @@ void place_cloud(cloud_type cl_type, int ctarget_x, int ctarget_y, int cl_range, kill_category whose, int _spread_rate) { + if (is_sanctuary(ctarget_x, ctarget_y) && !is_harmless_cloud(cl_type)) + return; + int cl_new = -1; // more compact {dlb} @@ -586,6 +591,23 @@ bool is_damaging_cloud(cloud_type type, bool temp) } } +bool is_harmless_cloud(cloud_type type) +{ + switch (type) + { + case CLOUD_NONE: + case CLOUD_BLACK_SMOKE: + case CLOUD_GREY_SMOKE: + case CLOUD_BLUE_SMOKE: + case CLOUD_PURP_SMOKE: + case CLOUD_MIST: + case CLOUD_DEBUGGING: + return (true); + default: + return (false); + } +} + std::string cloud_name(cloud_type type) { switch (type) diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h index 931a94aee2..ff64583ea9 100644 --- a/crawl-ref/source/cloud.h +++ b/crawl-ref/source/cloud.h @@ -58,6 +58,7 @@ void in_a_cloud(void); std::string cloud_name(cloud_type type); bool is_damaging_cloud(cloud_type type, bool temp = false); +bool is_harmless_cloud(cloud_type type); // fog generator void place_fog_machine(fog_machine_type fm_type, cloud_type cl_type, diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 0870833493..4fa667f40d 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -1596,8 +1596,8 @@ void spore_goes_pop(monsters *monster) beam.thrower = KILL_MON; // someone else's explosion beam.aux_source.clear(); - const char* msg = NULL; - + const char* msg = NULL; + const char* sanct_msg = NULL; if (type == MONS_GIANT_SPORE) { beam.flavour = BEAM_SPORE; @@ -1606,6 +1606,7 @@ void spore_goes_pop(monsters *monster) beam.damage = dice_def( 3, 15 ); beam.ex_size = 2; msg = "The giant spore explodes!"; + sanct_msg = "By Zin's power, the giant spore's explosion is contained."; } else if (type == MONS_BALL_LIGHTNING) { @@ -1615,6 +1616,8 @@ void spore_goes_pop(monsters *monster) beam.damage = dice_def( 3, 20 ); beam.ex_size = coinflip() ? 3 : 2; msg = "The ball lightning explodes!"; + sanct_msg = "By Zin's power, the ball lightning's explosion " + "is contained."; } else { @@ -1624,15 +1627,19 @@ void spore_goes_pop(monsters *monster) return; } - bool nearby = mons_near(monster); - - if (nearby) + if (you.can_see(monster)) { viewwindow(true, false); - mpr(msg); + if (is_sanctuary(monster->x, monster->y)) + mpr(sanct_msg, MSGCH_GOD); + else + mpr(msg); } - explosion(beam, false, false, true, true, nearby); + if (is_sanctuary(monster->x, monster->y)) + return; + + explosion(beam, false, false, true, true, mons_near(monster)); } bolt mons_spells( int spell_cast, int power ) 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); } |