diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-13 19:26:17 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-13 19:26:17 +0000 |
commit | 3d4a6ad0b4146eb7a4540cc66474efceadbf9c12 (patch) | |
tree | 81d60d4d94cb980ca42f75c914001c86ee88001d /crawl-ref/source/effects.cc | |
parent | 040426a120078119455320d4a9e8528191b4a1a0 (diff) | |
download | crawl-ref-3d4a6ad0b4146eb7a4540cc66474efceadbf9c12.tar.gz crawl-ref-3d4a6ad0b4146eb7a4540cc66474efceadbf9c12.zip |
Fixed wands with many charges losing charges on recharge attempt.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6528 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r-- | crawl-ref/source/effects.cc | 18 |
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. { |