summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-util.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-01 13:29:00 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-01 13:29:00 +0000
commit4c3ded9257ea0dd6ed298b77754d308b043683be (patch)
tree6c58ce53f5266e442a1da60a66e5c530ce03e044 /crawl-ref/source/spl-util.cc
parent06a2793826dbd7910ee0423a2f0f248826091243 (diff)
downloadcrawl-ref-4c3ded9257ea0dd6ed298b77754d308b043683be.tar.gz
crawl-ref-4c3ded9257ea0dd6ed298b77754d308b043683be.zip
Sandblast now has a range of 1 when not wielding rocks, and a range of 1-2
(50% each) when wielding rocks. Fixes [2364044]. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8079 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r--crawl-ref/source/spl-util.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index a267e3805a..7db3419cf3 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -29,6 +29,7 @@
#include "monstuff.h"
#include "notes.h"
#include "player.h"
+#include "spells4.h"
#include "spl-book.h"
#include "spl-cast.h"
#include "spl-util.h"
@@ -958,12 +959,29 @@ int spell_power_cap(spell_type spell)
return (_seekspell(spell)->power_cap);
}
+// Sandblast range is 1 if not wielding rocks, 1-2 if you are.
+// For targetting purposes, of course, be optimistic about range.
+static int _sandblast_range(int pow, bool real_cast)
+{
+ int res = 1;
+
+ if (wielding_rocks() && (!real_cast || coinflip()))
+ res = 2;
+
+ return (res);
+}
+
+
int spell_range(spell_type spell, int pow, bool real_cast)
{
const int minrange = _seekspell(spell)->min_range;
const int maxrange = _seekspell(spell)->max_range;
ASSERT(maxrange >= minrange);
+ // Some cases need to be handled specially.
+ if (spell == SPELL_SANDBLAST)
+ return _sandblast_range(pow, real_cast);
+
if (minrange == maxrange)
return minrange;