summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-clouds.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-02-24 21:55:17 -0700
committerSteve Melenchuk <smelenchuk@gmail.com>2014-02-26 21:19:58 -0700
commit75deb85f6e81443628063de806a368df0c3b08a3 (patch)
treef273b4bd7fa2f970aa3803621bc477befcbf7cc9 /crawl-ref/source/spl-clouds.cc
parent677420826d3fc95192aa22869fe859f2093952cc (diff)
downloadcrawl-ref-75deb85f6e81443628063de806a368df0c3b08a3.tar.gz
crawl-ref-75deb85f6e81443628063de806a368df0c3b08a3.zip
Rod of frigid destruction -> Rod of clouds.
Sprays clouds over a cone-shaped area in front of the caster. At low power it gives rain, mist, or noxious fumes; mid-tier gives flames, freezing vapour, or poison gas; high-tier gives one of three new cloud types - acidic fog, negative energy, or storm clouds. The targeter is from an experimental implementation of a spell called "Scattershot", hence the name and some of the functionality it provides which goes unused here.
Diffstat (limited to 'crawl-ref/source/spl-clouds.cc')
-rw-r--r--crawl-ref/source/spl-clouds.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-clouds.cc b/crawl-ref/source/spl-clouds.cc
index b99ff49423..dca58e9652 100644
--- a/crawl-ref/source/spl-clouds.cc
+++ b/crawl-ref/source/spl-clouds.cc
@@ -26,8 +26,10 @@
#include "mon-util.h"
#include "ouch.h"
#include "player.h"
+#include "random-pick.h"
#include "spl-util.h"
#include "stuff.h"
+#include "target.h"
#include "terrain.h"
#include "transform.h"
#include "viewchar.h"
@@ -496,3 +498,53 @@ void apply_control_winds(const monster* mon)
}
}
}
+
+random_pick_entry<cloud_type> cloud_cone_clouds[] =
+{
+ { 0, 50, 100, DOWN, CLOUD_RAIN },
+ { 0, 50, 100, DOWN, CLOUD_MIST },
+ { 0, 50, 100, DOWN, CLOUD_MEPHITIC },
+ { 0, 100, 100, PEAK, CLOUD_FIRE },
+ { 0, 100, 100, PEAK, CLOUD_COLD },
+ { 0, 100, 100, PEAK, CLOUD_POISON },
+ { 50, 100, 100, UP, CLOUD_ACID },
+ { 50, 100, 100, UP, CLOUD_STORM },
+ { 50, 100, 100, UP, CLOUD_NEGATIVE_ENERGY },
+ { 0,0,0,FLAT,CLOUD_NONE }
+};
+
+spret_type cast_cloud_cone(const actor *caster, int pow, const coord_def &pos,
+ bool fail)
+{
+ // For monsters:
+ pow = min(100, pow);
+
+ const int range = spell_range(SPELL_CLOUD_CONE, pow);
+
+ targetter_shotgun hitfunc(caster, range);
+
+ hitfunc.set_aim(pos);
+
+ if (caster->is_player())
+ {
+ if (stop_attack_prompt(hitfunc, "cloud"))
+ return SPRET_ABORT;
+ }
+
+ fail_check();
+
+ random_picker<cloud_type, NUM_CLOUD_TYPES> cloud_picker;
+ cloud_type cloud = cloud_picker.pick(cloud_cone_clouds, pow, CLOUD_NONE);
+
+ for (map<coord_def, int>::const_iterator p = hitfunc.zapped.begin();
+ p != hitfunc.zapped.end(); ++p)
+ {
+ if (p->second <= 0)
+ continue;
+ place_cloud(cloud, p->first,
+ random2avg(p->second * div_rand_round(pow, 3), 2),
+ caster);
+ }
+
+ return SPRET_SUCCESS;
+}