From 356d2e3e4b9ce53e0b205ff6fd5b35a4163a0cc5 Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 7 Nov 2008 21:39:26 +0000 Subject: Clean up sticky flame handling. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7409 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 8e8f8e8ae7..5ce17d6463 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5077,6 +5077,61 @@ void reduce_poison_player(int amount) mpr("You feel a little better.", MSGCH_RECOVERY); } +bool napalm_player(int amount) +{ + if (player_res_sticky_flame() || amount <= 0) + return (false); + + const int old_value = you.duration[DUR_LIQUID_FLAMES]; + you.duration[DUR_LIQUID_FLAMES] += amount; + + if (you.duration[DUR_LIQUID_FLAMES] > 40) + you.duration[DUR_LIQUID_FLAMES] = 40; + + if (you.duration[DUR_LIQUID_FLAMES] > old_value) + mpr("You are covered in liquid flames!", MSGCH_WARN); + + return (true); +} + +void dec_napalm_player() +{ + if (you.duration[DUR_LIQUID_FLAMES] > 1) + { + you.duration[DUR_LIQUID_FLAMES]--; + + mpr("You are covered in liquid flames!", MSGCH_WARN); + + expose_player_to_element(BEAM_NAPALM, 12); + + const int res_fire = player_res_fire(); + + if (res_fire > 0) + { + ouch((((random2avg(9, 2) + 1) * you.time_taken) / + (1 + (res_fire * res_fire))) / 10, NON_MONSTER, + KILLED_BY_BURNING); + } + + if (res_fire <= 0) + { + ouch(((random2avg(9, 2) + 1) * you.time_taken) / 10, 0, + KILLED_BY_BURNING); + } + + if (res_fire < 0) + { + ouch(((random2avg(9, 2) + 1) * you.time_taken) / 10, 0, + KILLED_BY_BURNING); + } + + if (you.duration[DUR_CONDENSATION_SHIELD] > 0) + remove_condensation_shield(); + } + else if (you.duration[DUR_LIQUID_FLAMES] == 1) + you.duration[DUR_LIQUID_FLAMES] = 0; +} + bool confuse_player(int amount, bool resistable) { if (amount <= 0) -- cgit v1.2.3-54-g00ecf