mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[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:
parent
de830e5535
commit
a00f086bb8
@ -5668,17 +5668,17 @@ void Mob::DoShieldDamageOnShielder(Mob *shield_target, int64 hit_damage_done, EQ
|
|||||||
shielder->shield_timer.Disable();
|
shielder->shield_timer.Disable();
|
||||||
shield_target->SetShielderID(0);
|
shield_target->SetShielderID(0);
|
||||||
shield_target->SetShieldTargetMitigation(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()) {
|
if (shielder->IsClient() && shielder->HasShieldEquiped()) {
|
||||||
EQ::ItemInstance* inst = shielder->CastToClient()->GetInv().GetItem(EQ::invslot::slotSecondary);
|
EQ::ItemInstance* inst = shielder->CastToClient()->GetInv().GetItem(EQ::invslot::slotSecondary);
|
||||||
if (inst) {
|
if (inst) {
|
||||||
const EQ::ItemData* shield = inst->GetItem();
|
const EQ::ItemData* shield = inst->GetItem();
|
||||||
if (shield && shield->ItemType == EQ::item::ItemTypeShield) {
|
if (shield && shield->ItemType == EQ::item::ItemTypeShield) {
|
||||||
mitigation += shield->AC * 50 / 100; //1% increase per 2 AC
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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());
|
entity_list.MessageCloseString(this, false, 100, 0, START_SHIELDING, GetCleanName(), shield_target->GetCleanName());
|
||||||
|
|
||||||
SetShieldTargetID(shield_target->GetID());
|
SetShieldTargetID(shield_target->GetID());
|
||||||
SetShielderMitigation(shield_target_mitigation);
|
SetShielderMitigation(shielder_mitigation);
|
||||||
SetShielderMaxDistance(shielder_max_distance);
|
SetShielderMaxDistance(shielder_max_distance);
|
||||||
|
|
||||||
shield_target->SetShielderID(GetID());
|
shield_target->SetShielderID(GetID());
|
||||||
|
|||||||
@ -6569,7 +6569,7 @@ XS(XS_Mob_ShieldAbility) {
|
|||||||
if (items < 8) {
|
if (items < 8) {
|
||||||
can_shield_npc = true;
|
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;
|
XSRETURN_EMPTY;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user