From 96075036ffd332c8884992dbe1acf023e5be9a98 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 13 Jul 2008 23:42:21 +0000 Subject: 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 --- crawl-ref/source/effects.cc | 18 ++++++++++++------ 1 file 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( + 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. { -- cgit v1.2.3