From 7d618aac9cc503e5399a73b6a5e9cd7469544f2f Mon Sep 17 00:00:00 2001 From: Andrew James Date: Tue, 22 Nov 2022 20:15:33 +1100 Subject: [PATCH] simplify monk damage calculation clang format wants the if conditions all on one line -_-. Not as nice as I was hoping. --- Source/items.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index 88dcd0ffe..811e6d7e3 100644 --- a/Source/items.cpp +++ b/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;