summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godpassive.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-13 14:10:04 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-05-07 18:23:24 -0600
commitcfba2b02acee880f9d579c2e53a24be1d3f423ac (patch)
treed3127181b2956e1ed326b4704521abba8e8d491c /crawl-ref/source/godpassive.cc
parent39cf8eb8c7de842f9fe9c974bda610dae497c80e (diff)
downloadcrawl-ref-cfba2b02acee880f9d579c2e53a24be1d3f423ac.tar.gz
crawl-ref-cfba2b02acee880f9d579c2e53a24be1d3f423ac.zip
Qazlal: Storm Shield.
Starting at * piety, you gain bonuses to SH that increase with piety; fire/freezing/storm clouds will place near you with radius and frequency increasing with piety. At *** and ***** you gain RMsl and DMsl respectively. Clouds try to place only in relatively open areas so as not to block autoexplore; this behaviour might need some fine-tuning.
Diffstat (limited to 'crawl-ref/source/godpassive.cc')
-rw-r--r--crawl-ref/source/godpassive.cc78
1 files changed, 78 insertions, 0 deletions
diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc
index e361f50f03..6a902a46f1 100644
--- a/crawl-ref/source/godpassive.cc
+++ b/crawl-ref/source/godpassive.cc
@@ -6,6 +6,7 @@
#include "art-enum.h"
#include "artefact.h"
#include "branch.h"
+#include "cloud.h"
#include "coord.h"
#include "coordit.h"
#include "defines.h"
@@ -24,6 +25,8 @@
#include "religion.h"
#include "skills2.h"
#include "state.h"
+#include "terrain.h"
+#include "travel.h"
int chei_stat_boost(int piety)
{
@@ -677,3 +680,78 @@ int gozag_gold_bonus()
return gold_count;
}
+
+int qazlal_sh_boost(int piety)
+{
+ if (!you_worship(GOD_QAZLAL)
+ || player_under_penance(GOD_QAZLAL)
+ || piety < piety_breakpoint(0))
+ {
+ return 0;
+ }
+
+ return min(piety, piety_breakpoint(5)) / 5;
+}
+
+void qazlal_storm_clouds()
+{
+ if (!you_worship(GOD_QAZLAL)
+ || player_under_penance(GOD_QAZLAL)
+ || you.piety < piety_breakpoint(0))
+ {
+ return;
+ }
+
+ const int radius =
+ min(LOS_RADIUS,
+ LOS_RADIUS * (you.piety - piety_breakpoint(0))
+ / (piety_breakpoint(5) - piety_breakpoint(0)));
+
+ vector<coord_def> candidates;
+ for (radius_iterator ri(you.pos(), radius, C_ROUND, LOS_SOLID, true);
+ ri; ++ri)
+ {
+ if (cell_is_solid(*ri) || env.cgrid(*ri) != EMPTY_CLOUD)
+ continue;
+
+ int neighbours = 0;
+ for (adjacent_iterator ai(*ri); ai; ++ai)
+ if (feat_is_traversable(grd(*ai)))
+ neighbours++;
+
+ if (neighbours == 0 || neighbours > 6)
+ candidates.push_back(*ri);
+ }
+ const int count =
+ div_rand_round(radius * candidates.size() * you.time_taken,
+ LOS_RADIUS * BASELINE_DELAY * 10);
+ if (count < 0)
+ return;
+ shuffle_array(candidates);
+ int placed = 0;
+ for (unsigned int i = 0; placed < count && i < candidates.size(); i++)
+ {
+ bool one = false, skip = false;
+ for (adjacent_iterator ai(candidates[i]); ai; ++ai)
+ {
+ if (env.cgrid(*ai) != EMPTY_CLOUD)
+ {
+ if (one)
+ {
+ skip = true;
+ break;
+ }
+ else
+ one = true;
+ }
+ }
+ if (skip)
+ continue;
+
+ place_cloud(
+ random_choose(CLOUD_FIRE, CLOUD_COLD, CLOUD_STORM,
+ CLOUD_DUST_TRAIL, -1),
+ candidates[i], random_range(3, 5), &you);
+ placed++;
+ }
+}