fix(Scripts/Spells): Finger of Frost Shatter Combo. (#13006)

This commit is contained in:
UltraNix
2022-09-19 05:46:17 +02:00
committed by GitHub
parent c8da2b64fe
commit a5ab96c79d
8 changed files with 173 additions and 5 deletions

View File

@@ -169,6 +169,7 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget,
: _actor(actor), _actionTarget(actionTarget), _procTarget(procTarget), _typeMask(typeMask), _spellTypeMask(spellTypeMask), _spellPhaseMask(spellPhaseMask),
_hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo), _triggeredByAuraSpell(triggeredByAuraSpell), _procAuraEffectIndex(procAuraEffectIndex)
{
_chance.reset();
}
SpellInfo const* ProcEventInfo::GetSpellInfo() const
@@ -15852,18 +15853,29 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpellInfo && procSpellInfo->SpellFamilyName && (procSpellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)))
active = true;
if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, attType, isVictim, active, triggerData.spellProcEvent, eventInfo))
// AuraScript Hook
if (!triggerData.aura->CallScriptCheckProcHandlers(itr->second, eventInfo))
{
continue;
}
bool isTriggeredAtSpellProcEvent = IsTriggeredAtSpellProcEvent(target, triggerData.aura, attType, isVictim, active, triggerData.spellProcEvent, eventInfo);
// AuraScript Hook
triggerData.aura->CallScriptCheckAfterProcHandlers(itr->second, eventInfo);
if (!isTriggeredAtSpellProcEvent)
{
continue;
}
// do checks using conditions table
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
{
continue;
// AuraScript Hook
if (!triggerData.aura->CallScriptCheckProcHandlers(itr->second, eventInfo))
continue;
}
// Triggered spells not triggering additional spells
//bool triggered = !spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) ?
@@ -17164,11 +17176,17 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, WeaponAttackTyp
}
}
if (eventInfo.GetProcChance())
{
chance = *eventInfo.GetProcChance();
}
// Apply chance modifer aura
if (Player* modOwner = GetSpellModOwner())
{
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
}
return roll_chance_f(chance);
}

View File

@@ -25,6 +25,7 @@
#include "HostileRefMgr.h"
#include "MotionMaster.h"
#include "Object.h"
#include "Optional.h"
#include "SpellAuraDefines.h"
#include "SpellDefines.h"
#include "ThreatMgr.h"
@@ -836,6 +837,7 @@ private:
HealInfo* _healInfo;
SpellInfo const* const _triggeredByAuraSpell;
int8 _procAuraEffectIndex;
std::optional<float> _chance;
public:
explicit ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell const* spell, DamageInfo* damageInfo, HealInfo* healInfo, SpellInfo const* triggeredByAuraSpell = nullptr, int8 procAuraEffectIndex = -1);
@@ -855,6 +857,9 @@ public:
[[nodiscard]] int8 GetTriggerAuraEffectIndex() const { return _procAuraEffectIndex; }
[[nodiscard]] uint32 GetProcCooldown() const { return _cooldown; }
void SetProcCooldown(uint32 cooldown) { _cooldown = cooldown; }
[[nodiscard]] std::optional<float> GetProcChance() const { return _chance; }
void SetProcChance(float chance) { _chance = chance; }
void ResetProcChance() { _chance.reset(); }
};
// Struct for use in Unit::CalculateMeleeDamage