From 29da6fa25d84dfdb5fdb15826a707c32c14041ad Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 22 Mar 2007 14:22:25 +0000 Subject: Cleaned up clouds and threw out the foo_MON values from the cloud enum. The creator of the cloud is now remembered with the cloud, so kills from friendlies' poison clouds are credited appropriately. Increased MAX_CLOUDS to 180. Breaks save compatibility. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1076 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 69 +++++++++++++---------------------- crawl-ref/source/cloud.cc | 43 +++++++++++----------- crawl-ref/source/cloud.h | 6 ++-- crawl-ref/source/defines.h | 2 +- crawl-ref/source/effects.cc | 1 - crawl-ref/source/enum.h | 35 +++++++----------- crawl-ref/source/externs.h | 9 ++--- crawl-ref/source/hiscores.cc | 4 +-- crawl-ref/source/it_use3.cc | 9 ++--- crawl-ref/source/misc.cc | 35 +++--------------- crawl-ref/source/mon-util.cc | 10 ++++-- crawl-ref/source/monstuff.cc | 86 ++++++++++++++------------------------------ crawl-ref/source/spells1.cc | 15 ++++---- crawl-ref/source/spells1.h | 5 +-- crawl-ref/source/spells2.cc | 5 ++- crawl-ref/source/spells4.cc | 32 +++++++++-------- crawl-ref/source/spells4.h | 2 +- crawl-ref/source/spl-cast.cc | 21 +++++------ crawl-ref/source/spl-util.cc | 59 +++++++++++++++--------------- crawl-ref/source/spl-util.h | 5 +-- crawl-ref/source/tags.cc | 2 ++ crawl-ref/source/view.cc | 8 ----- 22 files changed, 195 insertions(+), 268 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 38cca50cd3..a2d4e1a871 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2256,19 +2256,15 @@ static void beam_explodes(struct bolt &beam, int x, int y) // cloud producer -- POISON BLAST if (beam.name == "blast of poison") { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_POISON : CLOUD_POISON_MON; - big_cloud( cloud_type, x, y, 0, 7 + random2(5) ); + big_cloud( CLOUD_POISON, whose_kill(beam), x, y, 0, 7 + random2(5) ); return; } // cloud producer -- FOUL VAPOR (SWAMP DRAKE?) if (beam.name == "foul vapour") { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_STINK : CLOUD_STINK_MON; - if (beam.flavour == BEAM_MIASMA) - cloud_type = YOU_KILL(beam.thrower) ? - CLOUD_MIASMA : CLOUD_MIASMA_MON; - big_cloud( cloud_type, x, y, 0, 9 ); + cloud_type = beam.flavour == BEAM_MIASMA? CLOUD_MIASMA : CLOUD_STINK; + big_cloud( cloud_type, whose_kill(beam), x, y, 0, 9 ); return; } @@ -2546,9 +2542,7 @@ static int affect_wall(struct bolt &beam, int x, int y) else if (player_can_smell()) beam_mpr(MSGCH_PLAIN, "You smell burning wax."); - place_cloud( - YOU_KILL(beam.thrower)? CLOUD_FIRE : CLOUD_FIRE_MON, - x, y, random2(10) + 15 ); + place_cloud(CLOUD_FIRE, x, y, random2(10) + 15, whose_kill(beam)); beam.obvious_effect = true; @@ -2603,8 +2597,6 @@ static int affect_wall(struct bolt &beam, int x, int y) static int affect_place_clouds(struct bolt &beam, int x, int y) { - int cloud_type; - if (beam.in_explosion_phase) { affect_place_explosion_clouds( beam, x, y ); @@ -2625,13 +2617,11 @@ static int affect_place_clouds(struct bolt &beam, int x, int y) int clouty = env.cgrid[x][y]; // fire cancelling cold & vice versa - if (((env.cloud[clouty].type == CLOUD_COLD - || env.cloud[clouty].type == CLOUD_COLD_MON) - && (beam.flavour == BEAM_FIRE - || beam.flavour == BEAM_LAVA)) - || ((env.cloud[clouty].type == CLOUD_FIRE - || env.cloud[clouty].type == CLOUD_FIRE_MON) - && beam.flavour == BEAM_COLD)) + if ((env.cloud[clouty].type == CLOUD_COLD + && (beam.flavour == BEAM_FIRE + || beam.flavour == BEAM_LAVA)) + || (env.cloud[clouty].type == CLOUD_FIRE + && beam.flavour == BEAM_COLD)) { if (!silenced(x, y) && !silenced(you.x_pos, you.y_pos)) @@ -2646,60 +2636,50 @@ static int affect_place_clouds(struct bolt &beam, int x, int y) // POISON BLAST if (beam.name == "blast of poison") - { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_POISON : CLOUD_POISON_MON; - - place_cloud( cloud_type, x, y, random2(4) + 2 ); - } + place_cloud( CLOUD_POISON, x, y, random2(4) + 2, whose_kill(beam) ); // FIRE/COLD over water/lava if ( (grd[x][y] == DNGN_LAVA && beam.flavour == BEAM_COLD) || (grid_is_watery(grd[x][y]) && beam.flavour == BEAM_FIRE) ) { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_STEAM : CLOUD_STEAM_MON; - place_cloud( cloud_type, x, y, 2 + random2(5) ); + place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), whose_kill(beam) ); } if (beam.flavour == BEAM_COLD && grid_is_watery(grd[x][y])) { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_COLD : CLOUD_COLD_MON; - place_cloud( cloud_type, x, y, 2 + random2(5) ); + place_cloud( CLOUD_COLD, x, y, 2 + random2(5), whose_kill(beam) ); } // ORB OF ENERGY if (beam.name == "orb of energy") - place_cloud( CLOUD_PURP_SMOKE, x, y, random2(5) + 1 ); + place_cloud( CLOUD_PURP_SMOKE, x, y, random2(5) + 1, whose_kill(beam) ); // GREAT BLAST OF COLD if (beam.name == "great blast of cold") - place_cloud( CLOUD_COLD, x, y, random2(5) + 3 ); + place_cloud( CLOUD_COLD, x, y, random2(5) + 3, whose_kill(beam) ); // BALL OF STEAM if (beam.name == "ball of steam") { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_STEAM : CLOUD_STEAM_MON; - place_cloud( cloud_type, x, y, random2(5) + 2 ); + place_cloud( CLOUD_STEAM, x, y, random2(5) + 2, whose_kill(beam) ); } if (beam.flavour == BEAM_MIASMA) { - cloud_type = YOU_KILL( beam.thrower ) ? CLOUD_MIASMA : CLOUD_MIASMA_MON; - place_cloud( cloud_type, x, y, random2(5) + 2 ); + place_cloud( CLOUD_MIASMA, x, y, random2(5) + 2, whose_kill(beam) ); } // STICKY FLAME if (beam.name == "sticky flame") { - place_cloud( CLOUD_BLACK_SMOKE, x, y, random2(4) + 2 ); + place_cloud( CLOUD_BLACK_SMOKE, x, y, random2(4) + 2, + whose_kill(beam) ); } // POISON GAS if (beam.name == "poison gas") - { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_POISON : CLOUD_POISON_MON; - place_cloud( cloud_type, x, y, random2(4) + 3 ); - } + place_cloud( CLOUD_POISON, x, y, random2(4) + 3, whose_kill(beam) ); return (0); } @@ -2715,8 +2695,7 @@ static void affect_place_explosion_clouds(struct bolt &beam, int x, int y) || ((grd[x][y] == DNGN_DEEP_WATER || grd[x][y] == DNGN_SHALLOW_WATER) && beam.flavour == BEAM_FIRE) ) { - cloud_type = YOU_KILL(beam.thrower) ? CLOUD_STEAM : CLOUD_STEAM_MON; - place_cloud( cloud_type, x, y, 2 + random2(5) ); + place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), whose_kill(beam) ); return; } @@ -2779,19 +2758,19 @@ static void affect_place_explosion_clouds(struct bolt &beam, int x, int y) break; } - place_cloud( cloud_type, x, y, duration ); + place_cloud( cloud_type, x, y, duration, whose_kill(beam) ); } // then check for more specific explosion cloud types. if (beam.name == "ice storm") { - place_cloud( CLOUD_COLD, x, y, 2 + random2avg(5, 2) ); + place_cloud( CLOUD_COLD, x, y, 2 + random2avg(5, 2), whose_kill(beam) ); } if (beam.name == "stinking cloud") { duration = 1 + random2(4) + random2( (beam.ench_power / 50) + 1 ); - place_cloud( CLOUD_STINK, x, y, duration ); + place_cloud( CLOUD_STINK, x, y, duration, whose_kill(beam) ); } if (beam.name == "great blast of fire") @@ -2801,7 +2780,7 @@ static void affect_place_explosion_clouds(struct bolt &beam, int x, int y) if (duration > 20) duration = 20 + random2(4); - place_cloud( CLOUD_FIRE, x, y, duration ); + place_cloud( CLOUD_FIRE, x, y, duration, whose_kill(beam) ); if (grd[x][y] == DNGN_FLOOR && mgrd[x][y] == NON_MONSTER && one_chance_in(4)) diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 633bd331ce..43fc2ee1c6 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -25,18 +25,16 @@ static bool cloud_spreads(const cloud_struct &cloud) switch (cloud.type) { case CLOUD_STEAM: - case CLOUD_STEAM_MON: case CLOUD_GREY_SMOKE: case CLOUD_BLACK_SMOKE: - case CLOUD_GREY_SMOKE_MON: - case CLOUD_BLACK_SMOKE_MON: return (true); default: return (false); } } -static void new_cloud( int cloud, int type, int x, int y, int decay ) +static void new_cloud( int cloud, int type, int x, int y, int decay, + kill_category whose ) { ASSERT( env.cloud[ cloud ].type == CLOUD_NONE ); @@ -44,11 +42,13 @@ static void new_cloud( int cloud, int type, int x, int y, int decay ) env.cloud[ cloud ].decay = decay; env.cloud[ cloud ].x = x; env.cloud[ cloud ].y = y; + env.cloud[ cloud ].whose = whose; env.cgrid[ x ][ y ] = cloud; env.cloud_no++; } -static void place_new_cloud(int cltype, int x, int y, int decay) +static void place_new_cloud(int cltype, int x, int y, int decay, + kill_category whose) { if (env.cloud_no >= MAX_CLOUDS) return; @@ -58,7 +58,7 @@ static void place_new_cloud(int cltype, int x, int y, int decay) { if (env.cloud[ci].type == CLOUD_NONE) // ie is empty { - new_cloud( ci, cltype, x, y, decay ); + new_cloud( ci, cltype, x, y, decay, whose ); break; } } @@ -90,7 +90,7 @@ static int spread_cloud(const cloud_struct &cloud) if (newdecay >= cloud.decay) newdecay = cloud.decay - 1; - place_new_cloud( cloud.type, x, y, newdecay ); + place_new_cloud( cloud.type, x, y, newdecay, cloud.whose ); extra_decay += 8; } @@ -126,14 +126,12 @@ void manage_clouds(void) // water -> flaming clouds: // lava -> freezing clouds: - if ((env.cloud[cc].type == CLOUD_FIRE - || env.cloud[cc].type == CLOUD_FIRE_MON) + if (env.cloud[cc].type == CLOUD_FIRE && grd[env.cloud[cc].x][env.cloud[cc].y] == DNGN_DEEP_WATER) { dissipate *= 4; } - else if ((env.cloud[cc].type == CLOUD_COLD - || env.cloud[cc].type == CLOUD_COLD_MON) + else if (env.cloud[cc].type == CLOUD_COLD && grd[env.cloud[cc].x][env.cloud[cc].y] == DNGN_LAVA) { dissipate *= 4; @@ -160,6 +158,7 @@ void delete_cloud( int cloud ) env.cloud[ cloud ].decay = 0; env.cloud[ cloud ].x = 0; env.cloud[ cloud ].y = 0; + env.cloud[ cloud ].whose = KC_OTHER; env.cgrid[ cloud_x ][ cloud_y ] = EMPTY_CLOUD; env.cloud_no--; } @@ -183,24 +182,26 @@ void move_cloud( int cloud, int new_x, int new_y ) // Places a cloud with the given stats assuming one doesn't already // exist at that point. -void check_place_cloud( int cl_type, int x, int y, int lifetime ) +void check_place_cloud( int cl_type, int x, int y, int lifetime, + kill_category whose ) { if (!in_bounds(x, y) || env.cgrid[x][y] != EMPTY_CLOUD) return; - place_cloud( cl_type, x, y, lifetime ); + place_cloud( cl_type, x, y, lifetime, whose ); } -// Places a cloud with the given stats. May delete old clouds to make way -// if there are too many (MAX_CLOUDS == 30) on level. Will overwrite an old +// Places a cloud with the given stats. May delete old clouds to +// make way if there are too many on level. Will overwrite an old // cloud under some circumstances. -void place_cloud(unsigned char cl_type, unsigned char ctarget_x, - unsigned char ctarget_y, unsigned char cl_range) +void place_cloud(int cl_type, int ctarget_x, + int ctarget_y, int cl_range, + kill_category whose) { int cl_new = -1; // more compact {dlb} - const unsigned char target_cgrid = env.cgrid[ctarget_x][ctarget_y]; + const int target_cgrid = env.cgrid[ctarget_x][ctarget_y]; // that is, another cloud already there {dlb} if (target_cgrid != EMPTY_CLOUD) @@ -247,7 +248,8 @@ void place_cloud(unsigned char cl_type, unsigned char ctarget_x, // create new cloud if (cl_new != -1) - new_cloud( cl_new, cl_type, ctarget_x, ctarget_y, cl_range * 10 ); + new_cloud( cl_new, cl_type, ctarget_x, ctarget_y, cl_range * 10, + whose ); else { // find slot for cloud @@ -255,7 +257,8 @@ void place_cloud(unsigned char cl_type, unsigned char ctarget_x, { if (env.cloud[ci].type == CLOUD_NONE) // ie is empty { - new_cloud( ci, cl_type, ctarget_x, ctarget_y, cl_range * 10 ); + new_cloud( ci, cl_type, ctarget_x, ctarget_y, cl_range * 10, + whose ); break; } } diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h index 62f8d93ce2..65cb2db888 100644 --- a/crawl-ref/source/cloud.h +++ b/crawl-ref/source/cloud.h @@ -17,8 +17,10 @@ void delete_cloud( int cloud ); void move_cloud( int cloud, int new_x, int new_y ); -void check_place_cloud( int cl_type, int x, int y, int lifetime ); -void place_cloud(unsigned char cl_type, unsigned char ctarget_x, unsigned char ctarget_y, unsigned char cl_range); +void check_place_cloud( int cl_type, int x, int y, int lifetime, + kill_category whose ); +void place_cloud(int cl_type, int ctarget_x, int ctarget_y, int cl_range, + kill_category whose); void manage_clouds(void); diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h index 2a9c8d5aca..f4a55736ef 100644 --- a/crawl-ref/source/defines.h +++ b/crawl-ref/source/defines.h @@ -65,7 +65,7 @@ #define NON_ITEM 501 // max size of cloud array {dlb}: -#define MAX_CLOUDS 100 +#define MAX_CLOUDS 180 // empty cloud -- (CLOUDS + 1) {dlb}: #define EMPTY_CLOUD 101 diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 5031bdfb17..bd9e8452bf 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -254,7 +254,6 @@ void direct_effect(struct bolt &pbolt) switch (pbolt.type) { case DMNBM_HELLFIRE: - mpr( "You are engulfed in a burst of hellfire!" ); pbolt.name = "hellfire"; pbolt.ex_size = 1; pbolt.flavour = BEAM_HELLFIRE; diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 38c65184d6..eedb9dd0b4 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -512,31 +512,20 @@ enum char_set_type enum cloud_type { - CLOUD_NONE, // 0 - CLOUD_FIRE, // 1 - CLOUD_STINK, // 2 - CLOUD_COLD, // 3 - CLOUD_POISON, // 4 - CLOUD_GREY_SMOKE = 5, // 5: found 11jan2000 {dlb} - CLOUD_BLUE_SMOKE = 6, // 6: found 11jan2000 {dlb} - CLOUD_PURP_SMOKE = 7, // was: CLOUD_ENERGY and wrong 19jan2000 {dlb} - CLOUD_STEAM, // 8 - CLOUD_MIASMA = 9, // 9: found 11jan2000 {dlb} - CLOUD_BLACK_SMOKE = 10, //was: CLOUD_STICKY_FLAME and wrong 19jan2000 {dlb} + CLOUD_NONE, + CLOUD_FIRE, + CLOUD_STINK, + CLOUD_COLD, + CLOUD_POISON, + CLOUD_GREY_SMOKE, + CLOUD_BLUE_SMOKE, + CLOUD_PURP_SMOKE, + CLOUD_STEAM, + CLOUD_MIASMA, + CLOUD_BLACK_SMOKE, CLOUD_MIST, CLOUD_RANDOM = 98, - CLOUD_DEBUGGING = 99, // 99: used once as 'nonexistent cloud' {dlb} -// if env.cloud_type > 100, it is a monster's cloud {dlb} - CLOUD_FIRE_MON = 101, // 101: found 11jan2000 {dlb} - CLOUD_STINK_MON = 102, // 102: found 11jan2000 {dlb} - CLOUD_COLD_MON = 103, // 103: added 11jan2000 {dlb} - CLOUD_POISON_MON = 104, // 104 - CLOUD_GREY_SMOKE_MON = 105, // 105: found 11jan2000 {dlb} - CLOUD_BLUE_SMOKE_MON = 106, // 106: found 11jan2000 {dlb} - CLOUD_PURP_SMOKE_MON = 107, // 107: - CLOUD_STEAM_MON = 108, // 108: added 11jan2000 {dlb} - CLOUD_MIASMA_MON = 109, // 109: added 11jan2000 {dlb} - CLOUD_BLACK_SMOKE_MON = 110 // 110: added 19jan2000 {dlb} + CLOUD_DEBUGGING = 99 // 99: used once as 'nonexistent cloud' {dlb} }; enum command_type diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 0b50040f56..5266b1ba15 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1004,10 +1004,11 @@ private: struct cloud_struct { - unsigned char x; - unsigned char y; - unsigned char type; - int decay; + int x; + int y; + int type; + int decay; + kill_category whose; }; struct shop_struct diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 65db7627a0..72d6dbdac2 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -203,8 +203,8 @@ static void hiscores_print_entry(const scorefile_entry &se, { entry = hiscores_format_single( se ); // truncate if we want short format - if (entry.length() > 75) - entry = entry.substr(0, 75); + if (entry.length() > 80) + entry = entry.substr(0, 80); } else { diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 7ae760b26f..82621c1c73 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -878,19 +878,20 @@ void tome_of_power(char sc_read_2) case 8: case 9: mpr("A cloud of weird smoke pours from the book's pages!"); - big_cloud( CLOUD_GREY_SMOKE + random2(3), you.x_pos, you.y_pos, 20, - 10 + random2(8) ); + big_cloud( CLOUD_GREY_SMOKE + random2(3), KC_YOU, + you.x_pos, you.y_pos, 20, 10 + random2(8) ); return; case 1: case 14: mpr("A cloud of choking fumes pours from the book's pages!"); - big_cloud(CLOUD_POISON, you.x_pos, you.y_pos, 20, 7 + random2(5)); + big_cloud(CLOUD_POISON, KC_YOU, + you.x_pos, you.y_pos, 20, 7 + random2(5)); return; case 2: case 13: mpr("A cloud of freezing gas pours from the book's pages!"); - big_cloud(CLOUD_COLD, you.x_pos, you.y_pos, 20, 8 + random2(5)); + big_cloud(CLOUD_COLD, KC_YOU, you.x_pos, you.y_pos, 20, 8 + random2(5)); return; case 5: diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 37d70ffb20..121077393a 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -326,7 +326,6 @@ void in_a_cloud(void) switch (env.cloud[cl].type) { case CLOUD_FIRE: - case CLOUD_FIRE_MON: if (you.fire_shield) return; @@ -359,7 +358,6 @@ void in_a_cloud(void) break; case CLOUD_STINK: - case CLOUD_STINK_MON: // If you don't have to breathe, unaffected mpr("You are engulfed in noxious fumes!"); if (player_res_poison()) @@ -380,7 +378,6 @@ void in_a_cloud(void) break; case CLOUD_COLD: - case CLOUD_COLD_MON: mpr("You are engulfed in freezing vapours!"); resist = player_res_cold(); @@ -409,7 +406,6 @@ void in_a_cloud(void) break; case CLOUD_POISON: - case CLOUD_POISON_MON: // If you don't have to breathe, unaffected mpr("You are engulfed in poison gas!"); if (!player_res_poison()) @@ -424,15 +420,10 @@ void in_a_cloud(void) case CLOUD_BLUE_SMOKE: case CLOUD_PURP_SMOKE: case CLOUD_BLACK_SMOKE: - case CLOUD_GREY_SMOKE_MON: - case CLOUD_BLUE_SMOKE_MON: - case CLOUD_PURP_SMOKE_MON: - case CLOUD_BLACK_SMOKE_MON: mpr("You are engulfed in a cloud of smoke!"); break; case CLOUD_STEAM: - case CLOUD_STEAM_MON: mpr("You are engulfed in a cloud of scalding steam!"); if (player_res_steam() > 0) { @@ -444,11 +435,11 @@ void in_a_cloud(void) if (hurted < 0 || player_res_fire() > 0) hurted = 0; - ouch( (hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, "poison gas" ); + ouch( (hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, + "steam" ); break; case CLOUD_MIASMA: - case CLOUD_MIASMA_MON: mpr("You are engulfed in a dark miasma."); if (player_prot_life() > random2(3)) @@ -1811,17 +1802,11 @@ bool is_damaging_cloud(cloud_type type) switch (type) { case CLOUD_FIRE: - case CLOUD_FIRE_MON: case CLOUD_STINK: - case CLOUD_STINK_MON: case CLOUD_COLD: - case CLOUD_COLD_MON: case CLOUD_POISON: - case CLOUD_POISON_MON: case CLOUD_STEAM: - case CLOUD_STEAM_MON: case CLOUD_MIASMA: - case CLOUD_MIASMA_MON: return (true); default: return (false); @@ -1833,34 +1818,24 @@ std::string cloud_name(cloud_type type) switch (type) { case CLOUD_FIRE: - case CLOUD_FIRE_MON: return "flame"; case CLOUD_STINK: - case CLOUD_STINK_MON: return "noxious fumes"; case CLOUD_COLD: - case CLOUD_COLD_MON: return "freezing vapour"; case CLOUD_POISON: - case CLOUD_POISON_MON: return "poison gases"; case CLOUD_GREY_SMOKE: - case CLOUD_GREY_SMOKE_MON: return "grey smoke"; case CLOUD_BLUE_SMOKE: - case CLOUD_BLUE_SMOKE_MON: return "blue smoke"; case CLOUD_PURP_SMOKE: - case CLOUD_PURP_SMOKE_MON: return "purple smoke"; case CLOUD_STEAM: - case CLOUD_STEAM_MON: return "steam"; case CLOUD_MIASMA: - case CLOUD_MIASMA_MON: return "foul pestilence"; case CLOUD_BLACK_SMOKE: - case CLOUD_BLACK_SMOKE_MON: return "black smoke"; case CLOUD_MIST: return "thin mist"; @@ -2125,11 +2100,11 @@ static void apply_environment_effect(const coord_def &c) { const int grid = grd[c.x][c.y]; if (grid == DNGN_LAVA) - check_place_cloud( CLOUD_BLACK_SMOKE_MON, - c.x, c.y, random_range( 4, 8 ) ); + check_place_cloud( CLOUD_BLACK_SMOKE, + c.x, c.y, random_range( 4, 8 ), KC_OTHER ); else if (grid == DNGN_SHALLOW_WATER) check_place_cloud( CLOUD_MIST, - c.x, c.y, random_range( 2, 5 ) ); + c.x, c.y, random_range( 2, 5 ), KC_OTHER ); } static const int Base_Sfx_Chance = 5; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index a7a7a35de6..4d53ff73ac 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -2774,8 +2774,8 @@ void monsters::rot(actor *agent, int rotlevel, int immed_rot) return; // Apply immediate damage because we can't handle rotting for monsters yet. - const int damage = immed_rot + random2(rotlevel * 3); - if (damage) + const int damage = immed_rot; + if (damage > 0) { if (mons_near(this) && player_monster_visible(this)) mprf("%s %s!", @@ -2789,6 +2789,10 @@ void monsters::rot(actor *agent, int rotlevel, int immed_rot) hit_points = max_hit_points; } } + + if (rotlevel > 0) + add_ench( mon_enchant(ENCH_ROT, cap_int(rotlevel, 4), + agent->kill_alignment()) ); } void monsters::confuse(int strength) @@ -3400,6 +3404,8 @@ void monsters::apply_enchantment(mon_enchant me, int spd) && random2(1000) < mod_speed( 333, spd )) { hurt_monster(this, 1); + if (hit_points < max_hit_points && coinflip()) + --max_hit_points; } if (random2(1000) < mod_speed( me.degree == 1? 250 : 333, spd )) diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 66bb45a775..53c015fef6 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -412,7 +412,8 @@ void monster_die(monsters *monster, char killer, int i, bool silent) } if (monster->type == MONS_FIRE_VORTEX) - place_cloud(CLOUD_FIRE_MON, monster->x, monster->y, 2 + random2(4)); + place_cloud(CLOUD_FIRE, monster->x, monster->y, 2 + random2(4), + monster->kill_alignment()); } else if (monster->type == MONS_SIMULACRUM_SMALL || monster->type == MONS_SIMULACRUM_LARGE) @@ -430,7 +431,8 @@ void monster_die(monsters *monster, char killer, int i, bool silent) gain_exp( exper_value( monster ) / 2 + 1 ); } - place_cloud(CLOUD_COLD_MON, monster->x, monster->y, 2 + random2(4)); + place_cloud(CLOUD_COLD, monster->x, monster->y, 2 + random2(4), + monster->kill_alignment()); } else if (monster->type == MONS_DANCING_WEAPON) { @@ -445,8 +447,9 @@ void monster_die(monsters *monster, char killer, int i, bool silent) } if (hard_reset) - place_cloud( CLOUD_GREY_SMOKE_MON + random2(3), monster->x, - monster->y, 1 + random2(3) ); + place_cloud( CLOUD_GREY_SMOKE + random2(3), + monster->x, monster->y, 1 + random2(3), + monster->kill_alignment() ); if (!testbits(monster->flags, MF_CREATED_FRIENDLY)) @@ -680,8 +683,9 @@ void monster_die(monsters *monster, char killer, int i, bool silent) simple_monster_message( monster, " disappears in a puff of smoke!" ); - place_cloud( CLOUD_GREY_SMOKE_MON + random2(3), monster->x, - monster->y, 1 + random2(3) ); + place_cloud( CLOUD_GREY_SMOKE + random2(3), monster->x, + monster->y, 1 + random2(3), + monster->kill_alignment() ); if (monster->needs_transit()) { @@ -769,16 +773,17 @@ void monster_die(monsters *monster, char killer, int i, bool silent) { simple_monster_message( monster, " vaporizes!" ); - place_cloud( CLOUD_COLD_MON, monster->x, monster->y, - 1 + random2(3) ); + place_cloud( CLOUD_COLD, monster->x, monster->y, + 1 + random2(3), monster->kill_alignment() ); } else { simple_monster_message(monster, "'s corpse disappears in a puff of smoke!"); - place_cloud( CLOUD_GREY_SMOKE_MON + random2(3), - monster->x, monster->y, 1 + random2(3) ); + place_cloud( CLOUD_GREY_SMOKE + random2(3), + monster->x, monster->y, 1 + random2(3), + monster->kill_alignment() ); } } } @@ -3293,8 +3298,7 @@ static void monster_regenerate(monsters *monster) || (monster->type == MONS_FIRE_ELEMENTAL && (grd[monster->x][monster->y] == DNGN_LAVA - || env.cgrid[monster->x][monster->y] == CLOUD_FIRE - || env.cgrid[monster->x][monster->y] == CLOUD_FIRE_MON)) + || env.cgrid[monster->x][monster->y] == CLOUD_FIRE)) || (monster->type == MONS_WATER_ELEMENTAL && (grd[monster->x][monster->y] == DNGN_SHALLOW_WATER @@ -4325,9 +4329,7 @@ static void monster_move(struct monsters *monster) if (monster->type == MONS_WATER_ELEMENTAL && (target_grid == DNGN_LAVA || targ_cloud_type == CLOUD_FIRE - || targ_cloud_type == CLOUD_FIRE_MON - || targ_cloud_type == CLOUD_STEAM - || targ_cloud_type == CLOUD_STEAM_MON)) + || targ_cloud_type == CLOUD_STEAM)) { good_move[count_x][count_y] = false; continue; @@ -4338,8 +4340,7 @@ static void monster_move(struct monsters *monster) && (target_grid == DNGN_DEEP_WATER || target_grid == DNGN_SHALLOW_WATER || target_grid == DNGN_BLUE_FOUNTAIN - || targ_cloud_type == CLOUD_COLD - || targ_cloud_type == CLOUD_COLD_MON)) + || targ_cloud_type == CLOUD_COLD)) { good_move[count_x][count_y] = false; continue; @@ -4404,7 +4405,6 @@ static void monster_move(struct monsters *monster) switch (targ_cloud_type) { case CLOUD_FIRE: - case CLOUD_FIRE_MON: if (mons_res_fire(monster) > 0) continue; @@ -4413,7 +4413,6 @@ static void monster_move(struct monsters *monster) break; case CLOUD_STINK: - case CLOUD_STINK_MON: if (mons_res_poison(monster) > 0) continue; if (1 + random2(5) < monster->hit_dice) @@ -4423,7 +4422,6 @@ static void monster_move(struct monsters *monster) break; case CLOUD_COLD: - case CLOUD_COLD_MON: if (mons_res_cold(monster) > 0) continue; @@ -4432,7 +4430,6 @@ static void monster_move(struct monsters *monster) break; case CLOUD_POISON: - case CLOUD_POISON_MON: if (mons_res_poison(monster) > 0) continue; @@ -4442,7 +4439,6 @@ static void monster_move(struct monsters *monster) // this isn't harmful, but dumb critters might think so. case CLOUD_GREY_SMOKE: - case CLOUD_GREY_SMOKE_MON: if (mons_intel(monster->type) > I_ANIMAL || coinflip()) continue; @@ -4700,15 +4696,15 @@ forget_it: if (monster->type == MONS_EFREET || monster->type == MONS_FIRE_ELEMENTAL) { - place_cloud( CLOUD_FIRE_MON, monster->x, monster->y, - 2 + random2(4) ); + place_cloud( CLOUD_FIRE, monster->x, monster->y, + 2 + random2(4), monster->kill_alignment() ); } if (monster->type == MONS_ROTTING_DEVIL || monster->type == MONS_CURSE_TOE) { - place_cloud( CLOUD_MIASMA_MON, monster->x, monster->y, - 2 + random2(3) ); + place_cloud( CLOUD_MIASMA, monster->x, monster->y, + 2 + random2(3), monster->kill_alignment() ); } } else @@ -4785,7 +4781,6 @@ static void mons_in_cloud(struct monsters *monster) return; case CLOUD_FIRE: - case CLOUD_FIRE_MON: if (monster->type == MONS_FIRE_VORTEX || monster->type == MONS_EFREET || monster->type == MONS_FIRE_ELEMENTAL) @@ -4808,7 +4803,6 @@ static void mons_in_cloud(struct monsters *monster) break; // to damage routine at end {dlb} case CLOUD_STINK: - case CLOUD_STINK_MON: simple_monster_message(monster, " is engulfed in noxious gasses!"); if (mons_res_poison(monster) > 0) @@ -4823,7 +4817,6 @@ static void mons_in_cloud(struct monsters *monster) break; // to damage routine at end {dlb} case CLOUD_COLD: - case CLOUD_COLD_MON: simple_monster_message(monster, " is engulfed in freezing vapours!"); if (mons_res_cold(monster) > 0) @@ -4840,14 +4833,12 @@ static void mons_in_cloud(struct monsters *monster) // what of armour of poison resistance here? {dlb} case CLOUD_POISON: - case CLOUD_POISON_MON: simple_monster_message(monster, " is engulfed in a cloud of poison!"); if (mons_res_poison(monster) > 0) return; - poison_monster(monster, - env.cloud[wc].type == CLOUD_POISON? KC_YOU : KC_OTHER); + poison_monster(monster, env.cloud[wc].whose); // If the monster got poisoned, wake it up. wake = true; @@ -4858,7 +4849,6 @@ static void mons_in_cloud(struct monsters *monster) break; // to damage routine at end {dlb} case CLOUD_STEAM: - case CLOUD_STEAM_MON: // couldn't be bothered coding for armour of res fire // what of whether it is wearing steam dragon armour? {dlb} @@ -4879,15 +4869,13 @@ static void mons_in_cloud(struct monsters *monster) break; // to damage routine at end {dlb} case CLOUD_MIASMA: - case CLOUD_MIASMA_MON: simple_monster_message(monster, " is engulfed in a dark miasma!"); if (mons_holiness(monster) != MH_NATURAL || monster->type == MONS_DEATH_DRAKE) return; - poison_monster(monster, - (env.cloud[wc].type == CLOUD_MIASMA? KC_YOU : KC_OTHER)); + poison_monster(monster, env.cloud[wc].whose); if (monster->max_hit_points > 4 && coinflip()) monster->max_hit_points--; @@ -4920,30 +4908,8 @@ static void mons_in_cloud(struct monsters *monster) if (monster->hit_points < 1) { - switch (env.cloud[wc].type) - { - case CLOUD_FIRE_MON: - case CLOUD_STINK_MON: - case CLOUD_COLD_MON: - case CLOUD_POISON_MON: - case CLOUD_STEAM_MON: - case CLOUD_MIASMA_MON: - monster_die(monster, KILL_MISC, 0); - break; - default: - monster_die(monster, KILL_YOU, 0); - } - - switch (env.cloud[wc].type) - { - case CLOUD_FIRE: - case CLOUD_FIRE_MON: - case CLOUD_COLD: - case CLOUD_COLD_MON: - case CLOUD_STEAM: - case CLOUD_STEAM_MON: - monster->speed_increment = 1; - } + mon_enchant death_ench( ENCH_NONE, 0, env.cloud[wc].whose ); + monster_die(monster, death_ench.killer(), death_ench.kill_agent()); } } } // end mons_in_cloud() diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index f4697c7e52..2c20e508c0 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -445,7 +445,7 @@ int conjure_flame(int pow) if (durat > 23) durat = 23; - place_cloud( CLOUD_FIRE, spelld.tx, spelld.ty, durat ); + place_cloud( CLOUD_FIRE, spelld.tx, spelld.ty, durat, KC_YOU ); return (1); } // end cast_conjure_flame() @@ -471,15 +471,18 @@ int stinking_cloud( int pow, bolt &beem ) return (1); } // end stinking_cloud() -int cast_big_c(int pow, char cty, bolt &beam) +int cast_big_c(int pow, int cty, kill_category whose, bolt &beam) { - big_cloud( cty, beam.target_x, beam.target_y, pow, 8 + random2(3) ); + big_cloud( cty, whose, + beam.target_x, beam.target_y, pow, 8 + random2(3) ); return (1); } // end cast_big_c() -void big_cloud(char clouds, char cl_x, char cl_y, int pow, int size) +void big_cloud(int cloud_type, kill_category whose, + int cl_x, int cl_y, int pow, int size) { - apply_area_cloud(make_a_normal_cloud, cl_x, cl_y, pow, size, clouds); + apply_area_cloud(make_a_normal_cloud, cl_x, cl_y, pow, size, + cloud_type, whose); } // end big_cloud() static int healing_spell( int healed ) @@ -1138,7 +1141,7 @@ void manage_fire_shield(void) && env.cgrid[you.x_pos + stx][you.y_pos + sty] == EMPTY_CLOUD) { place_cloud( CLOUD_FIRE, you.x_pos + stx, you.y_pos + sty, - 1 + random2(6) ); + 1 + random2(6), KC_YOU ); } } } diff --git a/crawl-ref/source/spells1.h b/crawl-ref/source/spells1.h index c29a535221..2cf9deee53 100644 --- a/crawl-ref/source/spells1.h +++ b/crawl-ref/source/spells1.h @@ -56,7 +56,8 @@ int cast_healing(int power); /* *********************************************************************** * called from: beam - it_use3 - spells - spells1 * *********************************************************************** */ -void big_cloud(char clouds, char cl_x, char cl_y, int pow, int size); +void big_cloud(int clouds, kill_category whose, int cl_x, int cl_y, + int pow, int size); // last updated 24may2000 {dlb} @@ -69,7 +70,7 @@ int blink(void); /* *********************************************************************** * called from: spell * *********************************************************************** */ -int cast_big_c(int pow, char cty, bolt &beam); +int cast_big_c(int pow, int cty, kill_category whose, bolt &beam); void cast_confusing_touch(int power); void cast_cure_poison(int mabil); int allowed_deaths_door_hp(void); diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 6975c80d32..e0cb7d2120 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -268,7 +268,7 @@ int corpse_rot(int power) } place_cloud(CLOUD_MIASMA, adx, ady, - 4 + random2avg(16, 3)); + 4 + random2avg(16, 3), KC_YOU); goto out_of_raise; } @@ -1225,8 +1225,7 @@ int summon_elemental(int pow, int restricted_type, grd[ targ_x ][ targ_y ] = DNGN_FLOOR; } else if ((env.cgrid[ targ_x ][ targ_y ] != EMPTY_CLOUD - && (env.cloud[env.cgrid[ targ_x ][ targ_y ]].type == CLOUD_FIRE - || env.cloud[env.cgrid[ targ_x ][ targ_y ]].type == CLOUD_FIRE_MON)) + && env.cloud[env.cgrid[ targ_x ][ targ_y ]].type == CLOUD_FIRE) && (restricted_type == 0 || restricted_type == MONS_FIRE_ELEMENTAL)) { type_summoned = MONS_FIRE_ELEMENTAL; diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 1575e8cc12..d159b42367 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -962,7 +962,9 @@ static int ignite_poison_objects(int x, int y, int pow, int garbage) } if (strength > 0) - place_cloud(CLOUD_FIRE, x, y, strength + roll_dice(3, strength / 4) ); + place_cloud(CLOUD_FIRE, x, y, strength + roll_dice(3, strength / 4), + KC_YOU + ); return (strength); } // end ignite_poison_objects() @@ -978,8 +980,7 @@ static int ignite_poison_clouds( int x, int y, int pow, int garbage ) if (cloud != EMPTY_CLOUD) { - if (env.cloud[ cloud ].type == CLOUD_STINK - || env.cloud[ cloud ].type == CLOUD_STINK_MON) + if (env.cloud[ cloud ].type == CLOUD_STINK) { did_anything = true; env.cloud[ cloud ].type = CLOUD_FIRE; @@ -989,8 +990,7 @@ static int ignite_poison_clouds( int x, int y, int pow, int garbage ) if (env.cloud[ cloud ].decay < 1) env.cloud[ cloud ].decay = 1; } - else if (env.cloud[ cloud ].type == CLOUD_POISON - || env.cloud[ cloud ].type == CLOUD_POISON_MON) + else if (env.cloud[ cloud ].type == CLOUD_POISON) { did_anything = true; env.cloud[ cloud ].type = CLOUD_FIRE; @@ -1152,9 +1152,11 @@ void cast_ignite_poison(int pow) if (totalstrength) { - place_cloud(CLOUD_FIRE, you.x_pos, you.y_pos, - random2(totalstrength / 4 + 1) + random2(totalstrength / 4 + 1) + - random2(totalstrength / 4 + 1) + random2(totalstrength / 4 + 1) + 1); + place_cloud( + CLOUD_FIRE, you.x_pos, you.y_pos, + random2(totalstrength / 4 + 1) + random2(totalstrength / 4 + 1) + + random2(totalstrength / 4 + 1) + random2(totalstrength / 4 + 1) + 1, + KC_YOU); } // player is poisonous @@ -1540,7 +1542,8 @@ static int make_a_rot_cloud(int x, int y, int pow, int ctype) place_cloud(ctype, x, y, (3 + random2(pow / 4) + random2(pow / 4) + - random2(pow / 4))); + random2(pow / 4)), + KC_YOU); return 1; } @@ -1550,10 +1553,11 @@ static int make_a_rot_cloud(int x, int y, int pow, int ctype) return 0; } // end make_a_rot_cloud() -int make_a_normal_cloud(int x, int y, int pow, int ctype) +int make_a_normal_cloud(int x, int y, int pow, int ctype, kill_category whose) { place_cloud( ctype, x, y, - (3 + random2(pow / 4) + random2(pow / 4) + random2(pow / 4)) ); + (3 + random2(pow / 4) + random2(pow / 4) + random2(pow / 4)), + whose ); return 1; } // end make_a_normal_cloud() @@ -2210,7 +2214,7 @@ static int rot_living(int x, int y, int pow, int message) ench = ((random2(pow) + random2(pow) + random2(pow) + random2(pow)) / 4); ench = 1 + (ench >= 20) + (ench >= 35) + (ench >= 50); - menv[mon].add_ench( mon_enchant(ENCH_ROT, ench) ); + menv[mon].add_ench( mon_enchant(ENCH_ROT, ench, KC_YOU) ); return 1; } // end rot_living() @@ -2268,7 +2272,7 @@ static int rot_undead(int x, int y, int pow, int garbage) ench = ((random2(pow) + random2(pow) + random2(pow) + random2(pow)) / 4); ench = 1 + (ench >= 20) + (ench >= 35) + (ench >= 50); - menv[mon].add_ench( mon_enchant(ENCH_ROT, ench) ); + menv[mon].add_ench( mon_enchant(ENCH_ROT, ench, KC_YOU) ); return 1; } // end rot_undead() @@ -2295,7 +2299,7 @@ void do_monster_rot(int mon) if (mons_holiness(&menv[mon]) == MH_UNDEAD && random2(5)) { apply_area_cloud(make_a_normal_cloud, menv[mon].x, menv[mon].y, - 10, 1, CLOUD_MIASMA); + 10, 1, CLOUD_MIASMA, KC_YOU); } player_hurt_monster( mon, damage ); diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h index 29580a7b29..92cc3ae0ae 100644 --- a/crawl-ref/source/spells4.h +++ b/crawl-ref/source/spells4.h @@ -18,7 +18,7 @@ const char *your_hand(bool plural); bool backlight_monsters(int x, int y, int pow, int garbage); -int make_a_normal_cloud(int x, int y, int pow, int ctype); +int make_a_normal_cloud(int x, int y, int pow, int ctype, kill_category); int disperse_monsters(int x, int y, int pow, int message); void cast_bend(int pow); diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index d9c6690a3a..b37d51b5bf 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1123,7 +1123,7 @@ int your_spells( int spc2, int powc, bool allow_fail ) break; case SPELL_FREEZING_CLOUD: - cast_big_c(powc, CLOUD_COLD, beam); + cast_big_c(powc, CLOUD_COLD, KC_YOU, beam); break; case SPELL_MEPHITIC_CLOUD: @@ -1236,7 +1236,7 @@ int your_spells( int spc2, int powc, bool allow_fail ) break; case SPELL_POISONOUS_CLOUD: - cast_big_c(powc, CLOUD_POISON, beam); + cast_big_c(powc, CLOUD_POISON, KC_YOU, beam); break; case SPELL_POISON_ARROW: @@ -2052,7 +2052,8 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true)); mpr(info); - big_cloud( CLOUD_GREY_SMOKE, you.x_pos, you.y_pos, 20, + big_cloud( CLOUD_GREY_SMOKE, KC_YOU, + you.x_pos, you.y_pos, 20, 7 + random2(7) ); break; case 1: @@ -2962,7 +2963,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true) ); mpr(info); - big_cloud( CLOUD_GREY_SMOKE + random2(3), + big_cloud( CLOUD_GREY_SMOKE + random2(3), KC_YOU, you.x_pos, you.y_pos, 20, 7 + random2(7) ); break; @@ -3167,7 +3168,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true)); mpr(info); - big_cloud(CLOUD_COLD, you.x_pos, you.y_pos, 20, + big_cloud(CLOUD_COLD, KC_YOU, you.x_pos, you.y_pos, 20, 8 + random2(4)); break; } @@ -3360,7 +3361,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true)); mpr(info); - big_cloud(CLOUD_STINK, you.x_pos, you.y_pos, 20, + big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, 9 + random2(4)); break; } @@ -3394,7 +3395,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true)); mpr(info); - big_cloud( CLOUD_POISON, you.x_pos, you.y_pos, 20, + big_cloud( CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, 8 + random2(5) ); break; } @@ -3466,7 +3467,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, mpr(info); place_cloud(CLOUD_STINK, you.x_pos, you.y_pos, - 2 + random2(4)); + 2 + random2(4), KC_YOU); break; } break; @@ -3487,7 +3488,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, case 1: mpr("Noxious gasses pour from your hands!"); - big_cloud(CLOUD_STINK, you.x_pos, you.y_pos, 20, + big_cloud(CLOUD_STINK, KC_YOU, you.x_pos, you.y_pos, 20, 8 + random2(5)); break; @@ -3520,7 +3521,7 @@ bool miscast_effect( unsigned int sp_type, int mag_pow, int mag_fail, your_hand(true)); mpr(info); - big_cloud(CLOUD_POISON, you.x_pos, you.y_pos, 20, + big_cloud(CLOUD_POISON, KC_YOU, you.x_pos, you.y_pos, 20, 7 + random2(7)); break; case 2: diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index b490d19294..fc16f70628 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -50,8 +50,9 @@ static int plyrspell_list[NUM_SPELLS]; #define PLYRSPELLDATASIZE (sizeof(spelldata)/sizeof(struct playerspell)) static struct playerspell *seekspell(int spellid); -static bool cloud_helper( int (*func) (int, int, int, int), int x, int y, - int pow, int ctype ); +static bool cloud_helper( int (*func) (int, int, int, int, kill_category), + int x, int y, + int pow, int ctype, kill_category ); /* * BEGIN PUBLIC FUNCTIONS @@ -526,15 +527,16 @@ int apply_area_within_radius( int (*func) (int, int, int, int), // We really need some sort of a queue structure, since ideally I'd like // to do a (shallow) breadth-first-search of the dungeon floor. // This ought to work okay for small clouds. -void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, - int pow, int number, int ctype ) +void apply_area_cloud( int (*func) (int, int, int, int, kill_category), + int x, int y, + int pow, int number, int ctype, kill_category whose ) { int spread, clouds_left = number; int good_squares = 0, neighbours[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; int dx = 1, dy = 1; bool x_first; - if (clouds_left && cloud_helper(func, x, y, pow, ctype)) + if (clouds_left && cloud_helper(func, x, y, pow, ctype, whose)) clouds_left--; if (!clouds_left) @@ -549,28 +551,28 @@ void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, if (x_first) { - if (clouds_left && cloud_helper(func, x + dx, y, pow, ctype)) + if (clouds_left && cloud_helper(func, x + dx, y, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[0]++; } - if (clouds_left && cloud_helper(func, x - dx, y, pow, ctype)) + if (clouds_left && cloud_helper(func, x - dx, y, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[1]++; } - if (clouds_left && cloud_helper(func, x, y + dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x, y + dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[2]++; } - if (clouds_left && cloud_helper(func, x, y - dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x, y - dy, pow, ctype, whose)) { clouds_left--; good_squares++; @@ -579,28 +581,28 @@ void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, } else { - if (clouds_left && cloud_helper(func, x, y + dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x, y + dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[2]++; } - if (clouds_left && cloud_helper(func, x, y - dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x, y - dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[3]++; } - if (clouds_left && cloud_helper(func, x + dx, y, pow, ctype)) + if (clouds_left && cloud_helper(func, x + dx, y, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[0]++; } - if (clouds_left && cloud_helper(func, x - dx, y, pow, ctype)) + if (clouds_left && cloud_helper(func, x - dx, y, pow, ctype, whose)) { clouds_left--; good_squares++; @@ -609,28 +611,28 @@ void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, } // now diagonals; we could randomize dx & dy again here - if (clouds_left && cloud_helper(func, x + dx, y + dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x + dx, y + dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[4]++; } - if (clouds_left && cloud_helper(func, x - dx, y + dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x - dx, y + dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[5]++; } - if (clouds_left && cloud_helper(func, x + dx, y - dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x + dx, y - dy, pow, ctype, whose)) { clouds_left--; good_squares++; neighbours[6]++; } - if (clouds_left && cloud_helper(func, x - dx, y - dy, pow, ctype)) + if (clouds_left && cloud_helper(func, x - dx, y - dy, pow, ctype, whose)) { clouds_left--; good_squares++; @@ -652,28 +654,28 @@ void apply_area_cloud( int (*func) (int, int, int, int), int x, int y, switch (i) { case 0: - apply_area_cloud(func, x + dx, y, pow, spread, ctype); + apply_area_cloud(func, x + dx, y, pow, spread, ctype, whose); break; case 1: - apply_area_cloud(func, x - dx, y, pow, spread, ctype); + apply_area_cloud(func, x - dx, y, pow, spread, ctype, whose); break; case 2: - apply_area_cloud(func, x, y + dy, pow, spread, ctype); + apply_area_cloud(func, x, y + dy, pow, spread, ctype, whose); break; case 3: - apply_area_cloud(func, x, y - dy, pow, spread, ctype); + apply_area_cloud(func, x, y - dy, pow, spread, ctype, whose); break; case 4: - apply_area_cloud(func, x + dx, y + dy, pow, spread, ctype); + apply_area_cloud(func, x + dx, y + dy, pow, spread, ctype, whose); break; case 5: - apply_area_cloud(func, x - dx, y + dy, pow, spread, ctype); + apply_area_cloud(func, x - dx, y + dy, pow, spread, ctype, whose); break; case 6: - apply_area_cloud(func, x + dx, y - dy, pow, spread, ctype); + apply_area_cloud(func, x + dx, y - dy, pow, spread, ctype, whose); break; case 7: - apply_area_cloud(func, x - dx, y - dy, pow, spread, ctype); + apply_area_cloud(func, x - dx, y - dy, pow, spread, ctype, whose); break; } } @@ -818,12 +820,13 @@ static struct playerspell *seekspell(int spell) return (&spelldata[plyrspell_list[spell]]); } -static bool cloud_helper( int (*func) (int, int, int, int), int x, int y, - int pow, int ctype ) +static bool cloud_helper( int (*func) (int, int, int, int, kill_category), + int x, int y, + int pow, int ctype, kill_category whose ) { if (!grid_is_solid(grd[x][y]) && env.cgrid[x][y] == EMPTY_CLOUD) { - func(x, y, pow, ctype); + func(x, y, pow, ctype, whose); return true; } diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 6afb307431..d294fdb9d3 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -88,8 +88,9 @@ char spell_direction( struct dist &spelld, struct bolt &pbolt, int mode = TARG_ENEMY, const char *prompt = NULL ); -void apply_area_cloud(int (*func) (int, int, int, int), int x, int y, - int pow, int number, int ctype); +void apply_area_cloud(int (*func) (int, int, int, int, kill_category), + int x, int y, int pow, int number, int ctype, + kill_category); const char *spelltype_name(unsigned int which_spelltype); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 9b1125d44c..e64d7460d6 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1317,6 +1317,7 @@ static void tag_construct_level(struct tagHeader &th) marshallByte(th, env.cloud[i].y); marshallByte(th, env.cloud[i].type); marshallShort(th, env.cloud[i].decay); + marshallShort(th, env.cloud[i].whose); } // how many shops? @@ -1540,6 +1541,7 @@ static void tag_read_level( struct tagHeader &th, char minorVersion ) env.cloud[i].y = unmarshallByte(th); env.cloud[i].type = unmarshallByte(th); env.cloud[i].decay = unmarshallShort(th); + env.cloud[i].whose = static_cast(unmarshallShort(th)); } // how many shops? diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index e7b444efa1..7542bb1428 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -871,7 +871,6 @@ void cloud_grid(void) switch (env.cloud[s].type) { case CLOUD_FIRE: - case CLOUD_FIRE_MON: if (env.cloud[s].decay <= 20) which_colour = RED; else if (env.cloud[s].decay <= 40) @@ -885,12 +884,10 @@ void cloud_grid(void) break; case CLOUD_STINK: - case CLOUD_STINK_MON: which_colour = GREEN; break; case CLOUD_COLD: - case CLOUD_COLD_MON: if (env.cloud[s].decay <= 20) which_colour = BLUE; else if (env.cloud[s].decay <= 40) @@ -904,24 +901,19 @@ void cloud_grid(void) break; case CLOUD_POISON: - case CLOUD_POISON_MON: which_colour = (one_chance_in(3) ? LIGHTGREEN : GREEN); break; case CLOUD_BLUE_SMOKE: - case CLOUD_BLUE_SMOKE_MON: which_colour = LIGHTBLUE; break; case CLOUD_PURP_SMOKE: - case CLOUD_PURP_SMOKE_MON: which_colour = MAGENTA; break; case CLOUD_MIASMA: - case CLOUD_MIASMA_MON: case CLOUD_BLACK_SMOKE: - case CLOUD_BLACK_SMOKE_MON: which_colour = DARKGREY; break; -- cgit v1.2.3-54-g00ecf