diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-08 15:27:59 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-08 15:27:59 +0000 |
commit | 00917879eac80b1df1bde701ab221e3f7fdd946c (patch) | |
tree | fa61266d39b02cf24128da8d758c0f88a2888458 /crawl-ref/source/spells2.cc | |
parent | 73a79a3d492e24d7cc922f791326b66c47c6bc71 (diff) | |
download | crawl-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
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 50 |
1 files changed, 50 insertions, 0 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) |