diff options
author | Chris Campbell <chriscampbell89@gmail.com> | 2013-07-16 14:43:33 +0100 |
---|---|---|
committer | Chris Campbell <chriscampbell89@gmail.com> | 2013-07-16 15:05:58 +0100 |
commit | 7d30827743076b487ae6f2e14118f4ee27650183 (patch) | |
tree | 99d81297b8d162c4e827508d2b866f2a285dc5d9 /crawl-ref/source/spl-miscast.cc | |
parent | 0223529bb44bcfc4e784b2143e1f9c0c6a0e141e (diff) | |
download | crawl-ref-7d30827743076b487ae6f2e14118f4ee27650183.tar.gz crawl-ref-7d30827743076b487ae6f2e14118f4ee27650183.zip |
Add wand charge draining as a Zot trap effect
Has a 50% chance to affect each wand carried and drains charges based
on the maximum capacity of the wand (from 1-3 for healing, hasting etc
up to 1-8 for magic darts, confusion etc).
Diffstat (limited to 'crawl-ref/source/spl-miscast.cc')
-rw-r--r-- | crawl-ref/source/spl-miscast.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index c9c9fc862c..25ff7b1209 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -17,9 +17,11 @@ #include "directn.h" #include "effects.h" #include "env.h" +#include "itemprop.h" #include "kills.h" #include "libutil.h" #include "mapmark.h" +#include "message.h" #include "misc.h" #include "mon-place.h" #include "mgen_data.h" @@ -3061,6 +3063,30 @@ void MiscastEffect::_zot() } break; case 11: + { + vector<string> wands; + for (int i = 0; i < ENDOFPACK; ++i) + { + if (!you.inv[i].defined()) + continue; + + if (you.inv[i].base_type == OBJ_WANDS) + { + const int charges = you.inv[i].plus; + if (charges > 0 && coinflip()) + { + you.inv[i].plus -= min(1 + random2(wand_charge_value(you.inv[i].sub_type)), charges); + // Display new number of charges when messaging. + wands.push_back(you.inv[i].name(DESC_PLAIN)); + } + } + } + if (!wands.empty()) + mpr_comma_separated_list("Magical energy is drained from your ", wands); + else + do_msg(); // For canned_msg(MSG_NOTHING_HAPPENS) + break; + } case 12: _lose_stat(STAT_RANDOM, 1 + random2avg((coinflip() ? 7 : 4), 2)); break; |