one type of it now, expand god_protects_from_harm() to include the logic for when certain gods do it. Also, as brought up on crawl-ref-discuss, make Elyvilon do it both casually and during prayer.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2959 c06c8d41-db1a-0410-9941-cceddc491573
EJEHTLHZ5DL4SJQJBMQL5K3IV2ZMCZQBVCRRERER7SPOMNKFJTVQC
RRNEVUYOK5S4M4QH77N34IXSSNUXVQAIZQLXAQKQCRITMPUKGP6AC
TI2HASZUN3QBTNWRCXLXJHOZBOUHFEOQUCPK5EYLATL7BP32H6LQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
YATODO2EN3AW7IXW5PL25HHK34YHF6Y32QBMOUZXEATZZ4YQQWZQC
264FLET5STFALEWUDOEFCR273Y5CY2WZDHL56WHZUAQ635RUN6MAC
RLN5WLM2K5U6QBIBWBLK5XTDD3MPPXXXOVPUT33JKOQF3PHF6WZQC
XCEZ7OA2INNPSYNAB5U6JB7XNDAD5BKU26YLFPPZ3SEESFZKADQAC
2H32CFFM2FNS63JJPNM2S6HMO543EX72GMPOU5GI6HTMQYPL6I3AC
JW2KRJHES33W7UTWZ6NDO4TLMK4EFU4HKZXBWR2UJOMPCCOTR4CQC
return (god == GOD_ZIN || god == GOD_SHINING_ONE ||
god == GOD_ELYVILON || god == GOD_YREDELEMNUL);
const int min_piety = piety_breakpoint(0);
bool praying = (you.duration[DUR_PRAYER] &&
random2(you.piety) >= min_piety);
bool anytime = (one_chance_in(10) || you.piety > random2(1000));
// If actual is true, return HPT_NONE if the given god can protect
// the player from harm, but doesn't actually do so.
switch (god)
{
case GOD_YREDELEMNUL:
if (!actual || praying)
return (you.piety >= min_piety) ? HPT_PRAYING :
HPT_NONE;
break;
case GOD_ZIN:
case GOD_SHINING_ONE:
if (!actual || anytime)
return HPT_ANYTIME;
break;
case GOD_ELYVILON:
if (!actual || praying || anytime)
return (you.piety >= min_piety) ? HPT_PRAYING_PLUS_ANYTIME :
HPT_ANYTIME;
break;
default:
break;
}
return HPT_NONE;
if ((you.religion == GOD_ZIN || you.religion == GOD_SHINING_ONE)
&& (one_chance_in(10) || you.piety > random2(1000))
|| (you.religion == GOD_ELYVILON || you.religion == GOD_YREDELEMNUL)
&& you.duration[DUR_PRAYER] && random2(you.piety) >= 30)
{
simple_god_message( " protects you from harm!" );
return;
}
simple_god_message( " protects you from harm!" );
return;
// The chance for doing so is:
// one_chance_in(10) || you.piety > random2(1000)
// Note that it's not depending on penance.
// Btw. I'm not sure how to explain such divine protection
// because god isn't really protecting player - he only sometimes
// saves his life (probably it shouldn't be displayed at all).
// I'm not sure how to explain such divine protection because
// god isn't really protecting player - he only sometimes saves
// his life (probably it shouldn't be displayed at all).