summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-13 23:42:21 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-13 23:42:21 +0000
commit96075036ffd332c8884992dbe1acf023e5be9a98 (patch)
tree39c9691c4da02853f8a9dff4ed789bd48ccf66c6
parentb007660f895a7627976888f784a0525be056a213 (diff)
downloadcrawl-ref-96075036ffd332c8884992dbe1acf023e5be9a98.tar.gz
crawl-ref-96075036ffd332c8884992dbe1acf023e5be9a98.zip
Apply Darshan's charging fix (r6528).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6541 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/effects.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 86ac9c40d9..4ad8841591 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1819,12 +1819,18 @@ bool recharge_wand(int item_slot)
// Don't display zap counts any more.
wand.plus2 = ZAPCOUNT_UNKNOWN;
- mprf("%s glows for a moment.", wand.name(DESC_CAP_YOUR).c_str());
-
- wand.plus += 1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 );
-
- if (wand.plus > charge_gain * 3)
- wand.plus = charge_gain * 3;
+ const int new_charges =
+ std::max<int>(
+ wand.plus,
+ std::min(charge_gain * 3,
+ wand.plus +
+ 1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 )));
+
+ const bool charged = new_charges > wand.plus;
+ mprf("%s %s for a moment.",
+ wand.name(DESC_CAP_YOUR).c_str(),
+ charged? "glows" : "flickers");
+ wand.plus = new_charges;
}
else // It's a rod.
{