[Bug Fix] Fix for dual wield animation when same delay weapons. (#1671)

* DW animation fix

* spelling

* better animation

looks better for low skill where dw doesn't fire as often.

* Update attack.cpp
This commit is contained in:
KayenEQ
2021-11-10 21:27:51 -05:00
committed by GitHub
parent d9c8e80bca
commit 33c30d3cbb
3 changed files with 38 additions and 1 deletions
+34 -1
View File
@@ -140,9 +140,25 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea
}
// If we're attacking with the secondary hand, play the dual wield anim
if (Hand == EQ::invslot::slotSecondary) // DW anim
if (Hand == EQ::invslot::slotSecondary) {// DW anim
type = animDualWield;
//allow animation chance to fire to be similar to your dw chance
if (GetDualWieldingSameDelayWeapons() == 2) {
SetDualWieldingSameDelayWeapons(3);
}
}
//If both weapons have same delay this allows a chance for DW animation
if (GetDualWieldingSameDelayWeapons() && Hand == EQ::invslot::slotPrimary) {
if (GetDualWieldingSameDelayWeapons() == 3 && zone->random.Roll(50)) {
type = animDualWield;
SetDualWieldingSameDelayWeapons(2);//Don't roll again till you do another dw attack.
}
SetDualWieldingSameDelayWeapons(2);//Ensures first attack is always primary.
}
DoAnim(type, 0, false);
return skillinuse;
@@ -5541,6 +5557,8 @@ void Mob::SetAttackTimer()
void Client::SetAttackTimer()
{
float haste_mod = GetHaste() * 0.01f;
int primary_speed = 0;
int secondary_speed = 0;
//default value for attack timer in case they have
//an invalid weapon equipped:
@@ -5618,6 +5636,21 @@ void Client::SetAttackTimer()
speed = static_cast<int>(speed + ((hhe / 100.0f) * delay));
}
TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true);
if (i == EQ::invslot::slotPrimary) {
primary_speed = speed;
}
else if (i == EQ::invslot::slotSecondary) {
secondary_speed = speed;
}
}
//To allow for duel wield animation to display correctly if both weapons have same delay
if (primary_speed == secondary_speed) {
SetDualWieldingSameDelayWeapons(1);
}
else {
SetDualWieldingSameDelayWeapons(0);
}
}