[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.
This commit is contained in:
Quintinon 2022-06-01 14:17:14 -07:00 committed by GitHub
parent de830e5535
commit a00f086bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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
}
}
}

View File

@ -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());

View File

@ -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;