unless he's being nasty (the player is under penance from Xom or Xom is bored). I've put checks into _xom_is_good() and _xom_is_bad() to avoid this as much as possible, and as a safety-net changed ouch() to return early if the player dies from a Xom effect when Xom wasn't being nasty so that xom_acts() can then fix things up (this causes Xom to give a message from "Xom accidental homicide" in dat/database/godspeak.txt)
Next up will be an addition to mutate() so you can request random mutations be non-lethal, which should take care of all known situations where ouch() returns early due to Xom making a mistake.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7833 c06c8d41-db1a-0410-9941-cceddc491573
ERS7DYNAVCC7QUVG5FXJJRONYESLZU22CQGKCA5HLLLG6DMXYRLQC
HCVH2CWL32UD66O6Z7ZYDUASWN3RF5TW6FSWURGMD7MELKB772FAC
KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC
64HB7VYSYHQEN5UP7OYJ5GSVA2XMDSLLH647UPWE5NSFF3AVZSSQC
KBIIMBVTWPMMUZLPLK2KJOXKSVMGUREIYJ57VCYVXDX5F23QXDEQC
5MGUZD2UACJCSG74TEZHI3Z4YL5KL6ZVUCQ3XVZKDOLKM7EMGWJAC
B3HWU2BEQQ4E6WKVTW3JQQJFMWTVW3XWKY6BHFNBRHSZPRCF2OTQC
PHBACPMH3F34GODHVDKNCMXWU373RJQGVTDLBFCCDLLWDXVYOLTAC
TPO6FNMPNUSWH4NCKO3VLYNAADEPSAXLUITCCACLZZSY53PKA62QC
CLIEHAE2PP7ZIGLLIMYCWM4FC54KBOAN5AILOLAZJ5S26GTJM4RQC
RMPMIONAOIYDZ5GWRUT65OVWAIQX7NWQ5QAPU6FSIODAGBAI5BIAC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
B536L64JHDMAM4QYTG5DM5OSBXSPE2W7LPQBYUPJOB2ICRLR43AAC
XIXBLWIVUPWM3P6XQIB7CS45JOOIYE6OBYYYERCFAYYO4VOWOYUQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
LM764EO6YIFOKMRXWZ5S4GYZB4BHZQDTEFP7MEVYO4NN4EDOFGNQC
NMZFCCM6O3KO2GJWKOSULN27B3QIZKWPBOB62PAILXMRQD4JMIMAC
lose_stat(STAT_RANDOM, 1 + random2(3), true,
"the capriciousness of Xom" );
// Don't kill the player unless Xom is being nasty.
if (!nasty)
{
// Make sure not to lower strength so much that the player
// will die once might wears off.
char vals[3] =
{you.strength - (you.duration[DUR_MIGHT] ? 5 : 0),
you.dex, you.intel};
stat_type types[3] = {STAT_STRENGTH, STAT_DEXTERITY,
STAT_INTELLIGENCE};
int count = 0;
for (int i = 0; i < 3; i++)
{
int val = vals[i];
if (val > 1 && one_chance_in(++count))
{
stat = types[i];
max = val - 1;
}
}
if (count == 0)
continue;
}
god_speaks(GOD_XOM, _get_xom_speech("lose stats").c_str());
lose_stat(stat, 1 + random2(max), true, "the vengeance of Xom" );
}
if (you.hp <= 0 || you.strength <= 0 || you.dex <= 0 || you.intel <= 0)
{
// ouch() returned early because the player died from the Xom effect
// even though neither is the player under penance nor is Xom bored.
mpr("You die...");
god_speaks(GOD_XOM, _get_xom_speech("accidental homicide").c_str());
int changes = 0;
for (int i = 0; i < NUM_MUTATIONS; i++)
{
if (orig_mutation[i] != you.mutation[i])
changes++;
}
if (changes > 0)
{
std::string str = "Xom undoes your latest mutation";
if (changes > 1)
str += "s";
str += ".";
god_speaks(GOD_XOM, str.c_str());
}
you.mutation = orig_mutation;
you.hp = orig_hp;
you.strength = orig_str;
you.dex = orig_dex;
you.intel = orig_int;
you.max_strength = std::max(you.max_strength, you.strength);
you.max_intel = std::max(you.max_intel, you.intel);
you.max_dex = std::max(you.max_dex, you.dex);
}
if (crawl_state.is_god_acting()
&& crawl_state.which_god_acting() == GOD_XOM
&& crawl_state.other_gods_acting().size() == 0)
{
if (aux == NULL || strstr(aux, "Xom") == NULL)
death_type = KILLED_BY_XOM;
// Xom should only cause death if the player is under penance or
// Xom is bored.
if (!you.penance[GOD_XOM]
&& !(you.religion == GOD_XOM && you.gift_timeout == 0))
{
return;
}