From d5aecb228a2e34fc9570bbaa32b26b588ba4c16f Mon Sep 17 00:00:00 2001 From: Vayle <76063792+Valorith@users.noreply.github.com> Date: Wed, 21 Dec 2022 18:41:25 -0500 Subject: [PATCH] [Rules] Add Backstab Rules (#2666) * [Rules] Add backstab rules Add rules to disable elemental and bane damage on backstab. * Update special_attacks.cpp Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com> --- common/ruletypes.h | 2 ++ zone/special_attacks.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 59f22b149..78b0d35ff 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -495,6 +495,8 @@ RULE_BOOL(Combat, NPCsUseFrontalStunImmunityRaces, true, "Enable or disable NPCs RULE_BOOL(Combat, AssassinateOnlyHumanoids, true, "Enable or disable Assassinate only being allowed on Humanoids, true by default.") RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only being allowed on Humanoids, true by default.") RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.") +RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.") +RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.") RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 77f885513..bec56cf1f 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -112,13 +112,18 @@ int Mob::GetBaseSkillDamage(EQ::skills::SkillType skill, Mob *target) auto *inst = CastToClient()->GetInv().GetItem(EQ::invslot::slotPrimary); if (inst && inst->GetItem() && inst->GetItem()->ItemType == EQ::item::ItemType1HPiercing) { base = inst->GetItemBackstabDamage(true); - if (!inst->GetItemBackstabDamage()) + if (!inst->GetItemBackstabDamage()) { base += inst->GetItemWeaponDamage(true); + } + if (target) { - if (inst->GetItemElementalFlag(true) && inst->GetItemElementalDamage(true)) + if (inst->GetItemElementalFlag(true) && inst->GetItemElementalDamage(true) && !RuleB(Combat, BackstabIgnoresElemental)) { base += target->ResistElementalWeaponDmg(inst); - if (inst->GetItemBaneDamageBody(true) || inst->GetItemBaneDamageRace(true)) + } + + if ((inst->GetItemBaneDamageBody(true) || inst->GetItemBaneDamageRace(true)) && !RuleB(Combat, BackstabIgnoresBane)) { base += target->CheckBaneDamage(inst); + } } } } else if (IsNPC()) {