Browse Source

simplify monk damage calculation

clang format wants the if conditions all on one line -_-. Not as nice as I was hoping.
pull/5530/head
Andrew James 3 years ago committed by Anders Jenbo
parent
commit
7d618aac9c
  1. 12
      Source/items.cpp

12
Source/items.cpp

@ -2504,15 +2504,9 @@ void CalcPlrItemVals(Player &player, bool loadgfx)
if (player._pClass == HeroClass::Rogue) {
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 200;
} else if (player._pClass == HeroClass::Monk) {
if (player.InvBody[INVLOC_HAND_LEFT]._itype != ItemType::Staff) {
if (player.InvBody[INVLOC_HAND_RIGHT]._itype != ItemType::Staff && (!player.InvBody[INVLOC_HAND_LEFT].isEmpty() || !player.InvBody[INVLOC_HAND_RIGHT].isEmpty())) {
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 300;
} else {
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 150;
}
} else {
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 150;
}
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 150;
if ((!player.InvBody[INVLOC_HAND_LEFT].isEmpty() && player.InvBody[INVLOC_HAND_LEFT]._itype != ItemType::Staff) || (!player.InvBody[INVLOC_HAND_RIGHT].isEmpty() && player.InvBody[INVLOC_HAND_RIGHT]._itype != ItemType::Staff))
player._pDamageMod /= 2; // Monks get half the normal damage bonus if they're holding a non-staff weapon
} else if (player._pClass == HeroClass::Bard) {
if (player.InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Sword || player.InvBody[INVLOC_HAND_RIGHT]._itype == ItemType::Sword)
player._pDamageMod = player._pLevel * (player._pStrength + player._pDexterity) / 150;

Loading…
Cancel
Save