From 5235dcee95b0b7d451a6ca05526763cbb6dd5197 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 15 Oct 2021 20:46:57 -0400 Subject: [PATCH] Fix Immune Melee Nonmagical logic (#1606) --- zone/attack.cpp | 33 ++++++++++++++++----------------- zone/special_attacks.cpp | 6 +++++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index dbfee1e3a..2d4278046 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -990,32 +990,31 @@ int Mob::GetWeaponDamage(Mob *against, const EQ::ItemData *weapon_item) { //check to see if our weapons or fists are magical. if (against->GetSpecialAbility(IMMUNE_MELEE_NONMAGICAL)) { - if (weapon_item) { + if (GetSpecialAbility(SPECATK_MAGICAL)) { + dmg = 1; + } + //On live this occurs for pets and charmed pet >= level 10 + else if (GetOwner() && GetLevel() >= RuleI(Combat, PetAttackMagicLevel)) { + //pets wouldn't actually use this but... + //it gives us an idea if we can hit due to the dual nature of this function + dmg = 1; + } + else if (weapon_item) { if (weapon_item->Magic) { dmg = weapon_item->Damage; - //this is more for non weapon items, ex: boots for kick //they don't have a dmg but we should be able to hit magical dmg = dmg <= 0 ? 1 : dmg; } - else + else { return 0; + } + } + else if ((GetClass() == MONK || GetClass() == BEASTLORD) && GetLevel() >= 30) { + dmg = GetHandToHandDamage(); } else { - if ((GetClass() == MONK || GetClass() == BEASTLORD) && GetLevel() >= 30) { - dmg = GetHandToHandDamage(); - } - else if (GetOwner() && GetLevel() >= RuleI(Combat, PetAttackMagicLevel)) { - //pets wouldn't actually use this but... - //it gives us an idea if we can hit due to the dual nature of this function - dmg = 1; - } - else if (GetSpecialAbility(SPECATK_MAGICAL)) - { - dmg = 1; - } - else - return 0; + return 0; } } else { diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 1aa87288c..953f6f997 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -156,6 +156,9 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQ::skills::SkillType skill, int32 bas if (my_hit.base_damage == 0) my_hit.base_damage = GetBaseSkillDamage(my_hit.skill); + if (base_damage = DMG_INVULNERABLE) + my_hit.damage_done = DMG_INVULNERABLE; + if (who->GetInvul() || who->GetSpecialAbility(IMMUNE_MELEE)) my_hit.damage_done = DMG_INVULNERABLE; @@ -1649,8 +1652,9 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animKick, 0, false); int32 dmg = GetBaseSkillDamage(EQ::skills::SkillKick); - if (GetWeaponDamage(target, (const EQ::ItemData*)nullptr) <= 0) + if (GetWeaponDamage(target, (const EQ::ItemData*)nullptr) <= 0) { dmg = DMG_INVULNERABLE; + } reuse = (KickReuseTime + 3) * 1000; DoSpecialAttackDamage(target, EQ::skills::SkillKick, dmg, GetMinDamage(), -1, reuse);