function. Also, use it to properly apply racial bonuses to shields, so that racial shields mean something. (Note that the bonus for shields is 2/3 the bonus for armor, as the upper limit for shields is 20, as opposed to armor's 30.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3605 c06c8d41-db1a-0410-9941-cceddc491573
WYNGGL55XFKKEY6NQBH7EKVIZZATLZ2MVPAMNM4Q3SVISGT3UEDAC
MNYDF64QY6NHYKOAFOGBQJFYU7TZDILXRV23EXJPN4IZOCLSJ2AQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
V3GWLMX6JL3YOYB427VLHPOTGHGWZK64HI6LLUU4X6CFMD2MEQMQC
PEM6HRZOMW2BZFBNQAF4554RNFNAC6WWPT26CQ6NYKI2PRLGFWNAC
L5CVPV5IUBSO4EE3WK4O6SQGIMIEPSMQONFBWEVGJBR2HATLPZIAC
CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC
P52QVYEFQXNK6IXNN2EMZIBLOIHHGQ7LODWIGWPJLANGVIPQK5IAC
X6JLXMSRNWRGP2PVQYX6Z4OUZLDSSQ2VL3EQQM5Q427MXBMRILEQC
// Dwarven armour is universally good -- bwr
if (armour_race == ISFLAG_DWARVEN)
racial_bonus += 4;
if (racial_type && armour_race == racial_type)
{
// Elven armour is light, but still gives one level to elves.
// Orcish and Dwarven armour are worth +2 to the correct
// species, plus the plus that anyone gets with dwarven armour.
// -- bwr
if (racial_type == ISFLAG_ELVEN)
racial_bonus += 2;
else
racial_bonus += 4;
// an additional bonus for Beogh worshippers
if (you.religion == GOD_BEOGH && !you.penance[GOD_BEOGH])
{
if (you.piety >= 185)
racial_bonus += racial_bonus * 9 / 4;
else if (you.piety >= 160)
racial_bonus += racial_bonus * 2;
else if (you.piety >= 120)
racial_bonus += racial_bonus * 7 / 4;
else if (you.piety >= 80)
racial_bonus += racial_bonus * 5 / 4;
else if (you.piety >= 40)
racial_bonus += racial_bonus * 3 / 4;
else
racial_bonus += racial_bonus / 4;
}
}
return racial_bonus;
}
int player_AC(void)
{
int AC = 0;
int i; // loop variable
AC += item.plus * 100;
// additional *half*-levels of armour skill.
int racial_bonus = 0;
const unsigned long armour_race = get_equip_race(item);
// Dwarven armour is universally good -- bwr
if (armour_race == ISFLAG_DWARVEN)
racial_bonus += 4;
if (racial_type && armour_race == racial_type)
{
// Elven armour is light, but still gives one level
// to elves. Orcish and Dwarven armour are worth +2
// to the correct species, plus the plus that anyone
// gets with dwarven armour. -- bwr
if (racial_type == ISFLAG_ELVEN)
racial_bonus += 2;
else
racial_bonus += 4;
// an additional bonus for Beogh worshippers
if (you.religion == GOD_BEOGH && !you.penance[GOD_BEOGH])
{
if (you.piety >= 185)
racial_bonus += racial_bonus * 9 / 4;
else if (you.piety >= 160)
racial_bonus += racial_bonus * 2;
else if (you.piety >= 120)
racial_bonus += racial_bonus * 7 / 4;
else if (you.piety >= 80)
racial_bonus += racial_bonus * 5 / 4;
else if (you.piety >= 40)
racial_bonus += racial_bonus * 3 / 4;
else
racial_bonus += racial_bonus / 4;
}
}
int racial_bonus = player_armour_racial_bonus(item);