git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4752 c06c8d41-db1a-0410-9941-cceddc491573
EADWOF6DJ7WTY3ZAFRVJ2VHFWNLDGX6W3JXESBTXJ6K4PM2AJVDQC
bool torment_player(int pow, int caster)
{
UNUSED( pow );
// [dshaligram] Switched to using ouch() instead of dec_hp() so that
// notes can also track torment and activities can be interrupted
// correctly.
int hploss = 0;
if (!player_res_torment())
{
// negative energy resistance can alleviate torment
hploss = you.hp * (50 - player_prot_life() * 5) / 100 - 1;
if (hploss >= you.hp)
hploss = you.hp - 1;
if (hploss < 0)
hploss = 0;
}
if (!hploss)
{
mpr("You feel a surge of unholy energy.");
return false;
}
mpr("Your body is wracked with pain!");
const char *aux = "torment";
if (caster < 0)
{
switch (caster)
{
case TORMENT_CARDS:
case TORMENT_SPELL:
aux = "Symbol of Torment";
break;
case TORMENT_SPWLD:
// XXX: If we ever make any other weapon / randart eligible
// to torment, this will be incorrect.
aux = "Sceptre of Torment";
break;
case TORMENT_SCROLL:
aux = "scroll of torment";
break;
}
caster = TORMENT_GENERIC;
}
ouch(hploss, caster, (caster != TORMENT_GENERIC) ? KILLED_BY_MONSTER
: KILLED_BY_SOMETHING,
aux);
return true;
}
{
// [dshaligram] Switched to using ouch() instead of dec_hp so that
// notes can also track torment and activities can be interrupted
// correctly.
int hploss = 0;
if (!player_res_torment())
{
// negative energy resistance can alleviate torment
hploss = you.hp * (50 - player_prot_life() * 5) / 100 - 1;
if (hploss >= you.hp)
hploss = you.hp - 1;
if (hploss < 0)
hploss = 0;
}
if (!hploss)
mpr("You feel a surge of unholy energy.");
else
{
mpr("Your body is wracked with pain!");
const char *aux = "torment";
if (caster < 0)
{
switch (caster)
{
case TORMENT_CARDS:
case TORMENT_SPELL:
aux = "Symbol of Torment";
break;
case TORMENT_SPWLD:
// XXX: If we ever make any other weapon / randart
// eligible to torment, this will be incorrect.
aux = "Sceptre of Torment";
break;
case TORMENT_SCROLL:
aux = "scroll of torment";
break;
}
caster = TORMENT_GENERIC;
}
ouch(hploss, caster,
caster != TORMENT_GENERIC ? KILLED_BY_MONSTER
: KILLED_BY_SOMETHING,
aux);
}
torment_player(pow, caster);