summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
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
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')
-rw-r--r--crawl-ref/source/spells4.cc18
-rw-r--r--crawl-ref/source/spells4.h1
-rw-r--r--crawl-ref/source/spl-data.h2
-rw-r--r--crawl-ref/source/spl-util.cc18
4 files changed, 31 insertions, 8 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index fc94aec174..f07710234b 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -2345,19 +2345,23 @@ int cast_apportation(int pow)
return (done);
}
-bool cast_sandblast(int pow, bolt &beam)
+bool wielding_rocks()
{
- bool big = false;
-
+ bool rc = false;
if (you.weapon())
{
const item_def& wpn(*you.weapon());
- big = (wpn.base_type == OBJ_MISSILES
- && (wpn.sub_type == MI_STONE || wpn.sub_type == MI_LARGE_ROCK));
+ rc = (wpn.base_type == OBJ_MISSILES
+ && (wpn.sub_type == MI_STONE || wpn.sub_type == MI_LARGE_ROCK));
}
+ return (rc);
+}
- bool success = zapping(big ? ZAP_SANDBLAST
- : ZAP_SMALL_SANDBLAST, pow, beam, true);
+bool cast_sandblast(int pow, bolt &beam)
+{
+ const bool big = wielding_rocks();
+ const bool success = zapping(big ? ZAP_SANDBLAST
+ : ZAP_SMALL_SANDBLAST, pow, beam, true);
if (big && success)
dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h
index 375b3d6e8a..77cff2ffb3 100644
--- a/crawl-ref/source/spells4.h
+++ b/crawl-ref/source/spells4.h
@@ -41,6 +41,7 @@ void cast_intoxicate(int pow);
void cast_mass_sleep(int pow);
void cast_passwall(int pow);
void cast_rotting(int pow);
+bool wielding_rocks();
bool cast_sandblast(int powc, bolt &beam);
void cast_see_invisible(int pow);
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index 4197057f84..62292a7020 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -2467,7 +2467,7 @@
SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF | SPFLAG_BATTLE,
1,
50,
- 1, 2,
+ 1, 1, // Special-cased!
0,
NULL,
true,
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;