summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-zap.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-03-02 14:16:01 +0100
committerRobert Vollmert <rvollmert@gmx.net>2010-03-02 14:56:49 +0100
commit76809b1cc0fcb9fc4f8217adaa457d1ab6be1a62 (patch)
tree8976e8143a527501d78f2f652c41e6d2a0136794 /crawl-ref/source/spl-zap.cc
parentee5e51cb93c3ffe789aa636f25ebf079cef55a46 (diff)
downloadcrawl-ref-76809b1cc0fcb9fc4f8217adaa457d1ab6be1a62.tar.gz
crawl-ref-76809b1cc0fcb9fc4f8217adaa457d1ab6be1a62.zip
spell_zap_power_cap: Translates zap power cap to spell power.
Diffstat (limited to 'crawl-ref/source/spl-zap.cc')
-rw-r--r--crawl-ref/source/spl-zap.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-zap.cc b/crawl-ref/source/spl-zap.cc
index 496e7f328e..0c9306d316 100644
--- a/crawl-ref/source/spl-zap.cc
+++ b/crawl-ref/source/spl-zap.cc
@@ -2,6 +2,7 @@
#include "spl-zap.h"
+#include "beam.h"
#include "stuff.h"
zap_type spell_to_zap(spell_type spell)
@@ -118,3 +119,23 @@ int spell_zap_power(spell_type spell, int pow)
return (pow);
}
}
+
+int spell_zap_power_cap(spell_type spell)
+{
+ const zap_type zap = spell_to_zap(spell);
+
+ if (zap == NUM_ZAPS)
+ return (0);
+
+ const int cap = zap_power_cap(zap);
+
+ switch (spell)
+ {
+ case SPELL_CORONA:
+ return (std::max<int>(cap - 10, 0));
+ case SPELL_HIBERNATION:
+ return (50);
+ default:
+ return (cap);
+ }
+}