From 614cdcf0426223561bf7a58ebb999e47c366fe82 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 16 Aug 2009 17:24:46 +0000 Subject: As per FR 2795134, nerf damage reduction of elemental resistances. Damage is now reduced to 50% (level 1, unchanged), 33% (level 2, was 20%), and 20% (level 3, was 10%), respectively. This only applies to players, monster resists are unchanged. The purpose of this change is to make the mid and late game harder without unduly affecting the early game. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10554 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/cloud.cc | 19 +++++++++++++++---- crawl-ref/source/cloud.h | 1 + crawl-ref/source/fight.cc | 22 ++++++++++++++-------- crawl-ref/source/player.cc | 10 +++++----- 4 files changed, 35 insertions(+), 17 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index bbbaca890a..6f045249a2 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -237,7 +237,7 @@ int steam_cloud_damage(const cloud_struct &cloud) { return steam_cloud_damage(cloud.decay); } - + int steam_cloud_damage(int decay) { decay = std::min(decay, 60); @@ -433,6 +433,17 @@ beam_type cloud2beam(cloud_type flavour) } } +// Returns by how much damage gets divided due to elemental resistances. +// Damage is reduced to, level 1 -> 1/2, level 2 -> 1/3, level 3 -> 1/5, or +// for "boolean" attacks (which use bonus_res = 1, sticky flame/electricity) +// to level 1 -> 1/3, level 2 -> 1/4, or level 3 -> 1/6. +// With the old formula (1 + resist * resist) this used to be +// 1/2, 1/5, 1/10 (normal) and 1/3, 1/6, 1/11 (boolean), respectively. +int resist_fraction(int resist, int bonus_res) +{ + return ((3*resist + 1)/2 + bonus_res); +} + // NOTE: Keep in sync with in_a_cloud() int max_cloud_damage(cloud_type cl_type, int power) { @@ -462,7 +473,7 @@ int max_cloud_damage(cloud_type cl_type, int power) else { dam += 32 * speed / 10; - dam /= (1 + resist * resist); + dam /= resist_fraction(resist); } break; @@ -554,7 +565,7 @@ void in_a_cloud() { canned_msg(MSG_YOU_RESIST); hurted += ((random2avg(23, 3) + 10) * you.time_taken) / 10; - hurted /= (1 + resist * resist); + hurted /= resist_fraction(resist); ouch(hurted, cl, KILLED_BY_CLOUD, "flame"); } expose_player_to_element(BEAM_FIRE, 7); @@ -602,7 +613,7 @@ void in_a_cloud() { canned_msg(MSG_YOU_RESIST); hurted += ((random2avg(23, 3) + 10) * you.time_taken) / 10; - hurted /= (1 + resist * resist); + hurted /= resist_fraction(resist); ouch(hurted, cl, KILLED_BY_CLOUD, "freezing vapour"); } expose_player_to_element(BEAM_COLD, 7); diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h index 240ef74e77..9736788dbf 100644 --- a/crawl-ref/source/cloud.h +++ b/crawl-ref/source/cloud.h @@ -60,6 +60,7 @@ int steam_cloud_damage(int decay); cloud_type beam2cloud(beam_type flavour); beam_type cloud2beam(cloud_type flavour); +int resist_fraction(int resist, int bonus_res = 0); int max_cloud_damage(cloud_type cl_type, int power = -1); void in_a_cloud(void); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 2ced048a7c..af7c6e1979 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2045,10 +2045,6 @@ int resist_adjust_damage(actor *defender, beam_type flavour, const bool monster = (defender->atype() == ACT_MONSTER); - // Check if this is a resist that pretends to be boolean for damage - // purposes. Only electricity and sticky flame (napalm) do this at - // the moment; raw poison damage uses the normal formula. - int res_base = (is_boolean_resist(flavour) ? 2 : 1); const int resistible_fraction = get_resistible_fraction(flavour); int resistible = rawdamage * resistible_fraction / 100; @@ -2059,7 +2055,19 @@ int resist_adjust_damage(actor *defender, beam_type flavour, if (monster && res >= 3) resistible = 0; else - resistible /= res_base + res * res; + { + // Check if this is a resist that pretends to be boolean for damage + // purposes. Only electricity and sticky flame (napalm) do this at + // the moment; raw poison damage uses the normal formula. + const int bonus_res = (is_boolean_resist(flavour) ? 1 : 0); + + // Use a new formula for players, but keep the old, more effective + // for monsters. + if (monster) + resistible /= 1 + bonus_res + res * res; + else + resistible /= resist_fraction(res, bonus_res); + } } else if (res < 0) resistible = resistible * (ranged? 15 : 20) / 10; @@ -3033,9 +3041,7 @@ bool melee_attack::apply_damage_brand() break; case SPWPN_ELECTROCUTION: - if (defender->airborne()) - break; - else if (defender->res_elec() > 0) + if (defender->airborne() || defender->res_elec() > 0) break; else if (one_chance_in(3)) { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 9a535d5f7d..fb0059a963 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5527,12 +5527,12 @@ void dec_napalm_player() { ouch(((random2avg(9, 2) + 1) * you.time_taken) / 10, NON_MONSTER, KILLED_BY_BURNING); - } - if (res_fire < 0) - { - ouch(((random2avg(9, 2) + 1) * you.time_taken) / 10, - NON_MONSTER, KILLED_BY_BURNING); + if (res_fire < 0) + { + ouch(((random2avg(9, 2) + 1) * you.time_taken) / 10, + NON_MONSTER, KILLED_BY_BURNING); + } } if (you.duration[DUR_CONDENSATION_SHIELD] > 0) -- cgit v1.2.3-54-g00ecf