Let sanctuaries shrink during the last few turns rather than suddently disappear when it times out.
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
DK362IHKSDADMUPD35NOTKM4WESQM37KG2PNOJRV2FGELDWULYPQC
B3HWU2BEQQ4E6WKVTW3JQQJFMWTVW3XWKY6BHFNBRHSZPRCF2OTQC
XDJGQNFELURGXMUAOOVALQMSLAJVHMG63KPKVA33HTJFVZROGZ4AC
CGYTZT5QWIEGYKUOLOK7MFXSLJKLYRZONER5ZCDZO5XYWSLG475QC
QQGVX3ZTIN4TB4C2QGUS7DWG4Q2LKVTJRF6UFFWZJ7KZP7HPVVBQC
TJISAZK5RWKXIIC5UTQNY4KT3UX3ASGBUQQNWZ7ZDULPRYFRZXQQC
PL6I2CMSTHY5ZHWVMIQE5YTM5S5VPKBNZM6QJVHZSSKOJGIJ5W4AC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
IVVTHLTTLOP5TSULXJWUSSXHOKYWVU3OWKYVK45A7RIB6V34MYQAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
SWOYPTHJAWFEDBMB3ROT33VQZIXGZD5UOXEV456DDUENW2HGA66QC
KHHAE5ZK7ITEZVMMUKYROKECLE2RU5ZU5OQ4Z4XSRQXE2R65O67AC
4O3VTUJT5T7NBNF3Q45XO2WHS6TCJXVLH6CKX4K36WUBDRT5F6KAC
2UBWR54HKLIWZQXB3ZFOH4R4X6TZWWZZWEU26KRDOS3BHC5J7GPAC
UKN6HTZXDUUOWKNWNKWPHKGUGL474JIAQN5JU3DM3DU26WGMNP4AC
PM65H4V4GNPVIJFUQW57DC3VDB7TRUUNXKVZONQKEFZSK3AXX5GQC
JM7UAK777RAVDAVLQLEOBRTGNW2B47S5G55XITJXO243IUNZHVYQC
52W74WXL5XIH6YFJBQRVAO47YHCS3CPMUUZS4Q3AZ3HAPDWMT54AC
VEOWM6UDFNWRAXP5YUO7XBH4ZALAJXCWRA4IRDITXJ3QWH42CTWAC
RHRAOBKSM35XB4EELW33PZ6ZJ25Z7R5CVCJVBEEAKCBQR7YK2BBAC
W2KRIXSCRJPS6WDIYTHVF5IRMF3V5DWECRAWUPVTB7VZ6A2BLD4QC
PIGVTTBAQGNHOCX6IXJLGVVURBAT77SD6FQUVTTI5SFTV563GMZQC
P2YNOE2TUTZFAOBTHJOIVD6TCV7J7D2UKUX67LHZUL6QY44ZMENQC
2H32CFFM2FNS63JJPNM2S6HMO543EX72GMPOU5GI6HTMQYPL6I3AC
6GT5JAWOIIL4SQ5MWIID6ZVO3KKQFWDQDZNVFHZ6DNK5QCBXJ4UAC
475LL4U4ND6PTNV4XKC7WQAOJC7RF2VCCVX3DRILP2PKIBFYWE6QC
}
// 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.");
}
// donate gold to gain piety distributed over time
if (you.religion == GOD_ZIN)
{
if (!you.gold)
{
mpr("You don't have anything to sacrifice.");
return;
}
if (!yesno("Do you wish to part with all of your money? ", true, 'n'))
return;
int donation_value = (int) (you.gold/200 * log(you.gold));
#if DEBUG_DIAGNOSTICS || DEBUG_SACRIFICE || DEBUG_PIETY
mprf(MSGCH_DIAGNOSTICS, "A donation of $%d amounts to an "
"increase of piety by %d.", you.gold, donation_value);
#endif
you.gold = 0;
you.redraw_gold = true;
if (donation_value < 1)
{
simple_god_message(" finds your generosity lacking.");
return;
}
else if (donation_value <= 5) // $100 or more
simple_god_message(" is satisfied with your donation.");
else if (donation_value <= 20) // about $400 or more
simple_god_message(" is pleased about your sacrifice.");
else if (donation_value <= 50) // about $1500 or more
simple_god_message(" is impressed by your generosity.");
else // about $3000 or more
simple_god_message(" is deeply moved by your generosity.");
you.duration[DUR_PIETY_POOL] += donation_value;
if (you.duration[DUR_PIETY_POOL] > 500)
you.duration[DUR_PIETY_POOL] = 500;
return; // doesn't accept anything else for sacrifice
}
else if (mons_is_fleeing(monster) && env.sanctuary_x != -1
&& !is_sanctuary(monster->x, monster->y)
&& monster->target_x == env.sanctuary_x
&& monster->target_y == env.sanctuary_y)
else if (mons_is_fleeing(monster) && inside_level_bounds(env.sanctuary_pos)
&& monster->target_x == env.sanctuary_pos.x
&& monster->target_y == env.sanctuary_pos.y)
}
// don't allow monsters to enter a sanctuary
// or attack you inside a sanctuary even if it's right next to them
if (is_sanctuary(monster->x + mmov_x, monster->y + mmov_y)
&& (!is_sanctuary(monster->x, monster->y)
|| monster->x + mmov_x == you.x_pos
&& monster->y + mmov_y == you.y_pos))
{
mmov_x = 0;
mmov_y = 0;
// Leak piety from the piety pool (currently Zin only) into actual piety.
// Note that changes of religious status without corresponding actions
// (killing monsters, offering items, ...) might be confusing for characters
// of other religions.
// For now, though, keep information about what happened hidden.
if (you.duration[DUR_PIETY_POOL] && one_chance_in(20))
{
you.duration[DUR_PIETY_POOL]--; // decrease even if piety at maximum
if (you.piety < 200)
{
#if DEBUG_DIAGNOSTICS || DEBUG_SACRIFICE || DEBUG_PIETY
mpr("Piety increases by 1 due to piety pool.", MSGCH_DIAGNOSTICS);
#endif
you.piety++;
}
#if DEBUG_DIAGNOSTICS || DEBUG_SACRIFICE || DEBUG_PIETY
else
mpr("Piety already at maximum and fails to increase "
"from piety pool.", MSGCH_DIAGNOSTICS);
if (!you.duration[DUR_PIETY_POOL])
mpr("Piety pool is now empty.", MSGCH_DIAGNOSTICS);
#endif
}