summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 15:27:59 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 15:27:59 +0000
commit00917879eac80b1df1bde701ab221e3f7fdd946c (patch)
treefa61266d39b02cf24128da8d758c0f88a2888458
parent73a79a3d492e24d7cc922f791326b66c47c6bc71 (diff)
downloadcrawl-ref-00917879eac80b1df1bde701ab221e3f7fdd946c.tar.gz
crawl-ref-00917879eac80b1df1bde701ab221e3f7fdd946c.zip
Clean up "Conjure Ball Lightning".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5592 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/spells2.cc50
-rw-r--r--crawl-ref/source/spells2.h2
-rw-r--r--crawl-ref/source/spells4.cc49
-rw-r--r--crawl-ref/source/spells4.h1
-rw-r--r--crawl-ref/source/spl-cast.cc8
5 files changed, 56 insertions, 54 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 79f433a300..877ebf1bf3 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -2289,6 +2289,56 @@ bool cast_summon_dragon(int pow, bool god_gift)
return (success);
}
+bool cast_conjure_ball_lightning(int pow, bool god_gift)
+{
+ bool success = false;
+
+ // Restricted so that the situation doesn't get too gross. Each of
+ // these will explode for 3d20 damage. -- bwr
+ const int how_many = std::min(8, 3 + random2(2 + pow / 50));
+
+ for (int i = 0; i < how_many; ++i)
+ {
+ int tx = -1, ty = -1;
+
+ for (int j = 0; j < 10; ++j)
+ {
+ if (!random_near_space(you.x_pos, you.y_pos, tx, ty, true, true)
+ && distance(you.x_pos, you.y_pos, tx, ty) <= 5)
+ {
+ break;
+ }
+ }
+
+ // If we fail, we'll try the ol' summon next to player trick.
+ if (tx == -1 || ty == -1)
+ {
+ tx = you.x_pos;
+ ty = you.y_pos;
+ }
+
+ int monster =
+ mons_place(
+ mgen_data(MONS_BALL_LIGHTNING, BEH_FRIENDLY, 0,
+ coord_def(tx, ty), MHITNOT,
+ god_gift ? MF_GOD_GIFT : 0));
+
+ if (monster != -1)
+ {
+ success = true;
+
+ menv[monster].add_ench(ENCH_SHORT_LIVED);
+ }
+ }
+
+ if (success)
+ mpr("You create some ball lightning!");
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
// Makhleb or Kikubaaqudgha sends a demonic buddy (or enemy) for a
// follower.
bool summon_demon_type(monster_type mon, int pow, bool god_gift)
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 6c24936a77..43f2736d8e 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -178,6 +178,8 @@ bool summon_horrible_things(int pow, bool god_gift = false);
bool cast_summon_dragon(int pow, bool god_gift = false);
+bool cast_conjure_ball_lightning(int pow, bool god_gift = false);
+
bool summon_demon_type(monster_type mon, int pow, bool god_gift = false);
bool summon_berserker(int pow, bool god_gift = false,
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 83ebc0dde3..3e57abd743 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -413,55 +413,6 @@ void cast_detect_secret_doors(int pow)
mprf("You detect %s", (found > 0) ? "secret doors!" : "nothing.");
} // end cast_detect_secret_doors()
-void cast_conjure_ball_lightning( int pow )
-{
- int num = 3 + random2( 2 + pow / 50 );
-
- // but restricted so that the situation doesn't get too gross.
- // Each of these will explode for 3d20 damage. -- bwr
- if (num > 8)
- num = 8;
-
- bool summoned = false;
-
- for (int i = 0; i < num; i++)
- {
- int tx = -1, ty = -1;
-
- for (int j = 0; j < 10; j++)
- {
- if (!random_near_space( you.x_pos, you.y_pos, tx, ty, true, true)
- && distance( you.x_pos, you.y_pos, tx, ty ) <= 5)
- {
- break;
- }
- }
-
- // if we fail, we'll try the ol' summon next to player trick.
- if (tx == -1 || ty == -1)
- {
- tx = you.x_pos;
- ty = you.y_pos;
- }
-
- int mon =
- mons_place(
- mgen_data( MONS_BALL_LIGHTNING, BEH_FRIENDLY, 0,
- coord_def(tx, ty) ));
-
- if (mon != -1)
- {
- menv[mon].add_ench(ENCH_SHORT_LIVED);
- summoned = true;
- }
- }
-
- if (summoned)
- mpr( "You create some ball lightning!" );
- else
- canned_msg( MSG_NOTHING_HAPPENS );
-}
-
static int sleep_monsters(int x, int y, int pow, int garbage)
{
UNUSED( garbage );
diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h
index 8749dcb465..1272857433 100644
--- a/crawl-ref/source/spells4.h
+++ b/crawl-ref/source/spells4.h
@@ -48,7 +48,6 @@ void cast_see_invisible(int pow);
void cast_shatter(int pow);
void cast_silence(int pow);
void cast_chain_lightning( int pow );
-void cast_conjure_ball_lightning(int pow);
void cast_tame_beasts(int pow);
void cast_dispersal(int pow);
void cast_snake_charm(int pow);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index a7a480015d..d836d841da 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1536,6 +1536,10 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
cast_summon_dragon(powc);
break;
+ case SPELL_CONJURE_BALL_LIGHTNING:
+ cast_conjure_ball_lightning(powc);
+ break;
+
case SPELL_OZOCUBUS_ARMOUR:
ice_armour(powc, false);
break;
@@ -1977,10 +1981,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
simulacrum(powc);
break;
- case SPELL_CONJURE_BALL_LIGHTNING:
- cast_conjure_ball_lightning(powc);
- break;
-
case SPELL_CHAIN_LIGHTNING:
cast_chain_lightning(powc);
break;