summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 10:13:51 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 10:13:51 +0000
commitcd08ab62d681ee480339a2f26d833bf9d4104dda (patch)
tree0ea72e62d6fa7f5d30c0b827150821d79946971f /crawl-ref/source/items.cc
parentff184229db597309592f1efc2ff089fa1b79418a (diff)
downloadcrawl-ref-cd08ab62d681ee480339a2f26d833bf9d4104dda.tar.gz
crawl-ref-cd08ab62d681ee480339a2f26d833bf9d4104dda.zip
Decouple zap_type from wand_type prepatory to a big beam() rewrite.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7200 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc37
1 files changed, 25 insertions, 12 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 992bb6a5ad..8475a11b17 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2475,29 +2475,42 @@ 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
+zap_type 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;
-
+ zap_type result = ZAP_DEBUGGING_RAY;
+ switch (static_cast<wand_type>(sub_type))
+ {
+ case WAND_FLAME: result = ZAP_FLAME; break;
+ case WAND_FROST: result = ZAP_FROST; break;
+ case WAND_SLOWING: result = ZAP_SLOWING; break;
+ case WAND_HASTING: result = ZAP_HASTING; break;
+ case WAND_MAGIC_DARTS: result = ZAP_MAGIC_DARTS; break;
+ case WAND_HEALING: result = ZAP_HEALING; break;
+ case WAND_PARALYSIS: result = ZAP_PARALYSIS; break;
+ case WAND_FIRE: result = ZAP_FIRE; break;
+ case WAND_COLD: result = ZAP_COLD; break;
+ case WAND_CONFUSION: result = ZAP_CONFUSION; break;
+ case WAND_INVISIBILITY: result = ZAP_INVISIBILITY; break;
+ case WAND_DIGGING: result = ZAP_DIGGING; break;
+ case WAND_FIREBALL: result = ZAP_FIREBALL; break;
+ case WAND_TELEPORTATION: result = ZAP_TELEPORTATION; break;
+ case WAND_LIGHTNING: result = ZAP_LIGHTNING; break;
+ case WAND_POLYMORPH_OTHER: result = ZAP_POLYMORPH_OTHER; break;
+ 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<zap_type>(random2(16));
+ result = static_cast<zap_type>(random2(ZAP_LAST_RANDOM + 1));
if (one_chance_in(20))
result = ZAP_NEGATIVE_ENERGY;
if (one_chance_in(17))
result = ZAP_ENSLAVEMENT;
break;
- default:
- result = static_cast<zap_type>(sub_type);
- break;
+ case NUM_WANDS: break;
}
return (result);
}