summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-util.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-18 20:03:51 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-18 20:10:19 -0800
commit708e779998c00f04e30bdf2c00d1ff65b3fd1e00 (patch)
treedaf9a7d3b09f43cd17d04c4d12410ff1ed299f5c /crawl-ref/source/spl-util.cc
parent070c36855d0109c01e85301ac28d95873a291632 (diff)
downloadcrawl-ref-708e779998c00f04e30bdf2c00d1ff65b3fd1e00.tar.gz
crawl-ref-708e779998c00f04e30bdf2c00d1ff65b3fd1e00.zip
zap_type_to_spell(): get spell which causes zap
Go backwards from a zap_type to the spell which caused it (or would have caused it if it were a spell). Currently only handles zap types which wands use.
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r--crawl-ref/source/spl-util.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 0ec85d0015..df4c49bbd8 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -973,3 +973,51 @@ int spell_noise(unsigned int disciplines, int level)
else
return div_round_up(level, 2);
}
+
+spell_type zap_type_to_spell(zap_type zap)
+{
+ switch(zap)
+ {
+ case ZAP_FLAME:
+ return(SPELL_THROW_FLAME);
+ case ZAP_FROST:
+ return(SPELL_THROW_FROST);
+ case ZAP_SLOWING:
+ return(SPELL_SLOW);
+ case ZAP_HASTING:
+ return(SPELL_HASTE);
+ case ZAP_MAGIC_DARTS:
+ return(SPELL_MAGIC_DART);
+ case ZAP_HEALING:
+ return(SPELL_MAJOR_HEALING);
+ case ZAP_PARALYSIS:
+ return(SPELL_PARALYSE);
+ case ZAP_FIRE:
+ return(SPELL_BOLT_OF_FIRE);
+ case ZAP_COLD:
+ return(SPELL_BOLT_OF_COLD);
+ case ZAP_CONFUSION:
+ return(SPELL_CONFUSE);
+ case ZAP_INVISIBILITY:
+ return(SPELL_INVISIBILITY);
+ case ZAP_DIGGING:
+ return(SPELL_DIG);
+ case ZAP_FIREBALL:
+ return(SPELL_FIREBALL);
+ case ZAP_TELEPORTATION:
+ return(SPELL_TELEPORT_OTHER);
+ case ZAP_LIGHTNING:
+ return(SPELL_LIGHTNING_BOLT);
+ case ZAP_POLYMORPH_OTHER:
+ return(SPELL_POLYMORPH_OTHER);
+ case ZAP_NEGATIVE_ENERGY:
+ return(SPELL_BOLT_OF_DRAINING);
+ case ZAP_ENSLAVEMENT:
+ return(SPELL_ENSLAVEMENT);
+ case ZAP_DISINTEGRATION:
+ return(SPELL_DISINTEGRATE);
+ default:
+ DEBUGSTR("zap_type_to_spell() only handles wand zaps for now");
+ }
+ return SPELL_NO_SPELL;
+}