From e1c9271f4623d22d671c3fdd762eefd7ee5e4cf0 Mon Sep 17 00:00:00 2001 From: Vsevolod Kozlov Date: Thu, 5 Nov 2009 22:57:18 +1000 Subject: Move player_res_asphyx/rotting to player::res_asphyx/rotting. Signed-off-by: Jude Brown --- crawl-ref/source/beam.cc | 2 +- crawl-ref/source/cloud.cc | 6 ++--- crawl-ref/source/ouch.cc | 2 +- crawl-ref/source/player.cc | 65 ++++++++++++++++++---------------------------- crawl-ref/source/player.h | 3 --- 5 files changed, 30 insertions(+), 48 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 5bd71a2898..d0dd576d5c 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3483,7 +3483,7 @@ bool bolt::harmless_to_player() const return (player_res_steam(false) >= 3); case BEAM_MIASMA: - return (player_res_rotting()); + return (you.res_rotting()); case BEAM_NEG: return (player_prot_life(false) >= 3); diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 52df81690c..c6b1b5aa09 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -585,7 +585,7 @@ int max_cloud_damage(cloud_type cl_type, int power) } case CLOUD_MIASMA: - if (player_res_rotting()) + if (you.res_rotting()) return (0); dam += 11 * speed / 10; @@ -746,7 +746,7 @@ void in_a_cloud() case CLOUD_MIASMA: mpr("You are engulfed in a dark miasma."); - if (player_res_rotting()) + if (you.res_rotting()) return; miasma_player(); @@ -811,7 +811,7 @@ bool is_damaging_cloud(cloud_type type, bool temp) case CLOUD_STEAM: return (player_res_steam(false, temp) <= 0); case CLOUD_MIASMA: - return (player_res_rotting()); + return (you.res_rotting()); case CLOUD_MUTAGENIC: return (you.can_mutate()); diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 604c2b971a..6eecfaacac 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -217,7 +217,7 @@ int check_your_resists(int hurted, beam_type flavour) break; case BEAM_MIASMA: - if (player_res_rotting()) + if (you.res_rotting()) { canned_msg(MSG_YOU_RESIST); hurted = 0; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 14354ae205..9498163b24 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1614,39 +1614,6 @@ int player_res_poison(bool calc_unid, bool temp, bool items) return (rp); } -int player_res_rotting() -{ - if (you.is_undead - && (you.is_undead != US_SEMI_UNDEAD || you.hunger_state < HS_SATIATED)) - { - return (1); - } - - return (0); -} - -int player_res_asphyx() -{ - int ra = 0; - - // The undead are immune to asphyxiation, or so we'll assume. - if (you.is_undead) - ra++; - - switch (you.attribute[ATTR_TRANSFORMATION]) - { - case TRAN_LICH: - case TRAN_STATUE: - ra++; - break; - } - - if (ra > 1) - ra = 1; - - return (ra); -} - int player_res_sticky_flame(bool calc_unid, bool temp, bool items) { int rsf = 0; @@ -5122,7 +5089,7 @@ bool curare_hits_player(int death_source, int amount) int hurted = 0; - if (player_res_asphyx() <= 0) + if (you.res_asphyx() <= 0) { hurted = roll_dice(2, 6); @@ -5232,7 +5199,7 @@ bool miasma_player() { ASSERT(!crawl_state.arena); - if (player_res_rotting()) + if (you.res_rotting()) return (false); bool success = poison_player(1); @@ -5473,7 +5440,7 @@ bool rot_player(int amount) if (amount <= 0) return (false); - if (player_res_rotting()) + if (you.res_rotting()) { mpr("You feel terrible."); return (false); @@ -6705,7 +6672,19 @@ int player::res_elec() const int player::res_asphyx() const { - return (player_res_asphyx()); + // The undead are immune to asphyxiation, or so we'll assume. + if (this->is_undead) + return 1; + + switch (this->attribute[ATTR_TRANSFORMATION]) + { + case TRAN_LICH: + case TRAN_STATUE: + return 1; + break; + } + + return 0; } int player::res_poison() const @@ -6715,7 +6694,13 @@ int player::res_poison() const int player::res_rotting() const { - return (player_res_rotting()); + if (this->is_undead + && (this->is_undead != US_SEMI_UNDEAD || this->hunger_state < HS_SATIATED)) + { + return (1); + } + + return (0); } int player::res_sticky_flame() const @@ -6968,7 +6953,7 @@ void player::drain_stat(int stat, int amount, actor *attacker) bool player::rot(actor *who, int amount, int immediate, bool quiet) { - if (player_res_rotting() || amount <= 0) + if (you.res_rotting() || amount <= 0) return (false); if (immediate > 0) @@ -7072,7 +7057,7 @@ bool player::sicken(int amount) { ASSERT(!crawl_state.arena); - if (player_res_rotting() || amount <= 0) + if (you.res_rotting() || amount <= 0) return (false); mpr( "You feel ill." ); diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 1228ed8002..c8a095d727 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -605,13 +605,10 @@ int player_res_steam(bool calc_unid = true, bool temp = true, int player_res_poison(bool calc_unid = true, bool temp = true, bool items = true); -int player_res_rotting(); bool player_control_teleport(bool calc_unid = true, bool temp = true, bool items = true); -int player_res_asphyx(); - int player_shield_class(void); -- cgit v1.2.3-54-g00ecf