fix(Core/Auras): Implement Roc form (#13959)

Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>

Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>
This commit is contained in:
Angelo Venturini
2022-12-11 10:58:20 -03:00
committed by GitHub
parent 66e34d8278
commit 4992940453
3 changed files with 25 additions and 9 deletions

View File

@@ -16870,11 +16870,11 @@ void Unit::RestoreDisplayId()
AuraEffect* handledAura = nullptr;
AuraEffect* handledAuraForced = nullptr;
// try to receive model from transform auras
Unit::AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM);
AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM);
if (!transforms.empty())
{
// iterate over already applied transform auras - from newest to oldest
for (Unit::AuraEffectList::const_reverse_iterator i = transforms.rbegin(); i != transforms.rend(); ++i)
for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
{
if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
{
@@ -16899,14 +16899,19 @@ void Unit::RestoreDisplayId()
handledAura = *i;
}
AuraEffectList const& shapeshiftAura = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
// xinef: order of execution is important!
// first forced transform auras, then shapeshifts, then normal transform
// transform aura was found
if (handledAuraForced)
handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
// we've found shapeshift
else if (uint32 modelId = GetModelForForm(GetShapeshiftForm()))
SetDisplayId(modelId);
else if (!shapeshiftAura.empty()) // we've found shapeshift
{
// only one such aura possible at a time
if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
SetDisplayId(modelId);
}
else if (handledAura)
handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
// no auras found - set modelid to default
@@ -19253,8 +19258,19 @@ uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float c
return CalculatePct(damage, percent);
}
uint32 Unit::GetModelForForm(ShapeshiftForm form) const
uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const
{
// Hardcoded cases
switch (spellId)
{
case 7090: // Bear form
return 29414;
case 35200: // Roc form
return 4877;
default:
break;
}
if (GetTypeId() == TYPEID_PLAYER)
{
switch (form)