From 0da3322c570c3e94859b94fe3bc747c01d1e1364 Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Sun, 15 Nov 2009 14:39:35 -0500 Subject: On second thought abstract increasing/setting durations a little. Add (and use) player methods for setting/increasing durations. --- crawl-ref/source/it_use2.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'crawl-ref/source/it_use2.cc') diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 547b418c3a..a9c630671c 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -328,12 +328,10 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) // Now multiple invisiblity casts aren't as good. -- bwr if (!you.duration[DUR_INVIS]) - you.duration[DUR_INVIS] = (15 + random2(pow)) * BASELINE_DELAY; + you.set_duration(DUR_INVIS, 15 + random2(pow), 100); else - you.duration[DUR_INVIS] += random2(pow) * BASELINE_DELAY; + you.increase_duration(DUR_INVIS, random2(pow), 100); - if (you.duration[DUR_INVIS] > 100 * BASELINE_DELAY) - you.duration[DUR_INVIS] = 100 * BASELINE_DELAY; break; case POT_PORRIDGE: // oatmeal - always gluggy white/grey? @@ -445,14 +443,10 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) case POT_RESISTANCE: mpr("You feel protected.", MSGCH_DURATION); - you.duration[DUR_RESIST_FIRE] += - (random2(pow) + 35) * BASELINE_DELAY / factor; - you.duration[DUR_RESIST_COLD] += - (random2(pow) + 35) * BASELINE_DELAY / factor; - you.duration[DUR_RESIST_POISON] += - (random2(pow) + 35) * BASELINE_DELAY / factor; - you.duration[DUR_INSULATION] += - (random2(pow) + 35) * BASELINE_DELAY/ factor; + you.increase_duration(DUR_RESIST_FIRE, (random2(pow) + 35) / factor); + you.increase_duration(DUR_RESIST_COLD, (random2(pow) + 35) / factor); + you.increase_duration(DUR_RESIST_POISON, (random2(pow) + 35) / factor); + you.increase_duration(DUR_INSULATION, (random2(pow) + 35) / factor); // Just one point of contamination. These potions are really rare, // and contamination is nastier. -- cgit v1.2.3-54-g00ecf