From c1af72fdb75f13811c69666f5a770e6d8fe6ee44 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 29 Jun 2007 15:38:10 +0000 Subject: Steam clouds now do damage proportional to their density (experimental). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1691 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/cloud.cc | 12 ++++++++++++ crawl-ref/source/cloud.h | 1 + crawl-ref/source/misc.cc | 14 ++++++++++++-- crawl-ref/source/monstuff.cc | 12 ++++++++++-- 4 files changed, 35 insertions(+), 4 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 27329fe0c6..c0eacdde5a 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -191,6 +191,18 @@ void check_place_cloud( cloud_type cl_type, int x, int y, int lifetime, place_cloud( cl_type, x, y, lifetime, whose ); } +int steam_cloud_damage(const cloud_struct &cloud) +{ + int decay = cloud.decay; + if (decay > 60) + decay = 60; + else if (decay < 10) + decay = 10; + + // Damage in range 3 - 16. + return ((decay * 13 + 20) / 50); +} + // 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. diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h index e94c7d83b5..be7502d6a0 100644 --- a/crawl-ref/source/cloud.h +++ b/crawl-ref/source/cloud.h @@ -27,5 +27,6 @@ void place_cloud(cloud_type cl_type, int ctarget_x, int ctarget_y, void manage_clouds(void); bool is_opaque_cloud(unsigned char cloud_idx); +int steam_cloud_damage(const cloud_struct &cloud); #endif diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index e526b1d43f..a9feae9cc0 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -437,6 +437,7 @@ void in_a_cloud() break; case CLOUD_STEAM: + { mpr("You are engulfed in a cloud of scalding steam!"); if (player_res_steam() > 0) { @@ -444,13 +445,22 @@ void in_a_cloud() return; } - hurted += (random2(6) * you.time_taken) / 10; - if (hurted < 0 || player_res_fire() > 0) + const int base_dam = steam_cloud_damage(env.cloud[cl]); + hurted += (random2avg(base_dam, 2) * you.time_taken) / 10; + + const int res_fire = player_res_fire(); + if (res_fire < 0) + hurted += (random2(base_dam / 2 + 1) * you.time_taken) / 10; + else if (res_fire) + hurted /= 1 + (res_fire / 2); + + if (hurted < 0) hurted = 0; ouch( (hurted * you.time_taken) / 10, cl, KILLED_BY_CLOUD, "steam" ); break; + } case CLOUD_MIASMA: mpr("You are engulfed in a dark miasma."); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 4ca9b40d29..7a7280f265 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4994,6 +4994,7 @@ static void mons_in_cloud(monsters *monster) break; // to damage routine at end {dlb} case CLOUD_STEAM: + { // couldn't be bothered coding for armour of res fire // what of whether it is wearing steam dragon armour? {dlb} @@ -5005,13 +5006,15 @@ static void mons_in_cloud(monsters *monster) if (mons_res_fire(monster) > 0) return; - hurted += (random2(6) * 10) / speed; + const int steam_base_damage = steam_cloud_damage(env.cloud[wc]); + hurted += (random2avg(steam_base_damage, 2) * 10) / speed; if (mons_res_fire(monster) < 0) - hurted += (random2(6) * 10) / speed; + hurted += (random2(steam_base_damage / 2 + 1) * 10) / speed; hurted -= random2(1 + monster->ac); break; // to damage routine at end {dlb} + } case CLOUD_MIASMA: simple_monster_message(monster, " is engulfed in a dark miasma!"); @@ -5049,6 +5052,11 @@ static void mons_in_cloud(monsters *monster) hurted = 0; else if (hurted > 0) { +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "%s takes %d damage from cloud.", + monster->name(DESC_CAP_THE).c_str(), + hurted); +#endif hurt_monster(monster, hurted); if (monster->hit_points < 1) -- cgit v1.2.3-54-g00ecf