summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-15 18:13:28 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-15 23:46:53 -0500
commitec62dd87b6bbe338aa50dc503db2f999c2d352c3 (patch)
treee1e94611c9a702fbadd97e31fc06ffbe628ff82e
parentf77c84bb4c94205933c5a0dc7a7eda82f5460103 (diff)
downloadcrawl-ref-ec62dd87b6bbe338aa50dc503db2f999c2d352c3.tar.gz
crawl-ref-ec62dd87b6bbe338aa50dc503db2f999c2d352c3.zip
Delay changes for corona, berserk, lev, and cfly
-rw-r--r--crawl-ref/source/it_use2.cc10
-rw-r--r--crawl-ref/source/main.cc19
-rw-r--r--crawl-ref/source/player.cc8
-rw-r--r--crawl-ref/source/spells1.cc9
4 files changed, 20 insertions, 26 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 35b0bc49da..c5f4ab302c 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -242,10 +242,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
unmeld_one_equip(EQ_BOOTS);
}
- you.duration[DUR_LEVITATION] += 25 + random2(pow);
-
- if (you.duration[DUR_LEVITATION] > 100)
- you.duration[DUR_LEVITATION] = 100;
+ you.increase_duration(DUR_LEVITATION, 25 + random2(pow), 100);
burden_change();
break;
@@ -736,8 +733,9 @@ void unuse_artefact(const item_def &item, bool *show_msgs)
if (proprt[ARTP_NOISES] != 0)
you.attribute[ATTR_NOISES] = 0;
- if (proprt[ARTP_LEVITATE] != 0 && you.duration[DUR_LEVITATION] > 2
- && !you.permanent_levitation())
+ if (proprt[ARTP_LEVITATE] != 0
+ && you.duration[DUR_LEVITATION] > 2
+ && !you.permanent_levitation())
{
you.duration[DUR_LEVITATION] = 1;
}
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 40b5154ba6..d19c6967eb 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2147,7 +2147,7 @@ static bool _decrement_a_duration(duration_type dur, int delay,
{
if (midmsg)
mpr(midmsg, chan);
- you.duration[dur] -= midloss;
+ you.duration[dur] -= midloss * BASELINE_DELAY;
}
// allow fall-through in case midloss ended the duration (it shouldn't)
@@ -2554,10 +2554,14 @@ static void _decrement_durations()
Options.tutorial_events[TUT_YOU_ENCHANTED] = tut_slow;
}
- if (you.duration[DUR_CORONA] && !--you.duration[DUR_CORONA]
- && !you.backlit())
+ if (you.duration[DUR_CORONA])
{
- mpr("You are no longer glowing.", MSGCH_DURATION);
+ you.duration[DUR_CORONA] -= delay;
+ if (you.duration[DUR_CORONA] < 1)
+ you.duration[DUR_CORONA] = 0;
+
+ if (!you.duration[DUR_CORONA] && !you.backlit())
+ mpr("You are no longer glowing.", MSGCH_DURATION);
}
// Leak piety from the piety pool into actual piety.
@@ -3882,15 +3886,16 @@ static void _do_berserk_no_combat_penalty(void)
// I do these three separately, because the might and
// haste counters can be different.
- you.duration[DUR_BERSERKER] -= you.berserk_penalty;
+ int berserk_delay_penalty = you.berserk_penalty * BASELINE_DELAY;
+ you.duration[DUR_BERSERKER] -= berserk_delay_penalty;
if (you.duration[DUR_BERSERKER] < 1)
you.duration[DUR_BERSERKER] = 1;
- you.duration[DUR_MIGHT] -= you.berserk_penalty;
+ you.duration[DUR_MIGHT] -= berserk_delay_penalty;
if (you.duration[DUR_MIGHT] < 1)
you.duration[DUR_MIGHT] = 1;
- you.duration[DUR_HASTE] -= you.berserk_penalty;
+ you.duration[DUR_HASTE] -= berserk_delay_penalty;
if (you.duration[DUR_HASTE] < 1)
you.duration[DUR_HASTE] = 1;
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 05ccf42770..1fcafdd60f 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6873,17 +6873,13 @@ void player::backlight()
else
mpr("You are outlined in light.");
- this->duration[DUR_CORONA] += random_range(15, 35);
- if (this->duration[DUR_CORONA] > 250)
- this->duration[DUR_CORONA] = 250;
+ you.increase_duration(DUR_CORONA, random_range(15, 35), 250);
}
else
{
mpr("You feel strangely conspicuous.");
- this->duration[DUR_CORONA] += random_range(3, 5);
- if (this->duration[DUR_CORONA] > 250)
- this->duration[DUR_CORONA] = 250;
+ you.increase_duration(DUR_CORONA, random_range(3, 5), 250);
}
}
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 226319fb2b..c571f12e32 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -1453,13 +1453,8 @@ void cast_fly(int power)
const int dur_change = 25 + random2(power) + random2(power);
const bool was_levitating = you.airborne();
- you.duration[DUR_LEVITATION] += dur_change;
- if (you.duration[DUR_LEVITATION] > 100)
- you.duration[DUR_LEVITATION] = 100;
-
- you.duration[DUR_CONTROLLED_FLIGHT] += dur_change;
- if (you.duration[DUR_CONTROLLED_FLIGHT] > 100)
- you.duration[DUR_CONTROLLED_FLIGHT] = 100;
+ you.increase_duration(DUR_LEVITATION, dur_change, 100);
+ you.increase_duration(DUR_CONTROLLED_FLIGHT, dur_change, 100);
burden_change();