Skip to content

Commit

Permalink
Fix: add checks to CCDuration adjustment (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjack9 authored May 24, 2023
1 parent c23e5ab commit b492409
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/AutoBalance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,18 @@ class AutoBalance_UnitScript : public UnitScript
}

void OnAuraApply(Unit* unit, Aura* aura) override {
uint32 auraDuration = _Modifier_CCDuration(unit, aura->GetCaster(), aura);
aura->SetMaxDuration(auraDuration);
aura->SetDuration(auraDuration);
// Only if this aura has a duration
if (aura->GetDuration() > 0 || aura->GetMaxDuration() > 0)
{
uint32 auraDuration = _Modifier_CCDuration(unit, aura->GetCaster(), aura);

// only update if we decided to change it
if (auraDuration != (float)aura->GetDuration())
{
aura->SetMaxDuration(auraDuration);
aura->SetDuration(auraDuration);
}
}
}

uint32 _Modifer_DealDamage(Unit* target, Unit* attacker, uint32 damage)
Expand Down Expand Up @@ -861,6 +870,10 @@ class AutoBalance_UnitScript : public UnitScript
&& target->GetMap()->IsBattleground())))
return originalDuration;

// if the CCDurationMultiplier isn't set on this enemy
if (!((float)caster->CustomData.GetDefault<AutoBalanceCreatureInfo>("AutoBalanceCreatureInfo")->CCDurationMultiplier > 0))
return originalDuration;

// if the aura was cast by a pet or summon, return the original duration
if ((caster->IsHunterPet() || caster->IsPet() || caster->IsSummon()) && caster->IsControlledByPlayer())
return originalDuration;
Expand Down

0 comments on commit b492409

Please sign in to comment.