summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/it_use2.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-15 14:39:35 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-15 23:46:45 -0500
commit0da3322c570c3e94859b94fe3bc747c01d1e1364 (patch)
tree88d0cc79fac060d6f02046eab87dece4c9286c8c /crawl-ref/source/it_use2.cc
parent01e5123d492ba9292a52960031c18d8069d25d83 (diff)
downloadcrawl-ref-0da3322c570c3e94859b94fe3bc747c01d1e1364.tar.gz
crawl-ref-0da3322c570c3e94859b94fe3bc747c01d1e1364.zip
On second thought abstract increasing/setting durations a little.
Add (and use) player methods for setting/increasing durations.
Diffstat (limited to 'crawl-ref/source/it_use2.cc')
-rw-r--r--crawl-ref/source/it_use2.cc18
1 files changed, 6 insertions, 12 deletions
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.