summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-03 23:07:39 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-03 23:07:39 +0000
commite2f74e90f41b7324f8b4e2fa880a1b32df131e68 (patch)
treeebb134a1b3a81e8c8c80b895f326a5050a75bf00 /crawl-ref/source/spells3.cc
parent5c0a7e21f8aed760fde406bba577b696ad7f8e8a (diff)
downloadcrawl-ref-e2f74e90f41b7324f8b4e2fa880a1b32df131e68.tar.gz
crawl-ref-e2f74e90f41b7324f8b4e2fa880a1b32df131e68.zip
More tweaks of Zin:
1. Let sanctuaries shrink during the last few turns rather than suddently disappear when it times out. 2. Introduce donations (and remove item sacrifice) I suppose abilities will now have to become more expensive pietywise. I raised the piety cost of the sanctuary from 10 to 15, but that probably won't be enough. For the piety gain I introduced a new duration, DUR_PIETY_POOL that is filled with gold/200 * log(gold) upon donation and then leaks with 5% chance per turn one piety point into the actual piety. All numbers are open for discussion and change. Breaks saves. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3181 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc68
1 files changed, 53 insertions, 15 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index a930ba8652..98a103ac6f 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -805,7 +805,7 @@ bool remove_sanctuary(bool did_attack)
if (env.sanctuary_time)
env.sanctuary_time = 0;
- if (env.sanctuary_x < 0 || env.sanctuary_y < 0)
+ if (!inside_level_bounds(env.sanctuary_pos))
return false;
const int radius = 5;
@@ -813,8 +813,8 @@ bool remove_sanctuary(bool did_attack)
for (int x=-radius; x<=radius; x++)
for (int y=-radius; y<=radius; y++)
{
- int posx = env.sanctuary_x + x;
- int posy = env.sanctuary_y + y;
+ int posx = env.sanctuary_pos.x + x;
+ int posy = env.sanctuary_pos.y + y;
if (posx <= 0 || posx > GXM || posy <= 0 || posy > GYM)
continue;
@@ -829,7 +829,7 @@ bool remove_sanctuary(bool did_attack)
// do not reset so as to allow monsters to see if their fleeing source
// used to be the centre of a sanctuary
-// env.sanctuary_x = env.sanctuary_y = -1;
+// env.sanctuary_pos.x = env.sanctuary_pos.y = -1;
if (did_attack)
{
@@ -837,22 +837,58 @@ bool remove_sanctuary(bool did_attack)
simple_god_message(" revokes the gift of sanctuary.", GOD_ZIN);
did_god_conduct(DID_FRIEND_DIES, 3);
}
- else if (seen_change)
- {
- mpr("The air around you flickers and hums.");
- if (is_resting())
- stop_running();
- }
+
+ if (is_resting())
+ stop_running();
return true;
}
+// For the last (radius) counter turns the sanctuary will slowly shrink
+void decrease_sanctuary_radius()
+{
+ if (one_chance_in(3)) // 33% chance of not decreasing
+ return;
+
+ int radius = 5;
+
+ int size = --env.sanctuary_time;
+ if (size >= radius)
+ return;
+
+ radius = size+1;
+ for (int x=-radius; x<=radius; x++)
+ for (int y=-radius; y<=radius; y++)
+ {
+ int posx = env.sanctuary_pos.x + x;
+ int posy = env.sanctuary_pos.y + y;
+
+ if (!inside_level_bounds(posx,posy))
+ continue;
+
+ int dist = distance(posx, posy, env.sanctuary_pos.x, env.sanctuary_pos.y);
+
+ // if necessary overwrite sanctuary property
+ if (dist > size*size)
+ env.map[posx][posy].property = FPROP_NONE;
+ }
+
+ // special case for time-out of sanctuary
+ if (!size)
+ {
+ env.map[env.sanctuary_pos.x][env.sanctuary_pos.y].property = FPROP_NONE;
+ if (see_grid(coord_def(env.sanctuary_pos.x,env.sanctuary_pos.y)))
+ mpr("The sanctuary disappears.");
+ }
+}
+
+// maybe disallow recasting while previous sanctuary in effect...
bool cast_sanctuary(const int power)
{
// first get rid of old sanctuary
remove_sanctuary();
- if (!silenced(you.x_pos, you.y_pos))
+ if (!silenced(you.x_pos, you.y_pos)) // how did you manage that?
mpr("You hear a choir sing!");
else
mpr("You are suddenly bathed in radiance!");
@@ -862,10 +898,12 @@ bool cast_sanctuary(const int power)
holy_word( 100, true );
delay(1000);
- env.sanctuary_x = you.x_pos;
- env.sanctuary_y = you.y_pos;
- env.sanctuary_time = 15;
+ env.sanctuary_pos.x = you.x_pos;
+ env.sanctuary_pos.y = you.y_pos;
+ env.sanctuary_time = 7 + you.skills[SK_INVOCATIONS]/2;
+ // radius could also be influenced by Inv
+ // and would then have to be stored globally
const int radius = 5;
const int pattern = random2(4);
int count = 0;
@@ -877,7 +915,7 @@ bool cast_sanctuary(const int power)
int posx = you.x_pos + x;
int posy = you.y_pos + y;
- if (posx <= 0 || posx > GXM || posy <= 0 || posy > GYM)
+ if (!inside_level_bounds(posx, posy))
continue;
int dist = distance(posx, posy, you.x_pos, you.y_pos);