From b0b6e9bc525e05d682f33311086d506b941a0b3f Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Sun, 15 Nov 2009 15:51:32 -0500 Subject: Update delay for mesmerisation, slowing, and haste Also fix a couple compile issues and change over one last case for paralysis --- crawl-ref/source/behold.cc | 10 +++------ crawl-ref/source/godwrath.cc | 6 +++--- crawl-ref/source/it_use3.cc | 4 ++-- crawl-ref/source/main.cc | 11 +++++----- crawl-ref/source/player.cc | 51 ++++++++++++++++++++++---------------------- crawl-ref/source/player.h | 4 ++-- crawl-ref/source/transfor.cc | 4 ++-- 7 files changed, 43 insertions(+), 47 deletions(-) diff --git a/crawl-ref/source/behold.cc b/crawl-ref/source/behold.cc index b4835e3090..263affd500 100644 --- a/crawl-ref/source/behold.cc +++ b/crawl-ref/source/behold.cc @@ -23,21 +23,17 @@ void player::add_beholder(const monsters* mon) { if (!duration[DUR_MESMERISED]) { - duration[DUR_MESMERISED] = 7; + you.set_duration(DUR_MESMERISED, 7, 12); beholders.push_back(mon->mindex()); mprf(MSGCH_WARN, "You are mesmerised by %s!", mon->name(DESC_NOCAP_THE).c_str()); } else { - duration[DUR_MESMERISED] += 5; + you.increase_duration(DUR_MESMERISED, 5, 12); if (!beheld_by(mon)) beholders.push_back(mon->mindex()); - } - - if (duration[DUR_MESMERISED] > 12) - duration[DUR_MESMERISED] = 12; -} + }} // Whether player is mesmerised. bool player::beheld() const diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc index a75f6655df..2cea687761 100644 --- a/crawl-ref/source/godwrath.cc +++ b/crawl-ref/source/godwrath.cc @@ -377,7 +377,7 @@ static bool _cheibriados_retribution() break; case 4: - if (you.duration[DUR_SLOW] < 90) + if (you.duration[DUR_SLOW] < 90 * BASELINE_DELAY) { dec_penance(god, 1); mpr("You feel the world leave you behind!", MSGCH_WARN); @@ -595,7 +595,7 @@ static bool _trog_retribution() case 4: case 5: - if (you.duration[DUR_SLOW] < 90) + if (you.duration[DUR_SLOW] < 90 * BASELINE_DELAY) { dec_penance(god, 1); mpr( "You suddenly feel exhausted!", MSGCH_WARN ); @@ -1186,7 +1186,7 @@ bool divine_retribution(god_type god, bool no_bonus) } else { - if (you.duration[DUR_SLOW] < 90) + if (you.duration[DUR_SLOW] < 90 * BASELINE_DELAY) { mpr( "The divine experience leaves you feeling exhausted!", MSGCH_WARN ); diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index d1bfd030c6..4eef45bc74 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -705,8 +705,8 @@ static bool _ball_of_fixation(void) mpr("You are mesmerised by a rainbow of scintillating colours!"); const int duration = random_range(15, 40); - you.duration[DUR_PARALYSIS] = duration; - you.duration[DUR_SLOW] = duration; + you.set_duration(DUR_PARALYSIS, duration); + you.set_duration(DUR_SLOW, duration); return (true); } diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index a1658e2c06..9e9cc6fb82 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -2435,8 +2435,8 @@ static void _decrement_durations() you.clear_beholders(); } - dec_slow_player(); - dec_haste_player(); + dec_slow_player(delay); + dec_haste_player(delay); if (_decrement_a_duration(DUR_MIGHT, delay, "You feel a little less mighty now.")) @@ -2502,7 +2502,8 @@ static void _decrement_durations() // This resets from an actual penalty or from NO_BERSERK_PENALTY. you.berserk_penalty = 0; - you.increase_duration(DUR_EXHAUSTED, 12 + roll_dice(2,12)); + int dur = 12 + roll_dice(2, 12); + you.increase_duration(DUR_EXHAUSTED, dur); // Don't trigger too many tutorial messages. const bool tut_slow = Options.tutorial_events[TUT_YOU_ENCHANTED]; @@ -2518,9 +2519,9 @@ static void _decrement_durations() { if (wearing_amulet(AMU_RESIST_SLOW)) { - if (you.duration[DUR_HASTE > 6]) + if (you.duration[DUR_HASTE] > 6 * BASELINE_DELAY) { - you.duration[DUR_HASTE] = 2 + coinflip(); + you.set_duration(DUR_HASTE, 2 + coinflip()); mpr("Your extra speed is starting to run out.", MSGCH_DURATION); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 93dfd415b7..7a367af2ad 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4958,7 +4958,7 @@ bool slow_player(int amount) return (false); } - else if (you.duration[DUR_SLOW] >= 100) + else if (you.duration[DUR_SLOW] >= 100 * BASELINE_DELAY) mpr("You already are as slow as you could be."); else { @@ -4967,32 +4967,27 @@ bool slow_player(int amount) else mpr("You feel as though you will be slow longer."); - you.duration[DUR_SLOW] += amount; - - if (you.duration[DUR_SLOW] > 100) - you.duration[DUR_SLOW] = 100; - + you.increase_duration(DUR_SLOW, amount, 100); learned_something_new(TUT_YOU_ENCHANTED); } return (true); } -void dec_slow_player() +void dec_slow_player(int delay) { - if (you.duration[DUR_SLOW] > 1) + if (!you.duration[DUR_SLOW]) + return; + + if (you.duration[DUR_SLOW] > BASELINE_DELAY) { // BCR - Amulet of resist slow affects slow counter. if (wearing_amulet(AMU_RESIST_SLOW)) - { - you.duration[DUR_SLOW] -= 5; - if (you.duration[DUR_SLOW] < 1) - you.duration[DUR_SLOW] = 1; - } + you.duration[DUR_SLOW] -= 5 * delay; else - you.duration[DUR_SLOW]--; + you.duration[DUR_SLOW] -= delay; } - else if (you.duration[DUR_SLOW] == 1) + if (you.duration[DUR_SLOW] <= BASELINE_DELAY) { mpr("You feel yourself speed up.", MSGCH_DURATION); you.duration[DUR_SLOW] = 0; @@ -5018,7 +5013,7 @@ void haste_player(int amount) if (you.duration[DUR_HASTE] == 0) mpr("You feel yourself speed up."); - else if (you.duration[DUR_HASTE] > 80 + 20 * amu_eff) + else if (you.duration[DUR_HASTE] > (80 + 20 * amu_eff) * BASELINE_DELAY) mpr("You already have as much speed as you can handle."); else { @@ -5026,30 +5021,34 @@ void haste_player(int amount) contaminate_player(1, true); // always deliberate } - you.duration[DUR_HASTE] += amount; - - if (you.duration[DUR_HASTE] > 80 + 20 * amu_eff) - you.duration[DUR_HASTE] = 80 + 20 * amu_eff; + you.increase_duration(DUR_HASTE, amount, 80 + 20 * amu_eff); did_god_conduct(DID_STIMULANTS, 4 + random2(4)); } -void dec_haste_player() +void dec_haste_player(int delay) { - if (you.duration[DUR_HASTE] > 1) + if (!you.duration[DUR_HASTE]) + return; + + if (you.duration[DUR_HASTE] > BASELINE_DELAY) { + int old_dur = you.duration[DUR_HASTE]; + // BCR - Amulet of resist slow affects haste counter if (!wearing_amulet(AMU_RESIST_SLOW) || coinflip()) - you.duration[DUR_HASTE]--; + you.duration[DUR_HASTE] -= delay; - if (you.duration[DUR_HASTE] == 6) + int threshold = 6 * BASELINE_DELAY; + // message if we cross the threshold + if (old_dur > threshold && you.duration[DUR_HASTE] <= threshold) { mpr("Your extra speed is starting to run out.", MSGCH_DURATION); if (coinflip()) - you.duration[DUR_HASTE]--; + you.duration[DUR_HASTE] -= BASELINE_DELAY; } } - else if (you.duration[DUR_HASTE] == 1) + else if (you.duration[DUR_HASTE] <= BASELINE_DELAY) { mpr("You feel yourself slow down.", MSGCH_DURATION); you.duration[DUR_HASTE] = 0; diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 79ed2c1ed2..9d7d09cc3a 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -751,10 +751,10 @@ bool napalm_player(int amount); void dec_napalm_player(int delay); bool slow_player(int amount); -void dec_slow_player(); +void dec_slow_player(int delay); void haste_player(int amount); -void dec_haste_player(); +void dec_haste_player(int delay); bool disease_player(int amount); void dec_disease_player(); diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 762c3e00c8..f0f6380b43 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -720,8 +720,8 @@ bool transform(int pow, transformation_type which_trans, bool force, if (which_trans == TRAN_PIG) { // no easy way around this! mpr("A dreadful feeling locks you in place!"); - if (you.duration[DUR_PARALYSIS]<10 * BASELINE_DURATION) - you.duration[DUR_PARALYSIS]=10 * BASELINE_DURATION; + if (you.duration[DUR_PARALYSIS]<10 * BASELINE_DELAY) + you.duration[DUR_PARALYSIS]=10 * BASELINE_DELAY; } return (_abort_or_fizzle(just_check)); } -- cgit v1.2.3-54-g00ecf