Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/Spells: combo-point duration based spells (#1062)
Browse files Browse the repository at this point in the history
- There was an issue with the way spells using the combo-point system was calculating the duration per combo-point.

It appears the minimum duration for such spells is the increment amount for the next combo-point duration (for spells that have a minimum duration). However, the calculation seemed to skew slice and dice whenever patch 5.0.4 was introduced (Mists of Pandaria Patch 5.0.4 (2012-08-28): Duration increased from 9/12/15/18/21 sec to 12/18/24/30/36 sec.
). As such, a new check had to be introduced and calculate for such occurrences.

The culprit seemed to lie with savage roar being the outlier, not using minimum duration as the increment amount. As a result, the calculation check was added and savage roar aurascript properly scripted to set the proper duration amount per combo-point.

- Remove duplicate cast of savage roar trigger
- Remove previous commit fix for slice and dice

* Remove redundant blank line at the end of a code block
  • Loading branch information
Crypticaz committed Aug 4, 2021
1 parent e02ee0a commit 3b1ac84
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/server/game/Entities/Unit/Unit.cpp
Expand Up @@ -11201,13 +11201,15 @@ int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
int32 duration;

if (comboPoints && minduration != -1 && minduration != maxduration)
duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
{
if (minduration)
duration = minduration + (minduration * comboPoints);
else
duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
}
else
duration = minduration;

if (spellProto->Id == 5171)
duration = minduration + (minduration * comboPoints);

return duration;
}

Expand Down
3 changes: 0 additions & 3 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Expand Up @@ -1334,9 +1334,6 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
switch (GetMiscValue())
{
case FORM_CAT:
// Savage Roar
if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0))
target->CastSpell(target, 62071, true);
// Nurturing Instinct
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, SPELLFAMILY_DRUID, 2254, EFFECT_0))
{
Expand Down
27 changes: 17 additions & 10 deletions src/server/scripts/Spells/spell_druid.cpp
Expand Up @@ -52,7 +52,8 @@ enum DruidSpells
SPELL_DRUID_NATURES_GRACE = 16880,
SPELL_DRUID_NATURES_GRACE_TRIGGER = 16886,
SPELL_DRUID_SURVIVAL_INSTINCTS = 50322,
SPELL_DRUID_SAVAGE_ROAR = 62071,
SPELL_DRUID_SAVAGE_ROAR = 52610,
SPELL_DRUID_SAVAGE_ROAR_TRIGGER = 62071,
SPELL_DRUID_STAMPEDE_BAER_RANK_1 = 81016,
SPELL_DRUID_STAMPEDE_CAT_RANK_1 = 81021,
SPELL_DRUID_STAMPEDE_CAT_STATE = 109881,
Expand Down Expand Up @@ -693,21 +694,27 @@ class spell_dru_savage_roar : public SpellScriptLoader
return true;
}

void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->CastSpell(target, SPELL_DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID());
}
if (Player* caster = GetCaster()->ToPlayer())
{
if (Aura* savageRoar = caster->GetAura(SPELL_DRUID_SAVAGE_ROAR))
{
caster->CastSpell(caster, SPELL_DRUID_SAVAGE_ROAR_TRIGGER, true, NULL, aurEff, GetCasterGUID());
uint8 comboPoints = caster ? caster->GetComboPoints() : 0;

void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAurasDueToSpell(SPELL_DRUID_SAVAGE_ROAR);
int32 minduration = GetSpellInfo()->GetDuration();
int32 maxduration = GetSpellInfo()->GetMaxDuration();
int32 duration = minduration + int32((maxduration - minduration) * comboPoints / 5);

savageRoar->SetDuration(duration);
}
}
}

void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::OnApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};

Expand Down

0 comments on commit 3b1ac84

Please sign in to comment.