From a00f086bb8e831df1fa4f99375fdada93dd7e454 Mon Sep 17 00:00:00 2001 From: Quintinon Date: Wed, 1 Jun 2022 14:17:14 -0700 Subject: [PATCH] [Combat] Fix shield calculation (#2234) * Fix max mitigation calculation * Fix shield ability not receiving correct arguments from perl script. * Correct shielder having wrong mitigation set. --- zone/attack.cpp | 6 +++--- zone/mob.cpp | 2 +- zone/perl_mob.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 854a4b6d4..757c73ca9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -5668,17 +5668,17 @@ void Mob::DoShieldDamageOnShielder(Mob *shield_target, int64 hit_damage_done, EQ shielder->shield_timer.Disable(); shield_target->SetShielderID(0); shield_target->SetShieldTargetMitigation(0); - return; //Too far away, no message is given thoughh. + return; //Too far away, no message is given though. } - int mitigation = shielder->GetShielderMitigation(); //Default shielder mitigates 25 pct of damage taken, this can be increased up to max 50 by equiping a shield item + int mitigation = shielder->GetShielderMitigation(); //Default shielder mitigates 25 pct of damage taken, this can be increased up to max 50 by equipping a shield item if (shielder->IsClient() && shielder->HasShieldEquiped()) { EQ::ItemInstance* inst = shielder->CastToClient()->GetInv().GetItem(EQ::invslot::slotSecondary); if (inst) { const EQ::ItemData* shield = inst->GetItem(); if (shield && shield->ItemType == EQ::item::ItemTypeShield) { mitigation += shield->AC * 50 / 100; //1% increase per 2 AC - std::min(50, mitigation);//50 pct max mitigation bonus from /shield + mitigation = std::min(50, mitigation);//50 pct max mitigation bonus from /shield } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index d171cbc78..6d127af32 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -6696,7 +6696,7 @@ bool Mob::ShieldAbility(uint32 target_id, int shielder_max_distance, int shield_ entity_list.MessageCloseString(this, false, 100, 0, START_SHIELDING, GetCleanName(), shield_target->GetCleanName()); SetShieldTargetID(shield_target->GetID()); - SetShielderMitigation(shield_target_mitigation); + SetShielderMitigation(shielder_mitigation); SetShielderMaxDistance(shielder_max_distance); shield_target->SetShielderID(GetID()); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 668857fc1..f7557a14d 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -6569,7 +6569,7 @@ XS(XS_Mob_ShieldAbility) { if (items < 8) { can_shield_npc = true; } - THIS->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_duration, shield_duration, use_aa, can_shield_npc); + THIS->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation, shielder_mitigation, use_aa, can_shield_npc); } XSRETURN_EMPTY;