[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 1 deletions

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);
}
}

View File

@ -487,6 +487,7 @@ Mob::Mob(
npc_assist_cap = 0;
use_double_melee_round_dmg_bonus = false;
dw_same_delay = 0;
#ifdef BOTS
m_manual_follow = false;

View File

@ -852,6 +852,8 @@ public:
int GetHealRate() const { return itembonuses.HealRate + spellbonuses.HealRate + aabonuses.HealRate; }
int GetMemoryBlurChance(int base_chance);
inline bool HasBaseEffectFocus() const { return (spellbonuses.FocusEffects[focusFcBaseEffects] || aabonuses.FocusEffects[focusFcBaseEffects] || itembonuses.FocusEffects[focusFcBaseEffects]); }
int32 GetDualWieldingSameDelayWeapons() const { return dw_same_delay; }
inline void SetDualWieldingSameDelayWeapons(int32 val) { dw_same_delay = val; }
bool TryDoubleMeleeRoundEffect();
bool GetUseDoubleMeleeRoundDmgBonus() const { return use_double_melee_round_dmg_bonus; }
@ -1467,6 +1469,7 @@ protected:
int16 slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%)
Timer tic_timer;
Timer mana_timer;
int32 dw_same_delay;
Timer focusproclimit_timer[MAX_FOCUS_PROC_LIMIT_TIMERS]; //SPA 511
int32 focusproclimit_spellid[MAX_FOCUS_PROC_LIMIT_TIMERS]; //SPA 511