86 return floor((WeaponSpeed * PPM) / 600.0f);
178 switch (missCondition)
280 if (
ToPlayer()->HasSpellCooldown(23922))
308 Unit* actor = isVictim ? target :
this;
309 Unit* actionTarget = !isVictim ? target :
this;
313 ProcEventInfo eventInfo =
ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, NULL, &damageInfo, &healInfo);
320 if (procAura && procAura->
Id == itr->first)
324 bool active = damage || (procExtra &
PROC_EX_BLOCK && isVictim);
328 SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
341 if (!
sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
354 if (itr->second->HasEffect(i))
369 procTriggered.push_front(triggerData);
373 if (procTriggered.empty())
381 for (ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
384 if (i->aura->IsRemoved())
387 bool useCharges = i->aura->IsUsingCharges();
389 if (useCharges && !i->aura->GetCharges())
392 bool takeCharges =
false;
393 SpellInfo const* spellInfo = i->aura->GetSpellInfo();
394 uint32 Id = i->aura->GetId();
398 bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo);
403 cooldown = i->spellProcEvent->cooldown;
409 bool handled = i->aura->CallScriptProcHandlers(aurApp, eventInfo);
412 if (!handled &&
HandleAuraProc(target, damage, i->aura, procSpell, procFlag, procExtra, cooldown, &handled))
414 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), Id);
422 if (!(i->effMask & (1 << effIndex)))
425 AuraEffect* triggeredByAura = i->aura->GetEffect(effIndex);
428 bool prevented = i->aura->CallScriptEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
440 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
459 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
460 if (
HandleDummyAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
466 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
477 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->
Id, isVictim ?
"a victim's" :
"an attacker's", triggeredByAura->
GetId());
482 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
489 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
490 (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
498 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
499 (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
507 SF_LOG_DEBUG(
"spells",
"ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->
Id, (isVictim ?
"a victim's" :
"an attacker's"), triggeredByAura->
GetId());
566 if (procSpell && (procSpell->
Id == triggeredByAura->
GetId()))
575 if (damageLeft <
int32(damage))
578 triggeredByAura->
SetAmount(damageLeft - damage);
591 i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
596 if (prepare && useCharges && takeCharges)
597 i->aura->DropCharge();
599 i->aura->CallScriptAfterProcHandlers(aurApp, eventInfo);
615 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
617 ASSERT((*itr)->GetTarget() ==
this);
618 if (!(*itr)->GetRemoveMode())
619 if ((*itr)->GetBase()->IsProcTriggeredOnEvent(*itr, eventInfo))
621 (*itr)->GetBase()->PrepareProcToTrigger(*itr, eventInfo);
622 aurasTriggeringProc.push_back(*itr);
631 if (itr->second->GetBase()->IsProcTriggeredOnEvent(itr->second, eventInfo))
633 itr->second->GetBase()->PrepareProcToTrigger(itr->second, eventInfo);
634 aurasTriggeringProc.push_back(itr->second);
643 TriggerAurasProcOnEvent(NULL, NULL, damageInfo.
target, damageInfo.
procAttacker, damageInfo.
procVictim, 0, 0, damageInfo.
procEx, NULL, &dmgInfo, NULL);
646void Unit::TriggerAurasProcOnEvent(std::list<AuraApplication*>* myProcAuras, std::list<AuraApplication*>* targetProcAuras,
Unit* actionTarget,
uint32 typeMaskActor,
uint32 typeMaskActionTarget,
uint32 spellTypeMask,
uint32 spellPhaseMask,
uint32 hitMask,
Spell* spell,
DamageInfo* damageInfo,
HealInfo* healInfo)
649 ProcEventInfo myProcEventInfo =
ProcEventInfo(
this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
650 std::list<AuraApplication*> myAurasTriggeringProc;
654 ProcEventInfo targetProcEventInfo =
ProcEventInfo(
this, actionTarget,
this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
655 std::list<AuraApplication*> targetAurasTriggeringProc;
656 if (typeMaskActionTarget)
661 if (typeMaskActionTarget)
667 for (std::list<AuraApplication*>::iterator itr = aurasTriggeringProc.begin(); itr != aurasTriggeringProc.end(); ++itr)
669 if (!(*itr)->GetRemoveMode())
670 (*itr)->GetBase()->TriggerProcOnEvent(*itr, eventInfo);
694 spellProcEvent =
sSpellMgr->GetSpellProcEvent(spellProto->
Id);
698 if (spellProcEvent && spellProcEvent->
procFlags)
699 EventProcFlag = spellProcEvent->
procFlags;
714 if (!
sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active))
725 if (aura->
GetId() == 32409)
732 if (procSpell && procSpell->
Id == spellProto->
Id
768 if (spellProcEvent && spellProcEvent->
ppmRate != 0)
799 SF_LOG_DEBUG(
"spells",
"Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->
Id);
818 CastCustomSpell(target, spellProto->
Id, &heal, NULL, NULL,
true, NULL, triggeredByAura, caster_guid);
819 if (
Aura* aura = target->GetAura(spellProto->
Id, caster->GetGUID()))
820 aura->SetCharges(jumps);
826 CastCustomSpell(
this, 33110, &heal, NULL, NULL,
true, NULL, NULL, caster_guid);
835 switch (spellProto->
Id)
838 damageSpellId = 57952;
842 damageSpellId = 59979;
845 damageSpellId = 43594;
848 SF_LOG_ERROR(
"entities.unit",
"Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->
Id);
868 CastSpell(target, spellProto,
true, NULL, triggeredByAura, caster_guid);
869 if (
Aura* aura = target->GetAura(spellProto->
Id, caster->GetGUID()))
870 aura->SetCharges(jumps);
875 CastSpell(
this, damageSpellId,
true, NULL, triggeredByAura, caster_guid);
@ CONDITION_SOURCE_TYPE_SPELL_PROC
std::list< Condition * > ConditionList
#define MAX_SPELL_EFFECTS
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
@ EQUIPMENT_SLOT_MAINHAND
#define INVENTORY_SLOT_BAG_0
@ SPELL_ATTR3_DISABLE_PROC
@ SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED
@ AURA_STATE_HUNTER_PARRY
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_AURA_MOD_ATTACK_POWER
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
@ SPELL_AURA_MOD_RESISTANCE
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_PROC_ON_POWER_AMOUNT
@ SPELL_AURA_MOD_POWER_REGEN
@ SPELL_AURA_OBS_MOD_POWER
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
@ SPELL_AURA_REFLECT_SPELLS
@ SPELL_AURA_MOD_MELEE_HASTE
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
@ SPELL_AURA_PROC_TRIGGER_SPELL_2
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
@ SPELL_AURA_MECHANIC_IMMUNITY
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
@ SPELL_AURA_MOD_DAMAGE_TAKEN
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_REDUCE_PUSHBACK
@ SPELL_AURA_SPELL_MAGNET
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
@ SPELL_AURA_DAMAGE_IMMUNITY
@ SPELL_AURA_MOD_DAMAGE_DONE
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
@ SPELL_AURA_MOD_MELEE_HASTE_3
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
#define MELEE_BASED_TRIGGER_MASK
@ PROC_EX_INTERNAL_CANT_PROC
@ PROC_EX_INTERNAL_TRIGGERED
@ PROC_EX_INTERNAL_REQ_FAMILY
@ PROC_FLAG_TAKEN_PERIODIC
@ PROC_FLAG_DONE_TRAP_ACTIVATION
@ SPELLMOD_CHANCE_OF_SUCCESS
@ SPELLMOD_PROC_PER_MINUTE
static bool isAlwaysTriggeredAura[TOTAL_AURAS]
static bool InitTriggerAuraData()
static bool isNonTriggerAura[TOTAL_AURAS]
static bool isTriggerAura[TOTAL_AURAS]
std::list< ProcTriggeredData > ProcTriggeredList
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
bool roll_chance_f(float chance)
SpellInfo const * GetSpellInfo() const
AuraType GetAuraType() const
void SetAmount(int32 amount)
int32 GetMiscValue() const
uint32 GetEffIndex() const
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
uint64 GetCasterGUID() const
int32 GetMaxDuration() const
Unit * GetUnitOwner() const
int32 GetDuration() const
AuraEffect * GetEffect(uint8 effIndex) const
void SetCharges(uint8 charges)
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
SpellInfo const * GetSpellInfo() const
ItemTemplate const * GetTemplate() const
void AddComboPoints(Unit *target, int8 count, Spell *spell=NULL)
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
bool isHonorOrXPTarget(Unit const *victim)
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Unit * GetActionTarget() const
Unit * GetProcTarget() const
float CalcRadius(Unit *caster=NULL, Spell *=NULL) const
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
uint32 CalcCastTime(uint8 level=0, Spell *spell=NULL) const
int32 EquippedItemSubClassMask
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void SetPower(Powers power, int32 val)
Player * GetSpellModOwner() const
bool HandleDummyAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
bool HandleAuraProc(Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
void SetCantProc(bool apply)
void GetProcAurasTriggeredOnEvent(AuraApplicationList &aurasTriggeringProc, AuraApplicationList *procAuras, ProcEventInfo eventInfo)
bool haveOffhandWeapon() const
void StartReactiveTimer(ReactiveType reactive)
bool HandleOverrideClassScriptAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
bool HandleProcTriggerSpell(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
void ProcDamageAndSpellFor(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpell, uint32 damage, SpellInfo const *procAura=NULL)
bool IsTriggeredAtSpellProcEvent(Unit *victim, Aura *aura, SpellInfo const *procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent)
bool HandleAuraRaidProcFromCharge(AuraEffect *triggeredByAura)
Unit * GetNextRandomRaidMemberOrPet(float radius)
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
bool isAttackReady(WeaponAttackType type=WeaponAttackType::BASE_ATTACK) const
void ModifyAuraState(AuraStateType flag, bool apply)
uint32 GetAttackTime(WeaponAttackType att) const
int32 GetPower(Powers power) const
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
bool IsInFeralForm() const
AuraApplicationMap & GetAppliedAuras()
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
bool HandleAuraProcOnPowerAmount(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo *spellProto) const
float GetWeaponProcChance() const
ProcTriggeredData(Aura *_aura)
SpellProcEventEntry const * spellProcEvent