From 807feb82ade2f6ad782bb6e81c30abfcc0741544 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 11 Oct 2007 19:51:55 +0000 Subject: Fix for 1805138: wands of draining no longer leak information when the bolt misses. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2442 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/items.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crawl-ref/source/items.cc') diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 7e873542d2..1e5d7cb6cc 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -3206,6 +3206,33 @@ bool item_def::launched_by(const item_def &launcher) const return (sub_type == mt || (mt == MI_STONE && sub_type == MI_SLING_BULLET)); } +int item_def::zap() const +{ + if (base_type != OBJ_WANDS) + return ZAP_DEBUGGING_RAY; + + zap_type result; + switch (sub_type) + { + case WAND_ENSLAVEMENT: result = ZAP_ENSLAVEMENT; break; + case WAND_DRAINING: result = ZAP_NEGATIVE_ENERGY; break; + case WAND_DISINTEGRATION: result = ZAP_DISINTEGRATION; break; + + case WAND_RANDOM_EFFECTS: + result = static_cast(random2(16)); + if ( one_chance_in(20) ) + result = ZAP_NEGATIVE_ENERGY; + if ( one_chance_in(17) ) + result = ZAP_ENSLAVEMENT; + break; + + default: + result = static_cast(sub_type); + break; + } + return result; +} + int item_def::index() const { return (this - mitm.buffer()); -- cgit v1.2.3-54-g00ecf