after being used. Note that there is currently no check for its being used in succession yet.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4731 c06c8d41-db1a-0410-9941-cceddc491573
ZXYVKEDP7QYG66XFUCXXCKZXT7Z5OOEJWHICWOYAUZQ4SSLHIA4AC
TOX7ESF5NFNR6YEH4UATKVTJKPKXTPSY2K5GF3FDWIGH4IQXMI5AC
YXS47G3N4GA4ZKKTR7AGBJKUOY4HGEPHS42P7V5VEWMWKN3FQQZQC
4K7OPFNBESDPBBCGTGJCYWR32THYQKRRB3EAIK7IHEHN5XXAHYOQC
AUFEDZ4RUY32ZAXOPTZ5OX6X6GUUYJHNDEFZD4GHUBBAFOQCVPWQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
CGYTZT5QWIEGYKUOLOK7MFXSLJKLYRZONER5ZCDZO5XYWSLG475QC
Z3JIUQAY6RBQT36F5WT7MRG2FP7CK5PSSGGKSLLJ6KLLGGLPZCQQC
HXAKQLE5VFM3TREGGSFH362HVJPZ2NE5JCQUTMKD5YBZCS4JTU4AC
6PLS7FPGSB3VOF4SKYF5LFPCY4CK7T6YDMSJPYLPQ4QKGCN4YW2QC
55NOS4YJW7L3U3JE3F5KOWOYM57OKVLDP2JRG5GPQLBT65JLMCWAC
I5ECB3F77YUAWY4MVFU3PTBJUYYR4J76VWA6JY5PE5NR44QHXTWQC
IDVXDTVLNXRKZ32SEMIDKW5OM2C2SI2XNQWHLRZN33GOOSGYQ5WQC
const int max_steps = std::min(pow, 6);
int steps = 0;
int loss_amt;
static int step = 0;
static int step_max;
static int type;
static int hp_amt;
static int mp_amt;
// If the step counter has been reset, start from the beginning.
if (step == 0)
{
step_max = std::min(pow, 6);
type = random2(3);
hp_amt = 3;
mp_amt = 1;
}
bool success = false;
for (int hp_amt = 3;
steps < max_steps && you.hp < you.hp_max;
++steps, hp_amt *= 2)
{
inc_hp(hp_amt, false);
loss_amt = steps + 1 + (random2(3) - 1);
if (loss_amt > 0)
lose_piety(loss_amt);
}
success = true;
inc_hp(hp_amt, false);
hp_amt *= 2;
for (int mp_amt = 1;
steps < max_steps && you.magic_points < you.max_magic_points;
++steps, mp_amt *= 2)
{
inc_mp(mp_amt, false);
loss_amt = steps + 1 + (random2(3) - 1);
if (loss_amt > 0)
lose_piety(loss_amt);
}
success = true;
inc_mp(mp_amt, false);
mp_amt *= 2;
return steps;
// If it succeeded, display an appropriate message.
mprf("You feel %s %s.", (step == 0) ? "only nominally" :
(step == 1) ? "very slightly" :
(step == 2) ? "slightly" :
(step == 3) ? "somewhat" :
(step == 4) ? "appropriately"
: "impressively",
(type == 0) ? "invigorated"
: "powerful");
// The more the step counter has advanced, the greater the piety
// cost is.
int loss_amt = step + 1 + (random2(3) - 1);
if (loss_amt > 0)
lose_piety(loss_amt);
// Increment the step counter.
step++;
// If revitalisation went as far as possible, reset the step counter
// and get out, indicating maximum success.
if (step == step_max)
{
step = 0;
return step_max;
}
// Otherwise, get out, indicating normal success.
return step + 1;