AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon TestCreature TestPlayer Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef boost::container::flat_multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef boost::container::flat_multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::vector< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::vector< std::pair< uint8, AuraApplication * > > AuraApplicationProcContainer
 
typedef std::list< DiminishingReturn > Diminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::unordered_multimap< uint32, uint32 > SpellImmuneContainer
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
void Update (uint32 time) override
 
UnitAI * GetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
void SetUInt32Value (uint16 index, uint32 value)
 
Unit * GetOwner () const
 
ObjectGuid GetOwnerGUID () const override
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
ObjectGuid GetTransGUID () const override
 
Pet * ToPet ()
 
Totem * ToTotem ()
 
TempSummon * ToTempSummon ()
 
TempSummon const * ToTempSummon () const
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only.
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
void SetEmoteState (Emote emoteState)
 
void ClearEmoteState ()
 Sets emote state (looping emote). Emotes available in SharedDefines.h.
 
NPCFlags GetNpcFlags () const
 Clears emote state (looping emote)
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsCrowdControlled () const
 
bool IsImmobilizedState () const
 
void SetAnimTier (AnimTier animTier)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
bool IsCritter () const
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
uint8 getClass () const
 
virtual bool IsClass (Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
uint32 GetFaction () const override
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
void SetFaction (uint32 faction)
 
void RestoreFaction ()
 
uint32 GetOldFactionId () const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsAreaEffectPvPBlocked (Unit const *target, SpellInfo const *bySpell) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
bool IsClientControlled (Player const *exactClient=nullptr) const
 
Player const * GetClientControlling () const
 
float GetBoundaryRadius () const
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinBoundaryRadius (Unit const *obj) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
Unit * getAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells.
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
Unit * GetVictim () const
 
void CombatStop (bool includingCast=false, bool mutualPvP=true, bool keepPvPForOthers=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
Unit * SelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
Unit * SelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit const *victim=nullptr) const
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
uint32 GetRageWeaponSpeedHitFactor (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
virtual bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
void EngageWithTarget (Unit *who)
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void SetInCombatWith (Unit *enemy, bool addSecondUnitSuppressed=false)
 
void ClearInCombat (bool keepPvPForOthers=false)
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
void AtTargetAttacked (Unit *target, bool canInitialAggro)
 
ThreatManager & GetThreatMgr ()
 
ThreatManager const & GetThreatMgr () const
 
CombatManager & GetCombatManager ()
 
CombatManager const & GetCombatManager () const
 
bool IsThreatened () const
 
bool IsThreatenedBy (Unit const *who) const
 
void UpdatePetCombatState ()
 
virtual void AtEnterCombat ()
 
virtual void AtExitCombat ()
 
virtual void AtEngage (Unit *target)
 
virtual void AtDisengage ()
 
bool IsCombatDisallowed () const
 
void SetIsCombatDisallowed (bool value)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
virtual void SetDualWieldMode (DualWieldMode mode)
 
virtual bool HasWeapon (WeaponAttackType type) const =0
 
bool HasMainhandWeapon () const
 
bool HasOffhandWeapon () const
 
bool HasRangedWeapon () const
 
bool hasMainhandWeaponForAttack () const
 
virtual bool HasWeaponForAttack (WeaponAttackType type) const
 
bool HasMainhandWeaponForAttack () const
 
bool HasOffhandWeaponForAttack () const
 
bool HasRangedWeaponForAttack () const
 
bool CanUseAttackType (WeaponAttackType attacktype) const
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
Unit * GetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
bool IsContestedGuard () const
 
bool RespondsToCallForHelp () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
float GetCreateStat (Stats stat) const
 
void SetCreateStat (Stats stat, float val)
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
void InitStatBuffMods ()
 
bool HandleStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
 
void ApplyStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float amount)
 
void SetStatFlatModifier (UnitMods unitMod, UnitModifierFlatType modifierType, float val)
 
void SetStatPctModifier (UnitMods unitMod, UnitModifierPctType modifierType, float val)
 
float GetFlatModifierValue (UnitMods unitMod, UnitModifierFlatType modifierType) const
 
float GetPctModifierValue (UnitMods unitMod, UnitModifierPctType modifierType) const
 
void UpdateUnitMod (UnitMods unitMod)
 
virtual bool CheckAttackFitToAuraRequirement (WeaponAttackType, AuraEffect const *) const
 
virtual void UpdateDamageDoneMods (WeaponAttackType attackType, int32 skipEnchantSlot=-1)
 
void UpdateAllDamageDoneMods ()
 
void UpdateDamagePctDoneMods (WeaponAttackType attackType)
 
void UpdateAllDamagePctDoneMods ()
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
void SetCanModifyStats (bool modifyStats)
 
bool CanModifyStats () const
 
void UpdateStatBuffMod (Stats stat)
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
float GetHealthPct () const
 
int32 GetHealthGain (int32 dVal)
 
uint32 GetCreateHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
void SetCreateHealth (uint32 val)
 
Powers getPowerType () const
 
virtual bool HasActivePowerType (Powers power)
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
uint32 GetCreatePowers (Powers power) const
 
void setPowerType (Powers power)
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
uint32 GetCreateMana () const
 
void SetCreateMana (uint32 val)
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
float GetCritChanceFromSkillDiff (Unit const *victim) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
bool CanApplyResilience () const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
uint32 GetResistance (SpellSchoolMask mask) const
 
uint32 GetResistance (SpellSchools school) const
 
void SetResistance (SpellSchools school, int32 val)
 
void UpdateResistanceBuffModsMod (SpellSchools school)
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
void DealDamageShieldDamage (Unit *victim)
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, bool npcCaster) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
CharmInfo * GetCharmInfo ()
 
CharmInfo * InitCharmInfo ()
 
Unit * GetCharmer () const
 
Unit * GetCharm () const
 
Unit * GetCharmerOrOwner () const
 
Unit * GetCharmerOrOwnerOrSelf () const
 
Player * GetCharmerOrOwnerPlayerOrPlayerItself () const
 
ObjectGuid GetCharmerOrOwnerGUID () const override
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
Player * GetAffectingPlayer () const
 
Unit * GetFirstControlled () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
void SetCharm (Unit *target, bool apply)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void UpdateCharmAI ()
 
void RemoveCharmedBy (Unit *charmer)
 
void RemoveCharmAuras ()
 
void RemoveAllControlled (bool onDeath=false)
 
void DeleteCharmInfo ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
Aura * AddAura (uint32 spellId, Unit *target)
 
Aura * AddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
int32 GetHighestExclusiveSameEffectSpellGroupValue (AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
 
bool IsHighestExclusiveAura (Aura const *aura, bool removeOtherAuraApplications=false)
 
bool IsHighestExclusiveAuraEffect (SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint8 auraEffectMask, bool removeOtherAuraApplications=false)
 
Aura * _TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication * _CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura, bool owned)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMap & GetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
Aura * GetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMap & GetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveBindSightAuras ()
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint64 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraList & GetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffect * GetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffect * GetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffect * GetAuraEffectDummy (uint32 spellid) const
 
AuraEffect * GetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplication * GetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
Aura * GetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplication * GetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
Aura * GetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuras (SearchMethod sm, std::vector< uint32 > &spellIds) const
 Check if unit has ANY or ALL specified auras.
 
template<typename... Auras>
bool HasAnyAuras (Auras... spellIds) const
 Checks if the unit has ANY specified auras.
 
template<typename... Auras>
bool HasAllAuras (Auras... spellIds) const
 Checks if the unit has ALL specified auras.
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint64 mechanicMask) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
AuraEffect * IsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype) const
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype, std::function< bool(AuraEffect const *)> const &predicate) const
 
float GetTotalAuraMultiplier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxPositiveAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetMaxNegativeAuraModifier (AuraType auraType, std::function< bool(AuraEffect const *)> const &predicate) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, AuraEffect const *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplication * GetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void ProcSkillsAndReactives (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (AuraApplicationProcContainer &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void 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)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, AuraApplicationProcContainer &procAuras)
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
Player * GetSpellModOwner () const override
 
Spell * GetCurrentSpell (CurrentSpellTypes spellType) const
 
Spell * GetCurrentSpell (uint32 spellType) const
 
Spell * GetFirstCurrentCastingSpell () const
 
Spell * FindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool HasSpell (uint32) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
Unit * GetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
Unit * GetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell) override
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Unit const *caster)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, Unit const *caster, SpellSchoolMask spellSchoolMask)
 
bool IsImmunedToSpell (SpellInfo const *spellInfo, uint32 effectMask, Unit const *caster=nullptr)
 
bool IgnoresSchoolImmunityFromFriendlyCaster (Unit const *caster, uint32 immunityAuraId, SpellInfo const *immunitySpellInfo) const
 
bool IsImmunedToDamage (SpellSchoolMask schoolMask) const
 
bool IsImmunedToDamage (Unit const *caster, SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (SpellSchoolMask schoolMask) const
 
bool HasSchoolImmunityForMask (SpellSchoolMask schoolMask, Unit const *caster, SpellInfo const *spellInfo) const
 
uint32 GetSchoolImmunityMask () const
 
uint32 GetDamageImmunityMask () const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask schoolMask) const
 
bool IsImmunedToAuraPeriodicTick (Unit const *caster, SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) const
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0, TriggerCastFlags extraTriggerFlags=TRIGGERED_NONE)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (SpellInfo const *spellInfo, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObject * GetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObject * GetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveGameObjectsByType (GameobjectTypes type, bool del)
 
void RemoveAllGameObjects ()
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool IsInFlight () const
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
bool IsRooted () const
 
float GetHoverHeight () const
 
virtual bool IsMovementPreventedByCasting () const
 
bool IsActionPreventedByCasting () const
 
virtual bool CanEnterWater () const =0
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool CanFreeMove () const
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
void SendSpeedToController (UnitMoveType mtype, Player *target) const
 
void propagateSpeedChange ()
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
virtual bool SetWalk (bool enable)
 
void SetDisableGravity (bool disable)
 
virtual bool SetSwim (bool enable)
 
void SetCanFly (bool enable)
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().
 
void SetWaterWalking (bool enable)
 
void SetFeatherFall (bool enable)
 
void SetHover (bool enable)
 
MotionMaster * GetMotionMaster ()
 
MotionMaster const * GetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
bool IsStandUpOnMovementState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
Milliseconds GetLastDeathTime () const
 
bool IsInPreDeathAuraTick () const
 
void SetInPreDeathAuraTick (bool value)
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
bool HasGhostAura () const
 
bool HasMountedAura () const
 
bool HasWaterWalkAura () const
 
bool HasFeatherFallAura () const
 
bool HasHoverAura () const
 
bool HasFlyAura () const
 
bool HasSpiritOfRedemptionAura () const
 
bool HasPreventsFleeingAura () const
 
bool HasPreventDurabilityLossAura () const
 
bool HasPreventResurectionAura () const
 
bool HasTransformAura () const
 
bool HasInterruptRegenAura () const
 
bool HasNoPVPCreditAura () const
 
bool HasWaterBreathingAura () const
 
bool HasIgnoreHitDirectionAura () const
 
bool HasSpellMagnetAura () const
 
bool HasOpenStableAura () const
 
bool HasCloneCasterAura () const
 
bool HasReflectSpellsAura () const
 
bool HasDetectAmoreAura () const
 
bool HasAllowOnlyAbilityAura () const
 
bool HasPeriodicDummyAura () const
 
bool HasControlVehicleAura () const
 
bool HasAOECharmAura () const
 
bool HasDetectSpellsAura () const
 
bool HasPacifySilenceAura () const
 
bool HasSilenceAura () const
 
bool HasShapeshiftAura () const
 
bool HasDecreaseSpeedAura () const
 
bool HasPacifyAura () const
 
bool HasIgnoreTargetResistModifiersAura () const
 
bool HasIncreaseMountedSpeedAura () const
 
bool HasIncreaseMountedFlightSpeedAura () const
 
bool HasAttackerSpellCritChanceAura () const
 
bool HasUnattackableAura () const
 
bool HasHealthRegenInCombatAura () const
 
bool HasRegenDuringCombatAura () const
 
bool HasFearAura () const
 
bool HasConfuseAura () const
 
bool HasRootAura () const
 
bool HasStunAura () const
 
bool HasTauntAura () const
 
bool HasStealthAura () const
 
bool HasStealthDetectAura () const
 
bool HasInvisibilityAura () const
 
bool HasInvisibilityDetectAura () const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
Unit * GetNextRandomRaidMemberOrPet (float radius)
 
void UpdateAuraForGroup (uint8 slot)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
bool IsInDisallowedMountForm () const
 
void FollowerAdded (AbstractFollower *f)
 
void FollowerRemoved (AbstractFollower *f)
 
virtual float GetFollowAngle () const
 
void RemoveAllFollowers ()
 
Guardian * GetGuardianPet () const
 
Minion * GetFirstMinion () const
 
Creature * GetCompanionPet () const
 
Pet * CreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
Pet * CreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
void UnsummonAllTotems (bool onDeath=false)
 
TransportBase * GetDirectTransport () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
void RemoveVehicleKit ()
 
Vehicle * GetVehicleKit () const
 
Vehicle * GetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
Unit * GetVehicleBase () const
 
Creature * GetVehicleCreatureBase () const
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void HandleEmoteCommand (uint32 emoteId)
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsAttackSpeedOverridenShapeShift () const
 
bool IsInFeralForm () const
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void DeMorph ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, std::optional< float > displayScale={})
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId)
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object, Milliseconds timed=0ms)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
float GetCollisionHeight () const override
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (Position const &pos, bool teleport=false)
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendComboPoints ()
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void SendPetActionFeedback (uint8 msg) const
 -------—Pet responses methods--------------—
 
void SendPetActionSound (PetAction action) const
 
void SendPetDismissSound () const
 
void SendPetAIReaction (ObjectGuid guid) const
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SendClearTarget ()
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
void OutDebugInfo () const
 
std::string GetDebugInfo () const override
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsFriendlyTo (WorldObject const *target) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScript * GetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
virtual bool IsWithinSightRange (Position const &pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
template<typename Worker >
void DoForAllVisiblePlayers (Worker &&worker)
 
template<typename Worker >
void DoForAllVisibleWorldObjects (Worker &&worker)
 
void DestroyForVisiblePlayers ()
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
float GetLeewayBonusRange (Unit const *target) const
 
float GetLeewayBonusRadius () const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
Map * GetMap () const
 
Map * FindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScript * GetZoneScript () const
 
TempSummon * SummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummon * SummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObject * SummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
Creature * SummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
void SummonGameObjectGroup (uint8 group, std::list< GameObject * > *list=nullptr)
 
Creature * FindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObject * FindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObject * FindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
Player * SelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, std::vector< uint32 > const &entries, float maxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
bool IsPositionDataUpdatePending () const
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
VisibilityDistanceType GetVisibilityOverrideType () const
 
bool IsVisibilityOverridden () const
 
bool IsZoneWideVisible () const
 
bool IsFarVisible () const
 
float GetVisibilityOverrideDistance () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
bool IsInWintergrasp () const
 
Transport * GetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (Position pos, float *ground=nullptr) const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
virtual bool IsUpdateNeeded ()
 
bool CanBeAddedToMapUpdateList ()
 
std::string GetDebugInfo () const override
 
ObjectVisibilityContainer & GetObjectVisibilityContainer ()
 
ObjectVisibilityContainer const & GetObjectVisibilityContainer () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, SpellInfo const *info, CastSpellExtraArgs const &args={})
 
Unit * GetOwnerUnit () const
 
Unit * GetCharmerOrOwnerUnit () const
 
Unit * GetCharmerOrOwnerOrSelfUnit () const
 
Player * GetCharmerOrOwnerPlayerOrPlayerItself () const
 
Player * GetAffectingPlayer () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsFriendlyTo (WorldObject const *target) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
Unit * GetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
Unit * GetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto) const
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 damage, SpellSchoolMask schoolMask, uint32 absorb, uint32 resist)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
Player * ToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
Creature * ToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
Unit * ToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObject * ToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
Corpse * ToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObject * ToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
template<typename... T>
bool EntryEquals (T... entries) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Position & operator= (Position const &)=default
 
Position & operator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
bool operator!= (Position const &a) const
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim, SpellInfo const *spellInfo=nullptr, uint8 casterLevel=0)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr, bool skipCombat=false)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void ProcSkillsAndAuras (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false, uint8 casterLevel=0)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static bool IsImmuneMaskFully (SpellSchoolMask immuneMask, SpellSchoolMask schoolMask)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, FactionTemplateEntry const *targetFactionTemplateEntry)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from WorldObject
static float GetLeewayBonusRangeForTargets (Player const *player, Unit const *target)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
DualWieldMode _dualWieldMode
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_modAttackSpeedPct [3]
 
SpellImmuneContainer m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
ObjectGuid LastCharmerGUID
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSpline * movespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ALEEventProcessor * ALEEvents
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit ()
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool CanSparringWith (Unit const *attacker) const
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 : Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool stun=false, bool logout=false)
 
void SendMoveRoot (bool state)
 
- Protected Member Functions inherited from WorldObject
 WorldObject ()
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsInvisibleDueToDespawn () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
void _Create (ObjectGuid guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAI * i_AI
 
UnitAI * i_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unit * m_attacking
 
DeathState m_deathState
 
Milliseconds m_lastDeathTime {Milliseconds::min()}
 
bool m_inPreDeathAuraTick {false}
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spell * m_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
std::vector< Aura * > m_auraUpdateSnapshot
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraFlatModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
 
float m_auraPctModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
float _charmStartSpeedRate [MAX_MOVE_TYPE] {}
 
CharmInfo * m_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMaster * i_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatManager m_threatManager
 
CombatManager m_combatManager
 
CharmThreatMap _charmThreatInfo
 
Vehicle * m_vehicle
 
Vehicle * m_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
VisibilityDistanceType _visibilityDistanceOverrideType
 
ZoneScript * m_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transport * m_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union { 
 
   int32 *   m_int32Values 
 
   uint32 *   m_uint32Values 
 
   float *   m_floatValues 
 
};  
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef std::unordered_map< uint64, BuildValuesCachedBuffer > ValuesUpdateCache
 

Private Member Functions

bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
void PatchValuesUpdate (ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
 
void InvalidateValuesUpdateCache ()
 
float processDummyAuras (float TakenTotalMod) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
std::unordered_set< AbstractFollower * > m_followingMe
 
Unit * m_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed?
 
bool _isCombatDisallowed
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 
std::optional< float > _displayScale
 scale passed with the current display, empty = native scale
 
ValuesUpdateCache _valuesUpdateCache
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

typedef std::unordered_set<Unit*> Unit::AttackerSet

◆ AuraApplicationList

◆ AuraApplicationMap

typedef boost::container::flat_multimap<uint32, AuraApplication*> Unit::AuraApplicationMap

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

◆ AuraApplicationProcContainer

typedef std::vector<std::pair<uint8 , AuraApplication*> > Unit::AuraApplicationProcContainer

◆ AuraEffectList

typedef std::vector<AuraEffect*> Unit::AuraEffectList

◆ AuraList

typedef std::list<Aura*> Unit::AuraList

◆ AuraMap

typedef boost::container::flat_multimap<uint32, Aura*> Unit::AuraMap

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

◆ AuraStateAurasMap

typedef boost::container::flat_multimap<AuraStateType, AuraApplication*> Unit::AuraStateAurasMap

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

typedef std::set<Unit*> Unit::ControlSet

◆ Diminishing

◆ DynObjectList

typedef std::list<DynamicObject*> Unit::DynObjectList
protected

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ SpellImmuneContainer

typedef std::unordered_multimap<uint32 , uint32 > Unit::SpellImmuneContainer

◆ ValuesUpdateCache

typedef std::unordered_map<uint64 , BuildValuesCachedBuffer> Unit::ValuesUpdateCache
private

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
459{
460 // Detach any AbstractFollowers still targeting this unit (e.g. a summoned pet/guardian/totem's
461 // FollowMovementGenerator) before it is destroyed. RemoveAllFollowers() is otherwise only called
462 // from RemoveFromWorld(), itself skipped entirely if this unit was already out of world -- so a
463 // unit destroyed without going through that path can leave a follower holding a dangling _target,
464 // crashing later in AbstractFollower::SetTarget when it tries to unregister itself. No-op/safe if
465 // m_followingMe is already empty.
467
468 // set current spells as deletable
469 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
470 if (m_currentSpells[i])
471 {
473 m_currentSpells[i] = nullptr;
474 }
475
477
478 delete i_motionMaster;
479 delete m_charmInfo;
480 delete movespline;
481
484 ASSERT(m_attackers.empty());
485
486 // pussywizard: clear m_sharedVision along with back references
487 if (!m_sharedVision.empty())
488 {
489 do
490 {
491 Player* p = *(m_sharedVision.begin());
492 p->m_isInSharedVisionOf.erase(this);
493 m_sharedVision.remove(p);
494 } while (!m_sharedVision.empty());
495 }
496
497 ASSERT(m_Controlled.empty());
498 ASSERT(m_appliedAuras.empty());
499 ASSERT(m_ownedAuras.empty());
500 ASSERT(m_removedAuras.empty());
501 ASSERT(m_gameObj.empty());
502 ASSERT(m_dynObj.empty());
503
504 if (m_movedByPlayer && m_movedByPlayer != this)
505 LOG_INFO("misc", "Unit::~Unit (A1)");
506
508}
std::uint8_t uint8
Definition Define.h:109
#define ASSERT
Definition Errors.h:68
#define LOG_INFO(filterType__,...)
Definition Log.h:153
#define CURRENT_MAX_SPELL
Definition Unit.h:570
Definition Player.h:1086
std::set< Unit * > m_isInSharedVisionOf
Definition Player.h:2379
void SetReferencedFromCurrent(bool yes)
Definition Spell.h:577
bool m_duringRemoveFromWorld
Definition Unit.h:2270
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition Unit.h:2187
AuraList m_removedAuras
Definition Unit.h:2191
ControlSet m_Controlled
Definition Unit.h:2095
Movement::MoveSpline * movespline
Definition Unit.h:2135
CharmInfo * m_charmInfo
Definition Unit.h:2212
MotionMaster * i_motionMaster
Definition Unit.h:2215
void RemoveAllFollowers()
Definition Unit.cpp:5404
void _DeleteRemovedAuras()
Definition Unit.cpp:3745
DynObjectList m_dynObj
Definition Unit.h:2181
SafeUnitPointer m_movedByPlayer
Definition Unit.h:2097
AttackerSet m_attackers
Definition Unit.h:2171
Unit * m_attacking
Definition Unit.h:2172
GameObjectList m_gameObj
Definition Unit.h:2184
AuraMap m_ownedAuras
Definition Unit.h:2189
AuraApplicationMap m_appliedAuras
Definition Unit.h:2190
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition Unit.cpp:4301
SharedVisionList m_sharedVision
Definition Unit.h:2213

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, RemoveAllFollowers(), and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( )
explicitprotected
334 : WorldObject(),
335 m_movedByPlayer(nullptr),
337 IsAIEnabled(false),
338 NeedChangeAI(false),
340 m_CreatedByPlayer(false),
342 i_AI(nullptr),
343 i_disabledAI(nullptr),
344 m_realRace(0),
345 m_race(0),
347 m_procDeep(0),
349 i_motionMaster(new MotionMaster(this)),
350 m_regenTimer(0),
351 m_threatManager(this),
352 m_combatManager(this),
353 m_vehicle(nullptr),
354 m_vehicleKit(nullptr),
356 m_comboTarget(nullptr),
358{
359#ifdef _MSC_VER
360#pragma warning(default:4355)
361#endif
364
366
373
375
376 m_state = 0;
378
379 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
380 m_currentSpells[i] = nullptr;
381
382 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
383 m_SummonSlot[i].Clear();
384
385 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
386 m_ObjectSlot[i].Clear();
387
388 m_interruptMask = 0;
389 m_transform = 0;
390 m_canModifyStats = false;
391
392 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
393 {
398 }
399 // implement 50% base damage from offhand
401
402 for (uint8 i = 0; i < MAX_ATTACK; ++i)
403 {
406
407 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
408 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
409 }
410
411 for (uint8 i = 0; i < MAX_STATS; ++i)
412 m_createStats[i] = 0.0f;
413
414 m_attacking = nullptr;
415 m_modMeleeHitChance = 0.0f;
417 m_modSpellHitChance = 0.0f;
419
420 m_CombatTimer = 0;
421 m_lastManaUse = 0;
422
423 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
424 m_speed_rate[i] = 1.0f;
425
426 m_charmInfo = nullptr;
427
428 // remove aurastates allowing special moves
429 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
430 m_reactiveTimer[i] = 0;
431
432 m_cleanupDone = false;
434
436
437 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
442
443 m_applyResilience = false;
444 _instantCast = false;
445
446 _lastLiquid = nullptr;
447
448 _oldFactionId = 0;
449
450 _isWalkingBeforeCharm = false;
451 _isCombatDisallowed = false;
452
454}
@ TYPEID_UNIT
Definition ObjectGuid.h:38
@ TYPEMASK_UNIT
Definition ObjectGuid.h:52
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1262
#define MAX_STATS
Definition SharedDefines.h:253
@ MAX_SUMMON_SLOT
Definition SharedDefines.h:3552
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1269
#define MAX_GAMEOBJECT_SLOT
Definition SharedDefines.h:3556
@ UNIT_MASK_NONE
Definition UnitDefines.h:158
#define MAX_MOVE_TYPE
Definition UnitDefines.h:367
@ BASE_VALUE
Definition Unit.h:131
@ TOTAL_VALUE
Definition Unit.h:132
@ MINDAMAGE
Definition Unit.h:145
@ MAXDAMAGE
Definition Unit.h:146
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:176
@ UNIT_MOD_END
Definition Unit.h:178
@ OFF_ATTACK
Definition Unit.h:224
@ MAX_ATTACK
Definition Unit.h:226
@ BASE_ATTACK
Definition Unit.h:223
@ RANGED_ATTACK
Definition Unit.h:225
#define BASE_MAXDAMAGE
Definition Unit.h:42
@ MAX_REACTIVE
Definition Unit.h:632
#define BASE_MINDAMAGE
Definition Unit.h:41
@ TOTAL_PCT
Definition Unit.h:139
@ BASE_PCT
Definition Unit.h:138
@ UPDATEFLAG_LIVING
Definition UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition UpdateData.h:45
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:405
Definition MotionMaster.h:139
Definition MoveSpline.h:40
uint16 m_objectType
Definition Object.h:259
uint16 m_updateFlag
Definition Object.h:262
TypeID m_objectTypeId
Definition Object.h:261
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition Unit.h:2217
uint32 m_lastSanctuaryTime
Definition Unit.h:2111
LiquidTypeEntry const * _lastLiquid
Definition Unit.h:2229
uint32 m_transform
Definition Unit.h:2185
uint32 m_CombatTimer
Definition Unit.h:2257
bool m_canModifyStats
Definition Unit.h:2204
bool _isCombatDisallowed
Definition Unit.h:2274
UnitAI * i_disabledAI
Definition Unit.h:2160
bool NeedChangeAI
Definition Unit.h:2119
uint32 m_state
Definition Unit.h:2256
int32 m_attackTimer[MAX_ATTACK]
Definition Unit.h:2167
float m_modAttackSpeedPct[3]
Definition Unit.h:2107
uint8 m_realRace
Definition Unit.h:2162
Vehicle * m_vehicle
Definition Unit.h:2225
uint8 m_race
Definition Unit.h:2163
UnitAI * i_AI
Definition Unit.h:2159
uint32 _lastExtraAttackSpell
Definition Unit.h:2276
bool _instantCast
Definition Unit.h:2233
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition Unit.h:2100
float m_createStats[MAX_STATS]
Definition Unit.h:2169
float m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
Definition Unit.h:2201
float m_modRangedHitChance
Definition Unit.h:2103
DeathState m_deathState
Definition Unit.h:2174
uint32 m_unitTypeMask
Definition Unit.h:2228
uint32 m_removedAurasCount
Definition Unit.h:2193
Unit * m_comboTarget
Definition Unit.h:2265
bool m_AutoRepeatFirstCast
Definition Unit.h:2165
uint16 m_delayed_unit_ai_notify_timer
Definition Unit.h:2131
int32 m_regenTimer
Definition Unit.h:2218
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2132
bool m_ControlledByPlayer
Definition Unit.h:2121
uint32 m_last_notify_mstime
Definition Unit.h:2129
int8 m_comboPoints
Definition Unit.h:2266
ThreatManager m_threatManager
Definition Unit.h:2220
uint32 _oldFactionId
faction before charm
Definition Unit.h:2272
int32 m_baseSpellCritChance
Definition Unit.h:2105
float m_modMeleeHitChance
Definition Unit.h:2102
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition Unit.h:2203
Position m_last_notify_position
Definition Unit.h:2128
Vehicle * m_vehicleKit
Definition Unit.h:2226
bool IsAIEnabled
Definition Unit.h:2118
DualWieldMode _dualWieldMode
Definition Unit.h:2093
bool m_applyResilience
Definition Unit.h:2232
uint32 m_interruptMask
Definition Unit.h:2199
int32 m_procDeep
Definition Unit.h:2178
CombatManager m_combatManager
Definition Unit.h:2221
float m_speed_rate[MAX_MOVE_TYPE]
Definition Unit.h:2207
float m_modSpellHitChance
Definition Unit.h:2104
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition Unit.h:2099
bool m_cleanupDone
Definition Unit.h:2269
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition Unit.h:2273
bool m_CreatedByPlayer
Definition Unit.h:2122
uint16 m_delayed_unit_relocation_timer
Definition Unit.h:2130
uint32 m_lastManaUse
Definition Unit.h:2258
float m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
Definition Unit.h:2202
WorldObject()
Definition Object.cpp:1065
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:629
void Relocate(float x, float y)
Definition Position.h:77

References _dualWieldMode, _instantCast, _isCombatDisallowed, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, Alive, AUTO, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraFlatModifiersGroup, m_auraPctModifiersGroup, m_baseSpellCritChance, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_reactiveTimer, WorldObject::m_serverSideVisibility, m_speed_rate, m_state, m_SummonSlot, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit *  pAttacker)
inlineprivate
2252{ m_attackers.insert(pAttacker); }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura *  aura,
Unit *  caster 
)
4472{
4474 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4475
4476 _RemoveNoStackAurasDueToAura(aura, true);
4477
4478 if (aura->IsRemoved())
4479 return;
4480
4482 if (aura->IsSingleTarget())
4483 {
4484 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4485 /* @HACK: Player is not in world during loading auras.
4486 * Single target auras are not saved or loaded from database
4487 * but may be created as a result of aura links (player mounts with passengers)
4488 */
4489
4490 // register single target aura
4491 caster->GetSingleCastAuras().push_back(aura);
4492 // remove other single target auras
4493 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4494 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4495 {
4496 if ((*itr) != aura &&
4497 (*itr)->IsSingleTargetWith(aura))
4498 {
4499 (*itr)->Remove();
4500 itr = scAuras.begin();
4501 }
4502 else
4503 ++itr;
4504 }
4505 }
4506}
@ SPELL_AURA_CONTROL_VEHICLE
Definition SpellAuraDefines.h:299
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:106
bool IsRemoved() const
Definition SpellAuras.h:164
bool IsSingleTargetWith(Aura const *aura) const
Definition SpellAuras.cpp:1215
uint32 GetId() const
Definition SpellAuras.cpp:417
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1296
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:101
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:169
bool IsSingleTarget() const
Definition SpellAuras.h:167
bool IsInWorld() const
Definition Object.h:115
ObjectGuid GetGUID() const
Definition Object.h:121
bool IsSingleTarget() const
Definition SpellInfo.cpp:1397
void _RemoveNoStackAurasDueToAura(Aura *aura, bool owned)
Definition Unit.cpp:4724
std::list< Aura * > AuraList
Definition Unit.h:687
bool IsDuringRemoveFromWorld() const
Definition Unit.h:709
AuraList & GetSingleCastAuras()
Definition Unit.h:1446

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5583{
5584 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5585 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5586}
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication *  aurApp,
uint8  effMask 
)
4563{
4564 Aura* aura = aurApp->GetBase();
4565
4566 _RemoveNoStackAurasDueToAura(aura, false);
4567
4568 if (aurApp->GetRemoveMode())
4569 return;
4570
4571 Unit* caster = aura->GetCaster();
4572
4573 // Update target aura state flag
4574 SpellInfo const* spellInfo = aura->GetSpellInfo();
4575 if (AuraStateType aState = spellInfo->GetAuraState())
4576 {
4577 uint32 aStateMask = (1 << (aState - 1));
4578 // force update so the new caster registers it
4579 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && HasFlag(UNIT_FIELD_AURASTATE, aStateMask))
4581 else
4582 ModifyAuraState(aState, true);
4583 }
4584
4585 if (aurApp->GetRemoveMode())
4586 return;
4587
4588 // Sitdown on apply aura req seated
4591
4592 if (aurApp->GetRemoveMode())
4593 return;
4594
4595 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4596
4597 // apply effects of the aura
4598 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4599 {
4600 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4601 aurApp->_HandleEffect(i, true);
4602 }
4603
4604 sScriptMgr->OnAuraApply(this, aura);
4605}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1673
std::uint32_t uint32
Definition Define.h:107
#define sScriptMgr
Definition ScriptMgr.h:769
#define PER_CASTER_AURA_STATE_MASK
Definition SharedDefines.h:1306
AuraStateType
Definition SharedDefines.h:1276
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition SpellDefines.h:69
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:36
@ UNIT_FIELD_AURASTATE
Definition UpdateFields.h:119
void _HandleEffect(uint8 effIndex, bool apply)
Definition SpellAuras.cpp:161
Aura * GetBase() const
Definition SpellAuras.h:63
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:74
Definition SpellAuras.h:88
Unit * GetCaster() const
Definition SpellAuras.cpp:422
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition SpellAuras.cpp:1339
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:880
void ForceValuesUpdateAtIndex(uint32)
Definition Object.cpp:2165
Definition SpellInfo.h:340
AuraStateType GetAuraState() const
Definition SpellInfo.cpp:2008
uint32 AuraInterruptFlags
Definition SpellInfo.h:377
Definition Unit.h:670
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:7431
void SetStandState(uint8 state)
Definition Unit.cpp:12817
bool IsSitState() const
Definition Unit.cpp:12793

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), AURA_INTERRUPT_FLAG_NOT_SEATED, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), Aura::HandleAuraSpecificMods(), Object::HasFlag(), IsSitState(), MAX_SPELL_EFFECTS, ModifyAuraState(), PER_CASTER_AURA_STATE_MASK, SetStandState(), sScriptMgr, UNIT_FIELD_AURASTATE, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura *  aura,
uint8  effIndex 
)
4549{
4550 ASSERT(aura);
4551 ASSERT(aura->HasEffect(effIndex));
4553 ASSERT(aurApp);
4554 if (!aurApp->GetEffectMask())
4555 _ApplyAura(aurApp, 1 << effIndex);
4556 else
4557 aurApp->_HandleEffect(effIndex, true);
4558}
Definition SpellAuras.h:37
uint8 GetEffectMask() const
Definition SpellAuras.h:67
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:186
bool HasEffect(uint8 effIndex) const
Definition SpellAuras.h:176
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition Unit.cpp:4562

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura *  aura,
uint8  effMask 
)
4511{
4512 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4514 // aura musn't be removed
4515 ASSERT(!aura->IsRemoved());
4516
4517 // aura mustn't be already applied on target
4518 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4519
4520 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4521 uint32 aurId = aurSpellInfo->Id;
4522
4523 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4524 // Xinef: Added IsAllowingDeadTarget check
4525 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (!IsPlayer() || !ToPlayer()->GetSession()->PlayerLoading()))
4526 return nullptr;
4527
4528 Unit* caster = aura->GetCaster();
4529
4530 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4531 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4532
4533 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4534 // xinef: even if it gets removed, it will be reapplied in a second
4535 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4536 {
4537 m_interruptableAuras.push_back(aurApp);
4538 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4539 }
4540
4541 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4542 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4543
4544 aura->_ApplyForTarget(this, caster, aurApp);
4545 return aurApp;
4546}
WorldObject * GetOwner() const
Definition SpellAuras.h:108
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition SpellAuras.h:188
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:449
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
bool IsDeathPersistent() const
Definition SpellInfo.cpp:1262
uint32 Id
Definition SpellInfo.h:344
bool IsAllowingDeadTarget() const
Definition SpellInfo.cpp:1272
void AddInterruptMask(uint32 mask)
Definition Unit.h:1621
bool IsAlive() const
Definition Unit.h:1812
AuraApplicationList m_interruptableAuras
Definition Unit.h:2197
AuraStateAurasMap m_auraStateAuras
Definition Unit.h:2198

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Object::IsPlayer(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, and Object::ToPlayer().

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3746{
3747 while (!m_removedAuras.empty())
3748 {
3749 delete m_removedAuras.front();
3750 m_removedAuras.pop_front();
3751 }
3752}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle *  vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
15329{
15330 // Must be called only from aura handler
15331 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
15332 return;
15333
15334 if (m_vehicle)
15335 {
15336 if (m_vehicle == vehicle)
15337 {
15338 if (seatId >= 0 && seatId != GetTransSeat())
15339 {
15340 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
15341 ChangeSeat(seatId);
15342 }
15343
15344 return;
15345 }
15346 else
15347 {
15348 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
15349 ExitVehicle();
15350 }
15351 }
15352
15353 if (!aurApp || aurApp->GetRemoveMode())
15354 return;
15355
15356 if (Player* player = ToPlayer())
15357 {
15358 if (vehicle->GetBase()->IsPlayer() && player->IsInCombat())
15359 return;
15360
15361 sScriptMgr->AnticheatSetUnderACKmount(player);
15362
15364 player->StopCastingCharm();
15365 player->StopCastingBindSight();
15366 Dismount();
15368
15369 // drop flag at invisible in bg
15370 if (Battleground* bg = player->GetBattleground())
15371 bg->EventPlayerDroppedFlag(player);
15372
15374 player->SendDirectMessage(&data);
15375 }
15376
15377 ASSERT(!m_vehicle);
15378 m_vehicle = vehicle;
15379
15380 if (!m_vehicle->AddPassenger(this, seatId))
15381 {
15382 m_vehicle = nullptr;
15383 return;
15384 }
15385
15386 // Xinef: remove movement auras when entering vehicle (food buffs etc)
15388}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ AURA_INTERRUPT_FLAG_MOVE
Definition SpellDefines.h:54
@ AURA_INTERRUPT_FLAG_TURNING
Definition SpellDefines.h:55
Definition Battleground.h:304
uint32 GetEntry() const
Definition Object.h:123
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4072
void Dismount()
Definition Unit.cpp:10379
bool IsOnVehicle(Unit const *vehicle) const
Definition Unit.h:1949
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5195
void ChangeSeat(int8 seatId, bool next=true)
Definition Unit.cpp:15390
Vehicle * GetVehicleKit() const
Definition Unit.h:1947
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5266
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:15409
Unit * GetBase() const
May be called from scripts.
Definition Vehicle.h:37
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition Vehicle.cpp:359
int8 GetTransSeat() const
Definition Object.h:707
Definition WorldPacket.h:26
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition Opcodes.h:1211

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), Object::IsPlayer(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
15447{
15448 if (!m_vehicle)
15449 return;
15450
15451 // This should be done before dismiss, because there may be some aura removal
15454
15455 Player* player = ToPlayer();
15456
15457 // If player is on mouted duel and exits the mount should immediatly lose the duel
15458 if (player && player->duel && player->duel->IsMounted)
15459 player->DuelComplete(DUEL_FLED);
15460
15461 Vehicle* vehicle = m_vehicle;
15462 Unit* vehicleBase = m_vehicle->GetBase();
15463 m_vehicle = nullptr;
15464
15465 if (!vehicleBase)
15466 return;
15467
15468 if (IsPlayer())
15470
15471 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
15472
15473 Position pos;
15474 // If we ask for a specific exit position, use that one. Otherwise allow scripts to modify it
15475 if (exitPosition)
15476 pos = *exitPosition;
15477 else
15478 {
15479 // Set exit position to vehicle position and use the current orientation
15480 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
15481 pos.SetOrientation(vehicleBase->GetOrientation());
15482
15483 // Change exit position based on seat entry addon data
15484 if (seatAddon)
15485 {
15487 {
15488 pos.RelocateOffset({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
15489
15491 float floorZ = GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
15492
15493 if (!isInLoS || pos.GetPositionZ() < floorZ)
15494 pos = vehicleBase->GetPosition();
15495 }
15497 pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
15498 }
15499
15500 // The vehicle can stand slightly under the floor (Pilgrim's Bounty chairs share their table's spawn Z, some
15501 // tables spawn a few tenths under the ground); an exit spline ending there drops the passenger through it
15502 float floorZ = GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
15503 if (pos.GetPositionZ() < floorZ)
15504 pos.m_positionZ = floorZ + 0.1f;
15505 }
15506
15508
15509 if (player)
15510 {
15512
15513 sScriptMgr->AnticheatSetUnderACKmount(player);
15514 }
15515
15516 // xinef: hack for flameleviathan seat vehicle
15517 VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo();
15518 if (!vehicleInfo || vehicleInfo->m_ID != 341)
15519 {
15520 Movement::MoveSplineInit init(this);
15521
15522 // A corpse leaving a flying vehicle has to drop to the ground instead of hanging at the seat's height
15523 if (player && !IsAlive())
15524 {
15525 float groundZ = GetMapHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, MAX_FALL_DISTANCE);
15526 if (groundZ > INVALID_HEIGHT && pos.GetPositionZ() > groundZ)
15527 {
15528 pos.m_positionZ = groundZ;
15529 init.SetFall();
15530 }
15531 }
15532
15533 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
15534 init.SetFacing(vehicleBase->GetOrientation());
15535 init.SetTransportExit();
15536 init.Launch();
15537 }
15538 else
15539 {
15540 float o = pos.GetAngle(this);
15541 Movement::MoveSplineInit init(this);
15542 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
15543 init.SetFacing(GetOrientation());
15544 init.SetTransportExit();
15545 init.Launch();
15546 DisableSpline();
15547 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
15548 }
15549
15550 // xinef: move fall for air-exit quest vehicles:
15551 // Quest Drag and Drop, Air Assault, and Shoot 'em Up.
15552 if (IsCreature() && !CanFly() && vehicleInfo &&
15553 (vehicleInfo->m_ID == 8 || vehicleInfo->m_ID == 113 || vehicleInfo->m_ID == 228 ||
15554 vehicleInfo->m_ID == 290 || vehicleInfo->m_ID == 298))
15555 {
15557 }
15558
15559 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
15560 if (((Minion*)vehicleBase)->GetOwner() == this)
15561 {
15562 if (!vehicleInfo || (vehicleInfo->m_ID != 349 && vehicleBase->GetEntry() != 28192))
15563 {
15564 vehicle->Dismiss();
15565 }
15566 else if (vehicleBase->IsCreature())
15567 {
15568 vehicle->Uninstall();
15569 vehicleBase->m_Events.AddEventAtOffset(new VehicleDespawnEvent(*vehicleBase, 2s), 2s);
15570 }
15571
15572 // xinef: ugly hack, no appripriate hook later to cast spell
15573 if (player)
15574 {
15575 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
15576 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
15577 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
15578 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
15579 }
15580 }
15581
15583 {
15584 // Vehicle just died, we die too
15585 if (vehicleBase->getDeathState() == DeathState::JustDied)
15587 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
15588 else
15589 ToTempSummon()->UnSummon(2s); // Approximation
15590 }
15591
15592 if (player)
15593 {
15595 player->SetCanTeleport(true);
15596 }
15597}
#define MAX_FALL_DISTANCE
Definition GridTerrainData.h:28
#define INVALID_HEIGHT
Definition GridTerrainData.h:27
@ LINEOFSIGHT_ALL_CHECKS
Definition Map.h:115
@ DELAYED_VEHICLE_TELEPORT
Definition Player.h:903
@ DUEL_FLED
Definition SharedDefines.h:3870
@ UNIT_MASK_ACCESSORY
Definition UnitDefines.h:168
@ UNIT_MASK_MINION
Definition UnitDefines.h:160
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
@ UNIT_STATE_MOVE
Definition UnitDefines.h:192
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition VehicleDefines.h:56
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition VehicleDefines.h:55
@ NPC_EIDOLON_WATCHER
Definition VehicleDefines.h:69
@ NPC_LITHE_STALKER
Definition VehicleDefines.h:70
void AddEventAtOffset(BasicEvent *event, Milliseconds offset, uint8 eventGroup=0)
Definition EventProcessor.h:108
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition Map.cpp:1567
Definition TemporarySummon.h:87
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:782
Definition MoveSplineInit.h:63
bool IsCreature() const
Definition Object.h:211
void SetCanTeleport(bool value)
Definition Player.h:2544
void DuelComplete(DuelCompleteType type)
Definition Player.cpp:6630
void SetFallInformation(uint32 time, float z)
Definition Player.h:2380
void SetExpectingChangeTransport(bool state)
Definition Player.h:2683
std::unique_ptr< DuelInfo > duel
Definition Player.h:1907
void ResummonPetTemporaryUnSummonedIfAny()
Definition Player.cpp:14690
uint32 GetDelayedOperations() const
Definition Player.h:2130
virtual void UnSummon(Milliseconds msTime=0ms)
Definition TemporarySummon.cpp:292
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:11198
Unit * GetOwner() const
Definition Unit.cpp:7534
DeathState getDeathState()
Definition Unit.h:1806
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
TempSummon * ToTempSummon()
Definition Unit.h:737
void DisableSpline()
Definition Unit.cpp:763
void AddUnitState(uint32 f)
Definition Unit.h:741
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14001
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1371
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:747
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition Unit.cpp:15089
Definition Vehicle.h:107
Definition Vehicle.h:28
void Dismiss()
Definition Vehicle.cpp:585
VehicleEntry const * GetVehicleInfo() const
Definition Vehicle.h:38
void RemovePassenger(Unit *passenger)
Definition Vehicle.cpp:502
void Uninstall()
Definition Vehicle.cpp:123
VehicleSeatAddon const * GetSeatAddonForSeatOfPassenger(Unit const *passenger) const
Definition Vehicle.cpp:275
uint32 GetPhaseMask() const
Definition Object.h:523
Map * GetMap() const
Definition Object.h:637
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
Definition Object.cpp:3152
EventProcessor m_Events
Definition Object.h:749
Seconds GetGameTime()
Definition GameTime.cpp:39
Definition Position.h:27
float GetAngle(Position const *pos) const
Definition Position.cpp:85
float m_positionZ
Definition Position.h:57
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
void SetOrientation(float orientation)
Definition Position.h:116
float GetPositionX() const
Definition Position.h:121
void GetPosition(float &x, float &y) const
Definition Position.h:126
float GetPositionY() const
Definition Position.h:122
void RelocateOffset(Position const &offset)
Definition Position.cpp:66
Definition DBCStructure.h:2063
uint32 m_ID
Definition DBCStructure.h:2064
Definition VehicleDefines.h:86
float ExitParameterO
Definition VehicleDefines.h:96
float ExitParameterX
Definition VehicleDefines.h:93
float ExitParameterY
Definition VehicleDefines.h:94
float ExitParameterZ
Definition VehicleDefines.h:95
VehicleExitParameters ExitParameter
Definition VehicleDefines.h:97

References EventProcessor::AddEventAtOffset(), AddUnitState(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), VehicleSeatAddon::ExitParameter, VehicleSeatAddon::ExitParameterO, VehicleSeatAddon::ExitParameterX, VehicleSeatAddon::ExitParameterY, VehicleSeatAddon::ExitParameterZ, Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMap(), WorldObject::GetMapHeight(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), WorldObject::GetPhaseMask(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Vehicle::GetSeatAddonForSeatOfPassenger(), Vehicle::GetVehicleInfo(), HasUnitTypeMask(), INVALID_HEIGHT, IsAlive(), Object::IsCreature(), Map::isInLineOfSight(), Object::IsPlayer(), JustDied, KnockbackFrom(), Movement::MoveSplineInit::Launch(), LINEOFSIGHT_ALL_CHECKS, WorldObject::m_Events, VehicleEntry::m_ID, Position::m_positionZ, m_vehicle, MAX_FALL_DISTANCE, MotionMaster::MoveFall(), Movement::MoveSplineInit::MoveTo(), VMAP::Nothing, NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Position::RelocateOffset(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), Player::SetCanTeleport(), SetControlled(), setDeathState(), Player::SetExpectingChangeTransport(), Movement::MoveSplineInit::SetFacing(), Movement::MoveSplineInit::SetFall(), Player::SetFallInformation(), Position::SetOrientation(), Movement::MoveSplineInit::SetTransportExit(), sScriptMgr, Object::ToPlayer(), ToTempSummon(), Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_SHADE_CONTROL_END, VehicleExitParamDest, and VehicleExitParamOffset.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura *  appliedAura,
Aura *  existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
10710{
10711 ASSERT(target);
10712
10713 // can assist to self
10714 if (this == target)
10715 return true;
10716
10717 // can't assist unattackable units or GMs
10718 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
10719 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
10720 return false;
10721
10722 // can't assist own vehicle or passenger
10723 if (m_vehicle)
10724 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
10725 return false;
10726
10727 // can't assist invisible
10728 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
10729 return false;
10730
10731 // can't assist dead
10732 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
10733 return false;
10734
10735 // can't assist untargetable
10736 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
10737 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
10738 return false;
10739
10740 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
10741 {
10742 // xinef: do not allow to assist non attackable units
10743 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
10744 return false;
10745
10747 {
10748 if (target->IsImmuneToPC())
10749 return false;
10750 }
10751 else
10752 {
10753 if (target->IsImmuneToNPC())
10754 return false;
10755 }
10756 }
10757
10758 // can't assist non-friendly targets
10759 if (GetReactionTo(target) < REP_NEUTRAL
10760 && target->GetReactionTo(this) < REP_NEUTRAL
10761 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
10762 return false;
10763
10764 // PvP case
10765 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10766 {
10767 Player const* targetPlayerOwner = target->GetAffectingPlayer();
10769 {
10770 Player const* selfPlayerOwner = GetAffectingPlayer();
10771 if (selfPlayerOwner && targetPlayerOwner)
10772 {
10773 // can't assist player which is dueling someone
10774 if (selfPlayerOwner != targetPlayerOwner
10775 && targetPlayerOwner->duel)
10776 return false;
10777 }
10778 // can't assist player in ffa_pvp zone from outside
10779 if (target->IsFFAPvP() && !IsFFAPvP())
10780 return false;
10781
10782 // can't assist player out of sanctuary from sanctuary if has pvp enabled
10783 if (target->IsPvP())
10784 if (IsInSanctuary() && !target->IsInSanctuary())
10785 return false;
10786 }
10787 }
10788 // PvC case - player can assist creature only if has specific type flags
10789 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
10791 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
10792 && !target->IsPvP())
10793 {
10794 if (Creature const* creatureTarget = target->ToCreature())
10795 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
10796 }
10797 return true;
10798}
@ REP_NEUTRAL
Definition SharedDefines.h:160
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition SharedDefines.h:2715
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition SharedDefines.h:2701
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition SharedDefines.h:616
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:605
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition SharedDefines.h:595
@ UNIT_STATE_UNATTACKABLE
Definition UnitDefines.h:214
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:258
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:282
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:260
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:212
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition Unit.cpp:6911
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:753
bool IsInSanctuary() const
Definition Unit.h:1057
bool IsFFAPvP() const
Definition Unit.h:1059
Player * GetAffectingPlayer() const
Definition Unit.cpp:7559
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition Object.cpp:1815

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by IsValidAssistTarget(), and WorldObject::IsValidAssistTarget().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
10572{
10573 ASSERT(target);
10574
10575 // can't attack self
10576 if (this == target)
10577 return false;
10578
10579 // can't attack unattackable units or GMs
10580 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
10581 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
10582 return false;
10583
10584 // can't attack own vehicle or passenger
10585 if (m_vehicle)
10586 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
10587 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
10588 return false;
10589
10590 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
10591 //Ignore stealth if target is player and unit in combat with same player
10592 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->IsPlayer() && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
10593 return false;
10594
10595 // can't attack dead
10596 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
10597 return false;
10598
10599 // can't attack untargetable
10600 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
10601 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
10602 return false;
10603
10604 if (Player const* playerAttacker = ToPlayer())
10605 {
10606 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
10607 return false;
10608 }
10609 // check flags
10611 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
10612 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
10613 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
10614 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
10615 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
10616 return false;
10617
10618 // CvC case - can attack each other only when one of them is hostile
10620 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
10621
10622 // PvP, PvC, CvP case
10623 // can't attack friendly targets
10624 ReputationRank repThisToTarget = GetReactionTo(target);
10625 ReputationRank repTargetToThis;
10626
10627 if (repThisToTarget > REP_NEUTRAL
10628 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
10629 {
10630 // contested guards can attack contested PvP players even though players may be friendly
10631 if (!target->IsControlledByPlayer())
10632 return false;
10633
10634 bool isContestedGuard = false;
10635 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
10636 isContestedGuard = entry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS;
10637
10638 bool isContestedPvp = false;
10639 if (Player const* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
10640 isContestedPvp = player->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP);
10641
10642 if (!isContestedGuard || !isContestedPvp)
10643 return false;
10644 }
10645
10646 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
10647 if (repThisToTarget == REP_NEUTRAL &&
10648 repTargetToThis <= REP_NEUTRAL)
10649 {
10650 Player* owner = GetAffectingPlayer();
10651 Unit const* const thisUnit = owner ? owner : this;
10652 if (!(target->IsPlayer() && thisUnit->IsPlayer()) &&
10653 !(target->IsCreature() && thisUnit->IsCreature()))
10654 {
10655 Player const* player = target->IsPlayer() ? target->ToPlayer() : thisUnit->ToPlayer();
10656 Unit const* creature = target->IsCreature() ? target : thisUnit;
10657
10658 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
10659 {
10660 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
10661 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
10662 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
10663 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
10664 return false;
10665 }
10666 }
10667 }
10668
10669 Creature const* creatureAttacker = ToCreature();
10670 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
10671 return false;
10672
10673 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
10674 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
10675
10676 // check duel - before sanctuary checks
10677 if (playerAffectingAttacker && playerAffectingTarget)
10678 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
10679 return true;
10680
10681 // PvP case - can't attack when attacker or target are in sanctuary
10682 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
10683 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
10684 return false;
10685
10686 // additional checks - only PvP case
10687 if (playerAffectingAttacker && playerAffectingTarget)
10688 {
10689 if (IsAreaEffectPvPBlocked(target, bySpell))
10690 return false;
10691
10692 if (target->IsPvP())
10693 return true;
10694
10695 if (IsFFAPvP() && target->IsFFAPvP())
10696 return true;
10697
10699 }
10700 return true;
10701}
@ FACTION_FLAG_AT_WAR
Definition DBCEnums.h:308
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition DBCEnums.h:331
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition ObjectGuid.h:55
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:54
@ DUEL_STATE_IN_PROGRESS
Definition Player.h:359
@ PLAYER_FLAGS_CONTESTED_PVP
Definition Player.h:467
@ PLAYER_FLAGS_UBER
Definition Player.h:478
ReputationRank
Definition SharedDefines.h:156
@ REP_HOSTILE
Definition SharedDefines.h:158
@ UNIT_BYTE2_FLAG_UNK1
Definition UnitDefines.h:140
@ UNIT_FLAG_TAXI_FLIGHT
Definition UnitDefines.h:277
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition UnitDefines.h:273
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition UnitDefines.h:264
#define WORLD_TRIGGER
Definition Unit.h:39
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:207
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition Object.cpp:940
ReputationMgr & GetReputationMgr()
Definition Player.h:2157
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition ReputationMgr.h:81
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition ReputationMgr.h:106
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:6881
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:7550
bool HasStealthAura() const
Definition Unit.h:1860
bool IsInCombatWith(Unit const *who) const
Definition Unit.cpp:16828
bool IsImmuneToNPC() const
Definition Unit.h:943
bool IsAreaEffectPvPBlocked(Unit const *target, SpellInfo const *bySpell) const
Definition Unit.cpp:10558
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:7091
bool IsImmuneToPC() const
Definition Unit.h:941
bool IsInCombat() const
Definition Unit.h:949
uint32 type_flags
Definition CreatureData.h:219
Definition DBCStructure.h:943
Definition ReputationMgr.h:41
Definition DBCStructure.h:975

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), Vehicle::GetBase(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsAreaEffectPvPBlocked(), IsControlledByPlayer(), Object::IsCreature(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_CONTESTED_PVP, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), WorldObject::IsValidAttackTarget(), and Acore::AnyAoETargetUnitInObjectRangeCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect *  aurEff,
bool  apply 
)
4748{
4749 if (apply)
4750 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4751 else
4752 m_modAuras[aurEff->GetAuraType()].erase(std::remove(m_modAuras[aurEff->GetAuraType()].begin(), m_modAuras[aurEff->GetAuraType()].end(), aurEff), m_modAuras[aurEff->GetAuraType()].end());
4753}
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition Unit.h:2195

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject *  dynObj)
6323{
6324 m_dynObj.push_back(dynObj);
6325}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5577{
5578 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5579 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5580}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit *  pAttacker)
inlineprivate
Note
: Call only in Unit::Attack()
2253{ m_attackers.erase(pAttacker); }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura *  aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura *  aura,
bool  owned 
)
4725{
4726 //SpellInfo const* spellProto = aura->GetSpellInfo();
4727
4728 // passive spell special case (only non stackable with ranks)
4729
4730 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4731 // if (spellProto->IsPassiveStackableWithRanks())
4732 // return;
4733
4734 ASSERT(aura);
4735 if (!IsHighestExclusiveAura(aura))
4736 {
4737 aura->Remove();
4738 return;
4739 }
4740
4741 if (owned)
4742 RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); });
4743 else
4744 RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); });
4745}
bool CanStackWith(Aura const *existingAura) const
Definition SpellAuras.cpp:2061
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition Unit.cpp:4920
void RemoveOwnedAuras(std::function< bool(Aura const *)> const &check)
Definition Unit.cpp:4907
bool IsHighestExclusiveAura(Aura const *aura, bool removeOtherAuraApplications=false)
Definition Unit.cpp:4350

References ASSERT, Aura::CanStackWith(), AuraApplication::GetBase(), IsHighestExclusiveAura(), Aura::Remove(), RemoveAppliedAuras(), and RemoveOwnedAuras().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit *  caster,
int32 *  baseAmount = nullptr,
Item *  castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4412{
4413 ASSERT(casterGUID || caster);
4414 if (!casterGUID)
4415 casterGUID = caster->GetGUID();
4416
4417 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4418 if (!newAura->IsMultiSlotAura())
4419 {
4420 // check if cast item changed
4421 ObjectGuid castItemGUID;
4422 if (castItem)
4423 castItemGUID = castItem->GetGUID();
4424
4425 // find current aura from spell and change it's stackamount, or refresh it's duration
4426 // Use castItemGUID for passive auras (weapon imbues) and enchant procs so they can stack from dual-wield
4427 bool useItemGuid = newAura->IsPassive() || newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC);
4428 ObjectGuid itemGuidForLookup = (useItemGuid && castItemGUID) ? castItemGUID : ObjectGuid::Empty;
4429 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, itemGuidForLookup, 0))
4430 {
4431 // effect masks do not match
4432 // extremely rare case
4433 // let's just recreate aura
4434 if (effMask != foundAura->GetEffectMask())
4435 return nullptr;
4436
4437 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4438 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4439 {
4440 if (!foundAura->HasEffect(i))
4441 continue;
4442
4443 int bp;
4444 if (baseAmount)
4445 bp = *(baseAmount + i);
4446 else
4447 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4448
4449 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4450 *oldBP = bp;
4451 }
4452
4453 // correct cast item guid if needed
4454 if (castItemGUID != foundAura->GetCastItemGUID())
4455 {
4456 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4457 *oldGUID = castItemGUID;
4458 }
4459
4460 // try to increase stack amount
4461 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4462 foundAura->m_refreshTime = GameTime::GetGameTimeMS();
4463 sScriptMgr->OnAuraApply(this, foundAura);
4464 return foundAura;
4465 }
4466 }
4467
4468 return nullptr;
4469}
std::int32_t int32
Definition Define.h:103
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:177
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition SpellInfo.h:199
Definition ObjectGuid.h:121
static ObjectGuid const Empty
Definition ObjectGuid.h:123
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition Unit.cpp:4807
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:44

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, GameTime::GetGameTimeMS(), Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), SpellInfo::IsPassive(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, and sScriptMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication *  aurApp,
AuraRemoveMode  removeMode 
)
4704{
4705 // aura can be removed from unit only if it's applied on it, shouldn't happen
4706 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4707
4708 uint32 spellId = aurApp->GetBase()->GetId();
4709 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4710
4711 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4712 {
4713 if (iter->second == aurApp)
4714 {
4715 _UnapplyAura(iter, removeMode);
4716 return;
4717 }
4718 else
4719 ++iter;
4720 }
4721 ABORT();
4722}
#define ABORT
Definition Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition Unit.h:681
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition Unit.cpp:4608

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4609{
4610 AuraApplication* aurApp = i->second;
4611 ASSERT(aurApp);
4612 ASSERT(!aurApp->GetRemoveMode());
4613 ASSERT(aurApp->GetTarget() == this);
4614
4615 aurApp->SetRemoveMode(removeMode);
4616 Aura* aura = aurApp->GetBase();
4617 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4618
4619 // dead loop is killing the server probably
4620 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4621
4623
4624 Unit* caster = aura->GetCaster();
4625
4626 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4627 m_appliedAuras.erase(i);
4628
4629 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4630 // xinef: event if it gets removed, it will be reapplied in a second
4631 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4632 {
4633 m_interruptableAuras.remove(aurApp);
4635 }
4636
4637 bool auraStateFound = false;
4638 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4639 if (auraState)
4640 {
4641 bool canBreak = false;
4642 // Get mask of all aurastates from remaining auras
4643 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4644 {
4645 if (itr->second == aurApp)
4646 {
4647 m_auraStateAuras.erase(itr);
4648 itr = m_auraStateAuras.lower_bound(auraState);
4649 canBreak = true;
4650 continue;
4651 }
4652 auraStateFound = true;
4653 ++itr;
4654 }
4655 }
4656
4657 aurApp->_Remove();
4658 aura->_UnapplyForTarget(this, caster, aurApp);
4659
4660 // remove effects of the spell - needs to be done after removing aura from lists
4661 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4662 {
4663 if (aurApp->HasEffect(itr))
4664 aurApp->_HandleEffect(itr, false);
4665 }
4666
4667 // all effect mustn't be applied
4668 ASSERT(!aurApp->GetEffectMask());
4669
4670 // Remove totem at next update if totem loses its aura
4671 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4672 {
4673 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4675 }
4676
4677 // Remove aurastates only if needed and were not found
4678 if (auraState)
4679 {
4680 if (!auraStateFound)
4681 ModifyAuraState(auraState, false);
4682 else
4683 {
4684 // update for casters, some shouldn't 'see' the aura state
4685 uint32 aStateMask = (1 << (auraState - 1));
4686 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0)
4688 }
4689 }
4690
4691 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4692
4693 // only way correctly remove all auras from list
4694 //if (removedAuras != m_removedAurasCount) new aura may be added
4695 i = m_appliedAuras.begin();
4696
4697 sScriptMgr->OnAuraRemove(this, aurApp, removeMode);
4698
4699 if (this->ToCreature() && this->ToCreature()->IsAIEnabled)
4700 this->ToCreature()->AI()->OnAuraRemove(aurApp, removeMode);
4701}
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
@ TOTEM_PASSIVE
Definition Totem.h:25
Unit * GetTarget() const
Definition SpellAuras.h:62
void SetRemoveMode(AuraRemoveMode mode)
Definition SpellAuras.h:73
void _Remove()
Definition SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:68
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:472
virtual void OnAuraRemove(AuraApplication *, AuraRemoveMode)
Definition CreatureAI.h:268
CreatureAI * AI() const
Definition Creature.h:143
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition TemporarySummon.cpp:400
Totem * ToTotem()
Definition Unit.h:736
void UpdateInterruptMask()
Definition Unit.cpp:892
bool IsTotem() const
Definition Unit.h:805

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), Creature::AI(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsAIEnabled, IsTotem(), JustDied, LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), CreatureAI::OnAuraRemove(), PER_CASTER_AURA_STATE_MASK, Minion::setDeathState(), AuraApplication::SetRemoveMode(), sScriptMgr, Object::ToCreature(), TOTEM_PASSIVE, ToTotem(), UNIT_FIELD_AURASTATE, and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject *  dynObj)
6328{
6329 m_dynObj.remove(dynObj);
6330}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
3816{
3817 SpellInfo const* spellProto = nullptr;
3819 {
3821 }
3822
3823 if (!spellProto)
3824 {
3825 return;
3826 }
3827
3828 static uint32 const HUNTER_AUTOSHOOT = 75;
3829
3830 // Check "realtime" interrupts
3831 if ((IsPlayer() && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
3832 {
3833 // cancel wand shoot
3834 if (spellProto->Id != HUNTER_AUTOSHOOT)
3836 m_AutoRepeatFirstCast = true;
3837 return;
3838 }
3839
3840 // Apply delay (Hunter's autoshoot not affected)
3841 if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 && spellProto->Id != HUNTER_AUTOSHOOT)
3842 {
3844 }
3845
3846 m_AutoRepeatFirstCast = false;
3847
3848 // Check for ranged attack timer
3850 {
3852 if (result != SPELL_CAST_OK)
3853 {
3854 if (spellProto->Id != HUNTER_AUTOSHOOT)
3855 {
3857 }
3858
3859 return;
3860 }
3861
3862 // We want to shoot
3863 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
3864 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
3865
3866 // Reset attack
3868
3869 // Blizzlike: Reset melee swing timers when performing ranged attack
3872 }
3873}
SpellCastResult
Definition SharedDefines.h:936
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition SpellDefines.h:158
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:566
Definition Spell.h:298
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3590
SpellCastResult CheckCast(bool strict, uint32 *param1=nullptr, uint32 *param2=nullptr)
Definition Spell.cpp:5904
SpellInfo const *const m_spellInfo
Definition Spell.h:535
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4000
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4042
void setAttackTimer(WeaponAttackType type, int32 time)
Definition Unit.h:892
bool isMoving() const
Definition Unit.h:1728
int32 getAttackTimer(WeaponAttackType type) const
Definition Unit.h:894
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:895
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition Unit.cpp:769

References BASE_ATTACK, Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, OFF_ATTACK, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), and TRIGGERED_FULL_MASK.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected
3755{
3758
3759 // remove finished spells from current pointers
3760 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
3761 {
3762 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
3763 {
3765 m_currentSpells[i] = nullptr; // remove pointer
3766 }
3767 }
3768
3769 // snapshot - UpdateOwner can mutate the map; pointers stay valid (removed auras
3770 // are deleted later in _DeleteRemovedAuras)
3771 m_auraUpdateSnapshot.clear();
3772 m_auraUpdateSnapshot.reserve(m_ownedAuras.size());
3773 for (auto& [id, aura] : m_ownedAuras)
3774 m_auraUpdateSnapshot.push_back(aura);
3775
3776 for (Aura* aura : m_auraUpdateSnapshot)
3777 if (!aura->IsRemoved())
3778 aura->UpdateOwner(time, this);
3779
3780 // remove expired auras - do that after updates(used in scripts?)
3781 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
3782 {
3783 if (i->second->IsExpired())
3785 else if (i->second->GetSpellInfo()->IsChanneled() && i->second->GetCasterGUID() != GetGUID() && !ObjectAccessor::GetWorldObject(*this, i->second->GetCasterGUID()))
3786 RemoveOwnedAura(i, AURA_REMOVE_BY_CANCEL); // remove channeled auras when caster is not on the same map
3787 else
3788 ++i;
3789 }
3790
3791 for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
3792 if (itr->second->IsNeedClientUpdate())
3793 itr->second->ClientUpdate();
3794
3796
3797 if (!m_gameObj.empty())
3798 {
3799 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
3800 {
3801 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
3802 if (!go->isSpawned())
3803 {
3804 go->SetOwnerGUID(ObjectGuid::Empty);
3805 go->SetRespawnTime(0);
3806 go->Delete();
3807 m_gameObj.erase(itr++);
3808 continue;
3809 }
3810 ++itr;
3811 }
3812 }
3813}
@ AURA_REMOVE_BY_CANCEL
Definition SpellAuraDefines.h:393
@ SPELL_STATE_FINISHED
Definition Spell.h:239
Definition GameObject.h:125
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4756
void _UpdateAutoRepeatSpell()
Definition Unit.cpp:3815
VisibleAuraMap m_visibleAuras
Definition Unit.h:2205
std::vector< Aura * > m_auraUpdateSnapshot
Definition Unit.h:2192
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:208
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:139

References _DeleteRemovedAuras(), _UpdateAutoRepeatSpell(), AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, CURRENT_AUTOREPEAT_SPELL, CURRENT_MAX_SPELL, ObjectGuid::Empty, ObjectAccessor::GetGameObject(), Object::GetGUID(), ObjectAccessor::GetWorldObject(), m_auraUpdateSnapshot, m_currentSpells, m_gameObj, m_ownedAuras, m_visibleAuras, RemoveOwnedAura(), Spell::SetReferencedFromCurrent(), and SPELL_STATE_FINISHED.

Referenced by Update().

◆ AddAura() [1/2]

Aura * Unit::AddAura ( SpellInfo const *  spellInfo,
uint8  effMask,
Unit *  target 
)
14857{
14858 if (!spellInfo)
14859 return nullptr;
14860
14861 if (target->IsImmunedToSpell(spellInfo, effMask, this))
14862 return nullptr;
14863
14864 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
14865 {
14866 if (!(effMask & (1 << i)))
14867 continue;
14868 if (target->IsImmunedToSpellEffect(spellInfo, i, this))
14869 effMask &= ~(1 << i);
14870 }
14871
14872 if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this))
14873 {
14874 aura->ApplyForTargets();
14875 return aura;
14876 }
14877 return nullptr;
14878}
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition SpellAuras.cpp:270
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition Unit.cpp:9904
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) const
Definition Unit.cpp:9915

References Aura::ApplyForTargets(), IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, and Aura::TryRefreshStackOrCreate().

◆ AddAura() [2/2]

Aura * Unit::AddAura ( uint32  spellId,
Unit *  target 
)
14842{
14843 if (!target)
14844 return nullptr;
14845
14846 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
14847 if (!spellInfo)
14848 return nullptr;
14849
14850 if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
14851 return nullptr;
14852
14853 return AddAura(spellInfo, MAX_EFFECT_MASK, target);
14854}
#define MAX_EFFECT_MASK
Definition DBCStructure.h:1674
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition SharedDefines.h:444
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:376
#define sSpellMgr
Definition SpellMgr.h:851
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:441
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:14841

References AddAura(), SpellInfo::HasAttribute(), IsAlive(), MAX_EFFECT_MASK, SPELL_ATTR0_PASSIVE, SPELL_ATTR2_ALLOW_DEAD_TARGET, and sSpellMgr.

Referenced by boss_yoggsaron_keeper::Activate(), boss_flame_leviathan::ActivateTowers(), AddAura(), boss_grand_champion::AddCreatureAddonAuras(), Pet::AddToWorld(), ApplyEmpoweredStacks(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ApplyIccHealthBuff(), Player::ApplyItemDependentAuras(), boss_twin_valkyrAI::ApplyTwinEmpathy(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_pet_dk_ebon_gargoyle::AttackStart(), boss_anzu::boss_anzu(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoTriggersOnSpellHit(), npc_anubisath_sentinel::aqsentinelAI::GainSentinelAbility(), AuraEffect::HandleAuraDummy(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), gm_commandscript::HandleGMVisibleCommand(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_transitus_shield_beam_aura::HandleOnEffectApply(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pallid_horror::InitializeAI(), Guardian::InitStatsForLevel(), boss_gahzranka::JustEngagedWith(), boss_freya::JustEngagedWith(), npc_dalaran_warrior::npc_dalaran_warriorAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_hadronox::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Creature::LoadCreaturesAddon(), npc_brew_bubble::MoveInLineOfSight(), npc_pet_gen_plump_turkey::MovementInform(), instance_halls_of_reflection::OnCreatureCreate(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), AreaTrigger_at_area_52_entrance::OnTrigger(), Player::ProcessDelayedOperations(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_corrupted_totem::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_vengeful_shade::npc_vengeful_shadeAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_magus_telestra::Reset(), npc_hodirs_fury::Reset(), npc_mimirons_inferno::Reset(), boss_yoggsaron_immortal_guardian::Reset(), boss_archavon::boss_archavonAI::Reset(), boss_emalon::boss_emalonAI::Reset(), boss_koralon::boss_koralonAI::Reset(), boss_toravon::boss_toravonAI::Reset(), npc_dalaran_mage::npc_dalaran_mageAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Player::SendInitialPacketsAfterAddToMap(), npc_corrupted_totem::SetAura(), SetAuraStack(), Player::SetGMVisible(), Player::SetIsSpectator(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_overlord_drakuru_betrayal::SpellHitTarget(), boss_netherspite::SwitchToPortalPhase(), spell_pal_immunities::TriggerDebuffs(), boss_gyth::UpdateAI(), boss_pyroguard_emberseer::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), boss_netherspite::UpdatePortals(), and npc_emily::npc_emilyAI::WaypointReached().

◆ AddComboPointHolder()

void Unit::AddComboPointHolder ( Unit *  unit)
inline
1037{ m_ComboPointHolders.insert(unit); }
std::unordered_set< Unit * > m_ComboPointHolders
Definition Unit.h:2267

References m_ComboPointHolders.

Referenced by AddComboPoints().

◆ AddComboPoints() [1/2]

void Unit::AddComboPoints ( int8  count)
inline
1034{ AddComboPoints(nullptr, count); }
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:12930

References AddComboPoints().

Referenced by AddComboPoints().

◆ AddComboPoints() [2/2]

void Unit::AddComboPoints ( Unit *  target,
int8  count 
)
12931{
12932 if (!count)
12933 {
12934 return;
12935 }
12936
12937 if (target && target != m_comboTarget)
12938 {
12939 if (m_comboTarget)
12940 {
12942 }
12943
12944 m_comboTarget = target;
12945 m_comboPoints = count;
12946 target->AddComboPointHolder(this);
12947 }
12948 else
12949 {
12950 m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5), 0);
12951 }
12952
12954}
void SendComboPoints()
Definition Unit.cpp:12973
void AddComboPointHolder(Unit *unit)
Definition Unit.h:1037
void RemoveComboPointHolder(Unit *unit)
Definition Unit.h:1038

References AddComboPointHolder(), m_comboPoints, m_comboTarget, RemoveComboPointHolder(), and SendComboPoints().

Referenced by AuraEffect::HandleAuraRetainComboPoints(), and ProcSkillsAndReactives().

◆ AddExtraAttacks()

void Unit::AddExtraAttacks ( uint32  count)
2968{
2970 if (!targetGUID)
2971 {
2972 if (ObjectGuid selection = GetTarget())
2973 {
2974 targetGUID = selection; // Spell was cast directly (not triggered by aura)
2975 }
2976 else
2977 return;
2978 }
2979
2980 extraAttacksTargets[targetGUID] += count;
2981}
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
Definition Unit.h:2277
ObjectGuid _lastDamagedTargetGuid
Definition Unit.h:2278
ObjectGuid GetTarget() const
Definition Unit.h:867

References _lastDamagedTargetGuid, extraAttacksTargets, and GetTarget().

Referenced by Spell::EffectAddExtraAttacks().

◆ AddExtraUnitMovementFlag()

void Unit::AddExtraUnitMovementFlag ( uint16  f)
inline
784{ m_movementInfo.flags2 |= f; }
MovementInfo m_movementInfo
Definition Object.h:711
uint16 flags2
Definition Object.h:299

References MovementInfo::flags2, and WorldObject::m_movementInfo.

Referenced by Vehicle::InitMovementInfoForBase().

◆ AddGameObject()

void Unit::AddGameObject ( GameObject *  gameObj)
6384{
6385 if (!gameObj || gameObj->GetOwnerGUID())
6386 return;
6387
6388 m_gameObj.push_back(gameObj->GetGUID());
6389 gameObj->SetOwnerGUID(GetGUID());
6390
6391 if (IsPlayer() && gameObj->GetSpellId())
6392 {
6393 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
6394 // Need disable spell use for owner
6395 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6396 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6397 ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
6398 }
6399}
ObjectGuid GetOwnerGUID() const override
Definition GameObject.h:179
uint32 GetSpellId() const
Definition GameObject.h:188
void SetOwnerGUID(ObjectGuid owner)
Definition GameObject.h:169
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:11141
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1257

References Player::AddSpellAndCategoryCooldowns(), Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, GameObject::SetOwnerGUID(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectTransmitted(), npc_midsummer_bonfire::Ignite(), and WorldObject::SummonGameObject().

◆ AddInterruptMask()

void Unit::AddInterruptMask ( uint32  mask)
inline
1621{ m_interruptMask |= mask; }

References m_interruptMask.

Referenced by _CreateAuraApplication(), and Spell::handle_immediate().

◆ AddPetAura()

void Unit::AddPetAura ( PetAura const *  petSpell)
13402{
13403 if (!IsPlayer())
13404 return;
13405
13406 m_petAuras.insert(petSpell);
13407 if (Pet* pet = ToPlayer()->GetPet())
13408 pet->CastPetAura(petSpell);
13409 else if (Unit* charm = GetCharm())
13410 charm->CastPetAura(petSpell);
13411}
Definition Pet.h:41
Unit * GetCharm() const
Definition Unit.cpp:7605
PetAuraSet m_petAuras
Definition Unit.h:2115
Pet * GetPet(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:239

References GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Spell::EffectDummy(), and AuraEffect::HandleAuraDummy().

◆ AddPlayerToVision()

void Unit::AddPlayerToVision ( Player *  player)
8116{
8117 if (m_sharedVision.empty())
8118 setActive(true);
8119
8120 m_sharedVision.push_back(player);
8121 player->m_isInSharedVisionOf.insert(this);
8122}
void setActive(bool isActiveObject)
Definition Object.cpp:1091

References Player::m_isInSharedVisionOf, m_sharedVision, and WorldObject::setActive().

◆ AddPointedBy()

void Unit::AddPointedBy ( SafeUnitPointer *  sup)
inline
2043{ SafeUnitPointerSet.insert(sup); }
std::set< SafeUnitPointer * > SafeUnitPointerSet
Definition Unit.h:2125

References SafeUnitPointerSet.

Referenced by SafeUnitPointer::SetPointedTo().

◆ AddSpellCooldown()

virtual void Unit::AddSpellCooldown ( uint32  ,
uint32  ,
uint32  ,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
inlinevirtual

Reimplemented in Player, and Creature.

1355 {
1356 // workaround for unused parameters
1357 (void)needSendToClient;
1358 (void)forceSendToSpectator;
1359 }

Referenced by spell_yogg_saron_protective_gaze_aura::Absorb(), Spell::DoSpellHitOnUnit(), spell_valkyr_special_2_dummy_cooldown::HandleDummy(), spell_sha_earth_shield::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), and spell_dk_wandering_plague_aura::HandleProc().

◆ AddThreat()

void Unit::AddThreat ( Unit *  victim,
float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
11285{
11286 // Only mobs can manage threat lists
11288 {
11289 m_threatManager.AddThreat(victim, fThreat, threatSpell);
11290 }
11291}
@ UNIT_STATE_EVADE
Definition UnitDefines.h:194
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
Definition ThreatManager.cpp:410
bool HasUnitState(const uint32 f) const
Definition Unit.h:742
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:11265

References ThreatManager::AddThreat(), CanHaveThreatList(), HasUnitState(), m_threatManager, and UNIT_STATE_EVADE.

Referenced by npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alythess::AttackStart(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::AttackStart(), npc_capernian::AttackStart(), npc_zuljin_vortex::ChangeToNewPlayer(), npc_dirt_mound::ChaseNewTarget(), boss_buru::ChaseNewVictim(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DamageTaken(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::DamageTaken(), boss_thorim::DamageTaken(), DealDamage(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::DoAction(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), npc_raging_flames::FixateRandomTarget(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), spell_morogrim_tidewalker_water_globule_new_target::HandleDummy(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_ulduar_random_aggro_periodic::HandleEffectPeriodic(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_pursue::HandleScript(), npc_tiger_matriarch::npc_tiger_matriarchAI::IsSummonedBy(), npc_little_ooze::npc_little_oozeAI::IsSummonedBy(), npc_malchezaar_axe::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_buru::JustEngagedWith(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::JustSummoned(), boss_curator::JustSummoned(), boss_sacrolash::JustSummoned(), boss_devourer_of_souls::JustSummoned(), npc_akama_illidan::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_shade_of_akama::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_mage_mirror_image::MySelectNextTarget(), boss_razorgore::OnCharmed(), RemoveCharmedBy(), npc_dark_fiend::Reset(), npc_swarm_scarab::Reset(), boss_skarvald_the_constructor::Reset(), boss_dalronn_the_controller::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_grand_champion::ScheduleChampionAbilities(), boss_romulo::ScheduleCombat(), npc_thaladred::ScheduleEvents(), npc_toc5_grand_champion_minion::ScheduleMountAbilities(), boss_grand_champion::ScheduleMountAbilities(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), boss_supremus::SchedulePhase(), boss_thorim_arena_npcs::SelectT(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), boss_eck::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), npc_vaelastrasz_the_red::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_fel_infernal::UpdateAI(), npc_shadowy_mercenary::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), npc_molten_golem::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), and npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI().

◆ AddToWorld()

void Unit::AddToWorld ( )
overridevirtual

Reimplemented from Object.

12233{
12234 if (!IsInWorld())
12235 {
12237 }
12238}
void AddToWorld() override
Definition Object.cpp:1223

References WorldObject::AddToWorld(), and Object::IsInWorld().

Referenced by Creature::AddToWorld(), Pet::AddToWorld(), and Player::AddToWorld().

◆ AddUnitMovementFlag()

◆ AddUnitState()

void Unit::AddUnitState ( uint32  f)
inline
741{ m_state |= f; }

References m_state.

Referenced by CreatureAI::_EnterEvadeMode(), _ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), MotionTransport::AddPassenger(), Attack(), boss_prince_keleseth_icc::boss_prince_kelesethAI::boss_prince_kelesethAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::boss_prince_taldaramAI(), boss_prince_valanar_icc::boss_prince_valanarAI::boss_prince_valanarAI(), Creature::Create(), MotionTransport::CreateNPCPassenger(), boss_black_knight::DamageTaken(), boss_thorim::DisableThorim(), boss_nightbane::DoAction(), WaypointMovementGenerator< Creature >::DoInitialize(), RandomMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::EnableSara(), boss_jindo::EnterEvadeMode(), SmartAI::EnterEvadeMode(), Creature::FocusTarget(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetCastSpellOpcode(), RotateMovementGenerator::Initialize(), DistractMovementGenerator::Initialize(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_plague_cauldron_ghoul::IsSummonedBy(), FormationMovementGenerator::LaunchMovement(), Player::LoadFromDB(), boss_ayamiss::MovementInform(), boss_lady_vashj::MovementInform(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pet_gen_wind_rider_cub::npc_pet_gen_wind_rider_cub(), npc_corrupted_totem::Reset(), boss_jedoga_shadowseeker::Reset(), npc_ulduar_mimiron_rocket::Reset(), boss_hungarfen::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetContestedPvP(), SetControlled(), SetCurrentCastedSpell(), Player::SetIsSpectator(), SetRooted(), boss_urom::boss_uromAI::SpellHit(), WaypointMovementGenerator< Creature >::StartMove(), TEST_F(), npc_madrigosa::UpdateAI(), boss_devourer_of_souls::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and boss_svala::boss_svalaAI::UpdateAI().

◆ AddUnitTypeMask()

void Unit::AddUnitTypeMask ( uint32  mask)
inline
748{ m_unitTypeMask |= mask; }

References m_unitTypeMask.

◆ ApplyAttackTimePercentMod()

void Unit::ApplyAttackTimePercentMod ( WeaponAttackType  att,
float  val,
bool  apply 
)
13152{
13154
13155 float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
13156 if (val > 0.f)
13157 {
13159 ApplyPercentModFloatVar(amount, val, !apply);
13160 }
13161 else
13162 {
13164 ApplyPercentModFloatVar(amount, -val, apply);
13165 }
13167 m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
13168}
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition Unit.cpp:13146
@ UNIT_FIELD_BASEATTACKTIME
Definition UpdateFields.h:120
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:610
float GetFloatValue(uint16 index) const
Definition Object.cpp:315
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:735
uint32 GetAttackTime(WeaponAttackType att) const
Definition Unit.h:923

References ApplyPercentModFloatVar(), AsUnderlyingType(), GetAttackTime(), Object::GetFloatValue(), m_attackTimer, m_modAttackSpeedPct, Object::SetFloatValue(), and UNIT_FIELD_BASEATTACKTIME.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleAuraModRangedHaste(), AuraEffect::HandleModAttackSpeed(), AuraEffect::HandleModCombatSpeedPct(), AuraEffect::HandleModMeleeRangedSpeedPct(), AuraEffect::HandleModMeleeSpeedPct(), AuraEffect::HandleRangedAmmoHaste(), and TEST_F().

◆ ApplyCastTimePercentMod()

void Unit::ApplyCastTimePercentMod ( float  val,
bool  apply 
)
13171{
13172 float amount = GetFloatValue(UNIT_MOD_CAST_SPEED);
13173
13174 if (val > 0.f)
13175 ApplyPercentModFloatVar(amount, val, !apply);
13176 else
13177 ApplyPercentModFloatVar(amount, -val, apply);
13178
13180}
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137

References ApplyPercentModFloatVar(), Object::GetFloatValue(), Object::SetFloatValue(), and UNIT_MOD_CAST_SPEED.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleModCastingSpeed(), and AuraEffect::HandleModCombatSpeedPct().

◆ ApplyDiminishingAura()

void Unit::ApplyDiminishingAura ( DiminishingGroup  group,
bool  apply 
)
11555{
11556 // Checking for existing in the table
11557 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
11558 {
11559 if (i->DRGroup != group)
11560 continue;
11561
11562 if (apply)
11563 i->stack += 1;
11564 else if (i->stack)
11565 {
11566 i->stack -= 1;
11567 // Remember time after last aura from group removed
11568 if (i->stack == 0)
11569 i->hitTime = GameTime::GetGameTimeMS().count();
11570 }
11571 break;
11572 }
11573}
Diminishing m_Diminishing
Definition Unit.h:2261

References GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by UnitAura::_ApplyForTarget(), and UnitAura::_UnapplyForTarget().

◆ ApplyDiminishingToDuration()

float Unit::ApplyDiminishingToDuration ( DiminishingGroup  group,
int32 &  duration,
Unit *  caster,
DiminishingLevels  Level,
int32  limitduration 
)
11476{
11477 // xinef: dont apply diminish to self casts
11478 if (duration == -1 || group == DIMINISHING_NONE)
11479 return 1.0f;
11480
11481 // test pet/charm masters instead pets/charmeds
11482 Unit const* targetOwner = GetOwner();
11483 Unit const* casterOwner = caster->GetOwner();
11484
11485 // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
11486 if (limitduration > 0 && duration > limitduration)
11487 {
11488 Unit const* target = targetOwner ? targetOwner : this;
11489 Unit const* source = casterOwner ? casterOwner : caster;
11490
11491 if ((target->IsPlayer()
11493 && source->IsPlayer())
11494 duration = limitduration;
11495 }
11496
11497 float mod = 1.0f;
11498
11499 if (group == DIMINISHING_TAUNT)
11500 {
11502 {
11503 DiminishingLevels diminish = Level;
11504 switch (diminish)
11505 {
11507 break;
11509 mod = 0.65f;
11510 break;
11512 mod = 0.4225f;
11513 break;
11515 mod = 0.274625f;
11516 break;
11518 mod = 0.0f;
11519 break;
11520 default:
11521 break;
11522 }
11523 }
11524 }
11525 // Some diminishings applies to mobs too (for example, Stun)
11527 && ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer()))
11528 || (IsCreature() && ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_ALL_DIMINISH))))
11530 {
11531 DiminishingLevels diminish = Level;
11532 switch (diminish)
11533 {
11535 break;
11537 mod = 0.5f;
11538 break;
11540 mod = 0.25f;
11541 break;
11543 mod = 0.0f;
11544 break;
11545 default:
11546 break;
11547 }
11548 }
11549
11550 duration = int32(duration * mod);
11551 return mod;
11552}
@ CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS
Definition CreatureData.h:65
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
Definition CreatureData.h:66
@ Level
Requires the player to be at least a specific level.
@ DIMINISHING_NONE
Definition SharedDefines.h:3491
@ DIMINISHING_TAUNT
Definition SharedDefines.h:3509
@ DRTYPE_PLAYER
Definition SharedDefines.h:3484
@ DRTYPE_ALL
Definition SharedDefines.h:3485
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
Definition SpellMgr.cpp:294
DiminishingLevels
Definition Unit.h:276
@ DIMINISHING_LEVEL_3
Definition Unit.h:279
@ DIMINISHING_LEVEL_1
Definition Unit.h:277
@ DIMINISHING_LEVEL_4
Definition Unit.h:281
@ DIMINISHING_LEVEL_IMMUNE
Definition Unit.h:280
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition Unit.h:282
@ DIMINISHING_LEVEL_2
Definition Unit.h:278
bool HasFlagsExtra(uint32 flag) const
Definition Creature.h:76

References CREATURE_FLAG_EXTRA_ALL_DIMINISH, CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS, DIMINISHING_LEVEL_1, DIMINISHING_LEVEL_2, DIMINISHING_LEVEL_3, DIMINISHING_LEVEL_4, DIMINISHING_LEVEL_IMMUNE, DIMINISHING_LEVEL_TAUNT_IMMUNE, DIMINISHING_NONE, DIMINISHING_TAUNT, DRTYPE_ALL, DRTYPE_PLAYER, GetDiminishingReturnsGroupType(), GetOwner(), Creature::HasFlagsExtra(), Object::IsCreature(), Object::IsPlayer(), Level, and Object::ToCreature().

Referenced by Spell::DoSpellHitOnUnit().

◆ ApplyEffectModifiers()

float Unit::ApplyEffectModifiers ( SpellInfo const *  spellProto,
uint8  effect_index,
float  value 
) const
11414{
11415 if (Player* modOwner = GetSpellModOwner())
11416 {
11417 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
11418 switch (effect_index)
11419 {
11420 case 0:
11421 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
11422 break;
11423 case 1:
11424 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
11425 break;
11426 case 2:
11427 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
11428 break;
11429 }
11430 }
11431 return value;
11432}
@ SPELLMOD_EFFECT2
Definition SpellDefines.h:96
@ SPELLMOD_ALL_EFFECTS
Definition SpellDefines.h:92
@ SPELLMOD_EFFECT3
Definition SpellDefines.h:107
@ SPELLMOD_EFFECT1
Definition SpellDefines.h:87
Player * GetSpellModOwner() const override
Definition Unit.cpp:12653

References GetSpellModOwner(), SpellInfo::Id, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, and SPELLMOD_EFFECT3.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellEffectInfo::CalcValue(), and Spell::EffectSchoolDMG().

◆ ApplyResilience()

void Unit::ApplyResilience ( Unit const *  victim,
float *  crit,
int32 *  damage,
bool  isCrit,
CombatRating  type 
)
static
14906{
14907 // player mounted on multi-passenger mount is also classified as vehicle
14908 if (victim->IsVehicle() && !victim->IsPlayer())
14909 return;
14910
14911 Unit const* target = nullptr;
14912 if (victim->IsPlayer())
14913 target = victim;
14914 else if (victim->IsCreature())
14915 {
14916 if (Unit* owner = victim->GetOwner())
14917 if (owner->IsPlayer())
14918 target = owner;
14919 }
14920
14921 if (!target)
14922 return;
14923
14924 switch (type)
14925 {
14927 // Crit chance reduction works against nonpets
14928 if (crit)
14929 *crit -= target->GetMeleeCritChanceReduction();
14930 if (damage)
14931 {
14932 if (isCrit)
14933 *damage -= target->GetMeleeCritDamageReduction(*damage);
14934 *damage -= target->GetMeleeDamageReduction(*damage);
14935 }
14936 break;
14938 // Crit chance reduction works against nonpets
14939 if (crit)
14940 *crit -= target->GetRangedCritChanceReduction();
14941 if (damage)
14942 {
14943 if (isCrit)
14944 *damage -= target->GetRangedCritDamageReduction(*damage);
14945 *damage -= target->GetRangedDamageReduction(*damage);
14946 }
14947 break;
14949 // Crit chance reduction works against nonpets
14950 if (crit)
14951 *crit -= target->GetSpellCritChanceReduction();
14952 if (damage)
14953 {
14954 if (isCrit)
14955 *damage -= target->GetSpellCritDamageReduction(*damage);
14956 *damage -= target->GetSpellDamageReduction(*damage);
14957 }
14958 break;
14959 default:
14960 break;
14961 }
14962}
@ CR_CRIT_TAKEN_RANGED
Definition Unit.h:246
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:247
@ CR_CRIT_TAKEN_MELEE
Definition Unit.h:245
float GetSpellCritChanceReduction() const
Definition Unit.h:1289
float GetRangedCritChanceReduction() const
Definition Unit.h:1288
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1293
float GetMeleeCritChanceReduction() const
Definition Unit.h:1287
uint32 GetRangedDamageReduction(uint32 damage) const
Definition Unit.h:1281
uint32 GetRangedCritDamageReduction(uint32 damage) const
Definition Unit.h:1292
uint32 GetMeleeCritDamageReduction(uint32 damage) const
Definition Unit.h:1291
uint32 GetSpellDamageReduction(uint32 damage) const
Definition Unit.h:1282
uint32 GetMeleeDamageReduction(uint32 damage) const
Definition Unit.h:1280

References CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, GetMeleeCritChanceReduction(), GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetOwner(), GetRangedCritChanceReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritChanceReduction(), GetSpellCritDamageReduction(), GetSpellDamageReduction(), Object::IsCreature(), Object::IsPlayer(), and IsVehicle().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetUnitCriticalChance(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and SpellTakenCritChance().

◆ ApplySpellImmune()

void Unit::ApplySpellImmune ( uint32  spellId,
uint32  op,
uint32  type,
bool  apply,
SpellImmuneBlockType  blockType = SPELL_BLOCK_TYPE_ALL 
)
10264{
10265 if (apply)
10266 {
10267 // Immunities with spellId 0 are applied by scripts and are meant to exist only once per type.
10268 if (!spellId)
10269 {
10270 auto bounds = m_spellImmune[op].equal_range(type);
10271 for (auto itr = bounds.first; itr != bounds.second; ++itr)
10272 if (!itr->second)
10273 return;
10274 }
10275
10276 m_spellImmune[op].emplace(type, spellId);
10277 }
10278 else
10279 {
10280 // Remove a single entry: the same spell can be applied by several casters at once (e.g. the four
10281 // Magic Barrier channels on Lady Vashj), and each removal must drop only the application it belongs to.
10282 auto bounds = m_spellImmune[op].equal_range(type);
10283 for (auto itr = bounds.first; itr != bounds.second; ++itr)
10284 {
10285 if (itr->second == spellId)
10286 {
10287 m_spellImmune[op].erase(itr);
10288 break;
10289 }
10290 }
10291 }
10292}
SpellImmuneContainer m_spellImmune[MAX_SPELL_IMMUNITY]
Definition Unit.h:2110

References m_spellImmune.

Referenced by Vehicle::ApplyAllImmunities(), SpellInfo::ApplyAllSpellImmunitiesTo(), boss_kelidan_the_breaker::ApplyImmunities(), ApplyMechanicImmune(), boss_anubarak_trial::boss_anubarak_trial(), boss_grand_champion::boss_grand_champion(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_sindragosa::boss_sindragosaAI::boss_sindragosaAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_void_reaver::boss_void_reaver(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_auriaya::ExecuteEvent(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModEffectImmunity(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), spell_q13007_iron_colossus::HandleDummy(), spell_love_in_air_perfume_immune::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_dk_anti_magic_shell_self::HandleEffectApply(), spell_dk_army_of_the_dead_passive::HandleEffectApply(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_pet_intellect_spirit_resilience_scaling::HandleEffectApply(), spell_pet_spellhit_expertise_spellpen_scaling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), spell_love_in_air_perfume_immune::HandleEffectRemove(), spell_dk_anti_magic_shell_self::HandleEffectRemove(), spell_illidan_shadow_prison_aura::HandleOnEffectApply(), spell_illidan_shadow_prison_aura::HandleOnEffectRemove(), npc_hyjal_jaina::hyjalJainaAI::hyjalJainaAI(), boss_hydross_the_unstable::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Player::LoadFromDB(), Creature::LoadTemplateImmunities(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_frost_sphere::npc_frost_sphere(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_necrotic_shard::npc_necrotic_shard(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyer(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnCreatureCreate(), boss_yoggsaron_constrictor_tentacle::PassengerBoarded(), boss_flame_leviathan_seat::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_chesspiece::Reset(), boss_curator::Reset(), boss_shade_of_aran::Reset(), npc_sanguine_spirit::Reset(), boss_felblood_kaelthas::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_auriaya::Reset(), boss_flame_leviathan::Reset(), boss_supremus::Reset(), boss_kaelthas::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), boss_supremus::SchedulePhase(), boss_hydross_the_unstable::SetForm(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), and Creature::UpdateEntry().

◆ ApplyStatPctModifier()

void Unit::ApplyStatPctModifier ( UnitMods  unitMod,
UnitModifierPctType  modifierType,
float  amount 
)
11663{
11664 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_PCT_END)
11665 {
11666 LOG_ERROR("entities.unit", "ERROR in ApplyStatPctModifier(): non-existing UnitMods or wrong UnitModifierType!");
11667 return;
11668 }
11669
11670 if (!pct)
11671 return;
11672
11673 switch (modifierType)
11674 {
11675 case BASE_PCT:
11676 case TOTAL_PCT:
11677 AddPct(m_auraPctModifiersGroup[unitMod][modifierType], pct);
11678 break;
11679 default:
11680 break;
11681 }
11682
11683 UpdateUnitMod(unitMod);
11684}
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
@ MODIFIER_TYPE_PCT_END
Definition Unit.h:140
T AddPct(T &base, U pct)
Definition Util.h:58
void UpdateUnitMod(UnitMods unitMod)
Definition Unit.cpp:11726

References AddPct(), BASE_PCT, LOG_ERROR, m_auraPctModifiersGroup, MODIFIER_TYPE_PCT_END, TOTAL_PCT, UNIT_MOD_END, and UpdateUnitMod().

Referenced by boss_marli::_schedulePhaseSpider(), boss_marli::_schedulePhaseTroll(), AuraEffect::HandleAuraIncreaseBaseHealthPercent(), AuraEffect::HandleAuraModAttackPowerPercent(), AuraEffect::HandleAuraModBaseResistancePCT(), AuraEffect::HandleAuraModIncreaseEnergyPercent(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModRangedAttackPowerPercent(), AuraEffect::HandleModPercentStat(), spell_astromancer_solarian_transform::OnApply(), spell_astromancer_solarian_transform::OnRemove(), boss_arlokk::boss_arlokkAI::Reset(), boss_marli::Reset(), and boss_arlokk::boss_arlokkAI::UpdateAI().

◆ AtDisengage()

virtual void Unit::AtDisengage ( )
inlinevirtual

Reimplemented in Creature.

980{}

Referenced by Creature::AtDisengage(), and CombatManager::UpdateOwnerCombatState().

◆ AtEngage()

void Unit::AtEngage ( Unit *  target)
virtual

Reimplemented in Creature.

7407{
7409 {
7412 }
7413}
@ MOTION_SLOT_CONTROLLED
Definition MotionMaster.h:66
@ UNIT_STATE_DISTRACTED
Definition UnitDefines.h:185
void MovementExpiredOnSlot(MovementSlot slot, bool reset=true)
Definition MotionMaster.h:221
void ClearUnitState(uint32 f)
Definition Unit.h:743

References ClearUnitState(), GetMotionMaster(), HasUnitState(), MOTION_SLOT_CONTROLLED, MotionMaster::MovementExpiredOnSlot(), and UNIT_STATE_DISTRACTED.

Referenced by Creature::AtEngage(), and CombatManager::UpdateOwnerCombatState().

◆ AtEnterCombat()

virtual void Unit::AtEnterCombat ( )
inlinevirtual

◆ AtExitCombat()

void Unit::AtExitCombat ( )
virtual

Reimplemented in Player.

7401{
7403 sScriptMgr->OnUnitExitCombat(this);
7404}
@ AURA_INTERRUPT_FLAG_LEAVE_COMBAT
Definition SpellDefines.h:77

References AURA_INTERRUPT_FLAG_LEAVE_COMBAT, RemoveAurasWithInterruptFlags(), and sScriptMgr.

Referenced by Player::AtExitCombat(), and CombatManager::UpdateOwnerCombatState().

◆ Attack()

bool Unit::Attack ( Unit *  victim,
bool  meleeAttack 
)
Todo:
: Implement aggro range, detection range and assistance range templates
7128{
7129 if (!victim || victim == this)
7130 return false;
7131
7132 // dead units can neither attack nor be attacked
7133 if (!IsAlive() || !victim->IsAlive())
7134 return false;
7135
7136 // pussywizard: check map, world, phase >_> multithreading crash fix
7137 if (!IsInMap(victim) || !InSamePhase(victim))
7138 return false;
7139
7140 // player cannot attack in mount state
7141 if (IsPlayer() && IsMounted())
7142 return false;
7143
7144 // creatures cannot attack while evading
7145 Creature* creature = ToCreature();
7146 if (creature && creature->IsInEvadeMode())
7147 {
7148 return false;
7149 }
7150
7151 // creatures should not try to attack the player during polymorph
7152 if (creature && creature->IsPolymorphed())
7153 {
7154 return false;
7155 }
7156
7157 //if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
7158 // return false;
7159
7160 // nobody can attack GM in GM-mode
7161 if (victim->IsPlayer())
7162 {
7163 if (victim->ToPlayer()->IsGameMaster())
7164 return false;
7165 }
7166 else
7167 {
7168 if (victim->ToCreature()->IsEvadingAttacks())
7169 return false;
7170 }
7171
7172 // Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
7174 return false;
7175
7176 // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
7177 if (HasUnattackableAura())
7179
7180 bool const isNewAttack = !m_attacking;
7181
7182 if (m_attacking)
7183 {
7184 if (m_attacking == victim)
7185 {
7186 // switch to melee attack from ranged/magic
7187 if (meleeAttack)
7188 {
7190 {
7192 SendMeleeAttackStart(victim);
7193 return true;
7194 }
7195 }
7197 {
7199 SendMeleeAttackStop(victim);
7200 return true;
7201 }
7202 return false;
7203 }
7204
7205 // switch target
7206 InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
7207 if (!meleeAttack)
7209 }
7210
7211 if (m_attacking)
7213
7214 m_attacking = victim;
7216
7217 // Set our target
7218 SetTarget(victim->GetGUID());
7219
7220 if (meleeAttack)
7222
7223 Unit* owner = GetCharmerOrOwner();
7224 Creature* ownerCreature = owner ? owner->ToCreature() : nullptr;
7225 Creature* controlledCreatureWithSameVictim = nullptr;
7226 if (creature && !m_Controlled.empty())
7227 {
7228 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7229 {
7230 if ((*itr)->ToCreature() && (*itr)->GetVictim() == victim)
7231 {
7232 controlledCreatureWithSameVictim = (*itr)->ToCreature();
7233 break;
7234 }
7235 }
7236 }
7237
7238 // Share leash timer with controlled unit
7239 if (controlledCreatureWithSameVictim)
7240 creature->SetLastLeashExtensionTimePtr(controlledCreatureWithSameVictim->GetLastLeashExtensionTimePtr());
7241 // Share leash timer with owner
7242 else if (creature && ownerCreature && ownerCreature->GetVictim() == victim)
7244 // Update leash timer when attacking creatures
7245 else if (victim->IsCreature())
7247
7248 // Player-controlled creatures (pets, charms) enter combat on contact instead
7249 // (melee swing execution or spell launch/hit, see Unit::AtTargetAttacked).
7250 // Non-controllable guardians (e.g. Shaman Elementals, Infernal) have no attack
7251 // command and must engage immediately so their AI can chase and attack.
7252
7253 if (creature && (!IsControlledByPlayer() || (IsGuardian() && !IsControllableGuardian())))
7254 {
7255 EngageWithTarget(victim);
7256
7257 if (!IsControlledByPlayer())
7258 {
7260
7263 creature->CallAssistance();
7264
7266
7268 }
7269 }
7270
7271 // delay offhand weapon attack by 50% of the base attack time, on a new attack only
7272 // unlike the timer writes this replaced, this runs once per attack start rather than once
7273 // per swing, so it staggers the offhand without locking the two swing intervals together
7274 if (isNewAttack && HasOffhandWeaponForAttack())
7276
7277 if (meleeAttack)
7278 SendMeleeAttackStart(victim);
7279
7280 return true;
7281}
@ CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE
Definition CreatureData.h:71
@ EMOTE_ONESHOT_NONE
Definition SharedDefines.h:1898
@ AI_REACTION_HOSTILE
Definition SharedDefines.h:3475
@ SPELL_AURA_MOD_UNATTACKABLE
Definition SpellAuraDefines.h:156
@ UNIT_STATE_MELEE_ATTACKING
Definition UnitDefines.h:174
@ CURRENT_MELEE_SPELL
Definition Unit.h:563
@ UNIT_NPC_EMOTESTATE
Definition UpdateFields.h:140
T CalculatePct(T base, U pct)
Definition Util.h:52
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition WorldConfig.h:242
void CallAssistance(Unit *target=nullptr)
Definition Creature.cpp:2504
bool IsEvadingAttacks() const
Definition Creature.h:138
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition Creature.cpp:3769
void UpdateLeashExtensionTime()
Definition Creature.cpp:3791
void SetAssistanceTimer(uint32 value)
Definition Creature.h:431
void SetLastLeashExtensionTimePtr(std::shared_ptr< time_t > const &timer)
Definition Creature.cpp:3776
void SendAIReaction(AiReaction reactionType)
Definition Creature.cpp:2492
bool IsInEvadeMode() const
Definition Creature.h:137
bool IsGameMaster() const
Definition Player.h:1178
bool HasOffhandWeaponForAttack() const
Definition Unit.h:1004
bool IsPolymorphed() const
Definition Unit.cpp:12832
void _removeAttacker(Unit *pAttacker)
Definition Unit.h:2253
void _addAttacker(Unit *pAttacker)
Definition Unit.h:2252
bool HasUnattackableAura() const
Definition Unit.h:1852
Unit * GetCharmerOrOwner() const
Definition Unit.h:1303
void EngageWithTarget(Unit *who)
Definition Unit.cpp:7353
bool IsMounted() const
Definition Unit.h:1908
bool IsGuardian() const
Definition Unit.h:801
Unit * GetVictim() const
Definition Unit.h:910
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition Unit.cpp:3262
bool IsControllableGuardian() const
Definition Unit.h:802
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:17106
bool IsControlledByPlayer() const
Definition Unit.h:1324
bool HasSpiritOfRedemptionAura() const
Definition Unit.h:1823
void SendMeleeAttackStop(Unit const *victim=nullptr) const
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition Unit.cpp:3278
virtual void SetTarget(ObjectGuid=ObjectGuid::Empty)=0
bool InSamePhase(WorldObject const *obj) const
Definition Object.h:524
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1344
#define sWorld
Definition World.h:337

References _addAttacker(), _removeAttacker(), AddUnitState(), AI_REACTION_HOSTILE, BASE_ATTACK, CalculatePct(), Creature::CallAssistance(), ClearUnitState(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE, CURRENT_MELEE_SPELL, EMOTE_ONESHOT_NONE, EngageWithTarget(), getAttackTimer(), GetCharmerOrOwner(), Object::GetFloatValue(), Object::GetGUID(), Creature::GetLastLeashExtensionTimePtr(), GetVictim(), Creature::HasFlagsExtra(), HasOffhandWeaponForAttack(), HasSpiritOfRedemptionAura(), HasUnattackableAura(), HasUnitState(), WorldObject::InSamePhase(), InterruptSpell(), IsAlive(), IsControllableGuardian(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), Player::IsGameMaster(), IsGuardian(), Creature::IsInEvadeMode(), WorldObject::IsInMap(), IsMounted(), Object::IsPlayer(), IsPolymorphed(), m_attacking, m_Controlled, OFF_ATTACK, RemoveAurasByType(), Creature::SendAIReaction(), SendMeleeAttackStart(), SendMeleeAttackStop(), Creature::SetAssistanceTimer(), setAttackTimer(), Creature::SetLastLeashExtensionTimePtr(), SetTarget(), SetUInt32Value(), SPELL_AURA_MOD_UNATTACKABLE, sWorld, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_BASEATTACKTIME, UNIT_NPC_EMOTESTATE, UNIT_STATE_MELEE_ATTACKING, and Creature::UpdateLeashExtensionTime().

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), PossessedAI::AttackStart(), boss_ragnaros::AttackStart(), npc_gunship_mage::npc_gunship_mageAI::AttackStart(), npc_gunship_gunner::npc_gunship_gunnerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), npc_putricide_mutated_abomination::AttackStart(), boss_malygos::AttackStart(), npc_nexus_lord::AttackStart(), npc_warbear_matriarch::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), TurretAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alythess::AttackStart(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), boss_jormungarAI::AttackStart(), boss_four_horsemen::boss_four_horsemenAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_kologarn::AttackStart(), boss_mimiron::AttackStart(), boss_lady_malande::AttackStart(), boss_the_lurker_below::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), boss_nazan::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), npc_pet_gen_gnomish_flame_turret::AttackStart(), UnitAI::AttackStartCaster(), ScriptedAI::AttackStartNoMove(), PetAI::DoAttack(), WorldSession::HandleAttackSwingOpcode(), spell_q12096_q12092_dummy::HandleDummy(), WorldSession::HandlePetActionHelper(), boss_kologarn_eyebeam::IsSummonedBy(), boss_halazzi::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), RemoveCharmedBy(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SmartAI::SetCurrentRangeMode(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), Player::UpdateCharmedAI(), SmartAI::UpdateMeleeStance(), and npc_ranger_lilatha::WaypointReached().

◆ AttackerStateUpdate()

void Unit::AttackerStateUpdate ( Unit *  victim,
WeaponAttackType  attType = BASE_ATTACK,
bool  extra = false,
bool  ignoreCasting = false 
)
2761{
2763 {
2764 return;
2765 }
2766
2767 // UNIT_STATE_CASTING is checked through IsActionPreventedByCasting() so that channels
2768 // flagged as "allow actions during channel" do not block the auto attack
2769 if ((HasUnitState(UNIT_STATE_LOST_CONTROL) || IsActionPreventedByCasting()) && !extra && !ignoreCasting)
2770 {
2771 return;
2772 }
2773
2774 if (!victim->IsAlive())
2775 return;
2776
2777 if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
2778 return;
2779
2780 // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later
2781 const bool sittingVictim = victim->IsPlayer() && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP);
2782
2783 AtTargetAttacked(victim, true);
2785
2786 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
2787 return; // ignore ranged case
2788
2789 // Let the pet know we've started attacking someting. Handles melee attacks only
2790 // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
2791 if (IsPlayer())
2792 {
2793 for (Unit* controlled : m_Controlled)
2794 if (Creature* cControlled = controlled->ToCreature())
2795 if (CreatureAI* controlledAI = cControlled->AI())
2796 controlledAI->OwnerAttacked(victim);
2797 }
2798
2799 if (!extra && _lastExtraAttackSpell)
2800 {
2802 }
2803
2804 bool meleeAttack = true;
2805
2806 // melee attack spell casted at main hand attack only - no normal melee dmg dealt
2807 if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
2808 {
2809 meleeAttack = false; // The melee attack is replaced by the melee spell
2810
2812 SpellCastResult castResult = meleeSpell->CheckCast(false);
2813 if (castResult != SPELL_CAST_OK)
2814 {
2815 meleeSpell->SendCastResult(castResult);
2816 meleeSpell->SendInterrupted(0);
2817
2818 meleeSpell->finish(false);
2819 meleeSpell->SetExecutedCurrently(false);
2820
2821 if (castResult == SPELL_FAILED_NO_POWER)
2822 {
2823 // Not enough rage, do a regular melee attack instead
2824 meleeAttack = true;
2825 }
2826 }
2827 else
2828 {
2829 meleeSpell->cast(true);
2830 }
2831 }
2832 if (meleeAttack)
2833 {
2834 // attack can be redirected to another target
2835 victim = GetMeleeHitRedirectTarget(victim);
2836 CalcDamageInfo damageInfo;
2837 CalculateMeleeDamage(victim, &damageInfo, attType, sittingVictim);
2838
2839 // Send log damage message to client
2840 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2841 {
2842 Unit::DealDamageMods(victim, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
2843 }
2844
2845 // Related to sparring system. Allow attack animations even if there are no damages
2846 if (victim->CanSparringWith(damageInfo.attacker))
2847 damageInfo.HitInfo |= HITINFO_FAKE_DAMAGE;
2848
2849 SendAttackStateUpdate(&damageInfo);
2850
2851 _lastDamagedTargetGuid = victim->GetGUID();
2852
2853 DealMeleeDamage(&damageInfo, true);
2854
2855 DamageInfo dmgInfo(damageInfo);
2856 Unit::ProcSkillsAndAuras(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, dmgInfo.GetHitMask(), dmgInfo.GetDamage(),
2857 damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo);
2858
2859 if (IsPlayer())
2860 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2861 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2862 else
2863 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2864 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2865
2866 }
2867}
#define MAX_ITEM_PROTO_DAMAGES
Definition ItemTemplate.h:613
@ SPELL_FAILED_NO_POWER
Definition SharedDefines.h:1022
@ AURA_INTERRUPT_FLAG_MELEE_ATTACK
Definition SpellDefines.h:63
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:38
@ UNIT_STATE_LOST_CONTROL
Definition UnitDefines.h:219
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:274
@ HITINFO_FAKE_DAMAGE
Definition Unit.h:126
Definition CreatureAI.h:69
Definition Unit.h:344
std::string ToString() const
Definition ObjectGuid.cpp:49
void cast(bool skipCheck=false)
Definition Spell.cpp:3945
void SetExecutedCurrently(bool yes)
Definition Spell.h:579
void SendInterrupted(uint8 result)
Definition Spell.cpp:5378
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4862
void finish(bool ok=true)
Definition Spell.cpp:4665
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6717
void AtTargetAttacked(Unit *target, bool canInitialAggro)
Definition Unit.cpp:11295
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:7996
bool IsActionPreventedByCasting() const
Definition Unit.cpp:4135
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1677
uint8 getStandState() const
Definition Unit.h:1796
static void ProcSkillsAndAuras(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:6607
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:2017
bool CanSparringWith(Unit const *attacker) const
Definition Unit.cpp:3875
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:980
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition Object.cpp:1412
Definition Unit.h:489
uint32 procAttacker
Definition Unit.h:506
uint32 procVictim
Definition Unit.h:507
struct CalcDamageInfo::@271 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition Unit.h:497
uint32 damage
Definition Unit.h:496
uint32 HitInfo
Definition Unit.h:502
Unit * attacker
Definition Unit.h:490
Unit * target
Definition Unit.h:491
WeaponAttackType attackType
Definition Unit.h:505
std::string ToString() const
Definition Position.cpp:59

References _lastDamagedTargetGuid, _lastExtraAttackSpell, CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::attackType, AtTargetAttacked(), AURA_INTERRUPT_FLAG_MELEE_ATTACK, BASE_ATTACK, CalculateMeleeDamage(), CanSparringWith(), Spell::cast(), Spell::CheckCast(), CURRENT_MELEE_SPELL, CalcDamageInfo::damage, CalcDamageInfo::damages, DealDamageMods(), DealMeleeDamage(), Spell::finish(), DamageInfo::GetAbsorb(), DamageInfo::GetBlock(), DamageInfo::GetDamage(), Object::GetGUID(), Object::GetGUID(), DamageInfo::GetHitMask(), GetMeleeHitRedirectTarget(), DamageInfo::GetResist(), getStandState(), HasUnitFlag(), HasUnitState(), CalcDamageInfo::HitInfo, HITINFO_FAKE_DAMAGE, IsActionPreventedByCasting(), IsAlive(), Object::IsPlayer(), IsSitState(), WorldObject::IsWithinLOSInMap(), LOG_DEBUG, m_Controlled, m_currentSpells, MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, CalcDamageInfo::procAttacker, ProcSkillsAndAuras(), CalcDamageInfo::procVictim, RemoveAurasWithInterruptFlags(), SendAttackStateUpdate(), Spell::SendCastResult(), Spell::SendInterrupted(), Spell::SetExecutedCurrently(), SPELL_CAST_OK, SPELL_FAILED_NO_POWER, CalcDamageInfo::target, Object::ToCreature(), ObjectGuid::ToString(), Position::ToString(), UNIT_FLAG_PACIFIED, UNIT_STAND_STATE_SLEEP, and UNIT_STATE_LOST_CONTROL.

Referenced by UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), HandleProcExtraAttackFor(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), boss_dred::boss_dredAI::ScheduleTasks(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Player::Update(), boss_kologarn::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ AttackStop()

bool Unit::AttackStop ( )

Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.

7288{
7289 if (!m_attacking)
7290 return false;
7291
7292 Unit* victim = m_attacking;
7293
7295 m_attacking = nullptr;
7296
7297 // Clear our target
7299
7301
7303
7304 // reset only at real combat stop
7305 if (Creature* creature = ToCreature())
7306 {
7307 creature->SetNoCallAssistance(false);
7308
7309 if (creature->HasSearchedAssistance())
7310 {
7311 creature->SetNoSearchAssistance(false);
7312 }
7313 }
7314
7315 SendMeleeAttackStop(victim);
7316
7317 return true;
7318}

References _removeAttacker(), ClearUnitState(), CURRENT_MELEE_SPELL, ObjectGuid::Empty, InterruptSpell(), m_attacking, SendMeleeAttackStop(), SetTarget(), Object::ToCreature(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by PetAI::_stopAttack(), Pet::CastPendingSpell(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CombatStop(), boss_jedoga_shadowseeker::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), advisor_baseAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_thekal::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), ChaseMovementGenerator< T >::DispatchSplineToPosition(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::DoAction(), npc_ulduar_hodir_priest::DoAction(), npc_ulduar_hodir_druid::DoAction(), npc_ulduar_hodir_shaman::DoAction(), npc_ulduar_hodir_mage::DoAction(), npc_ulduar_aerial_command_unit::DoAction(), ScriptedAI::DoStopAttack(), spell_halion_twilight_phasing_aura::DropCombat(), Player::DuelComplete(), SmartAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), boss_xt002::ExposeHeart(), TimedFleeingMovementGenerator::Finalize(), Spell::finish(), WorldSession::HandleAttackStopOpcode(), WorldSession::HandleAttackSwingOpcode(), spell_hun_scatter_shot::HandleDummy(), spell_mc_play_dead_aura::HandleEffectApply(), spell_q11065_wrangle_some_aether_rays_aura::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetStopAttack(), RotateMovementGenerator::Initialize(), boss_janalai::JustEngagedWith(), PetAI::KilledUnit(), MotionMaster::MoveSeekAssistance(), PetSpellFail(), RemoveCharmedBy(), boss_janalai::Reset(), boss_talon_king_ikiss::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_felmyst::ScheduleGroundAbilities(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::SelectNewTarget(), SetCharmedBy(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_attumen::SpellHit(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_heigan::StartFightPhase(), boss_lord_valthalak::StartTalking(), StopAttackFaction(), StopAttackingInvalidTarget(), boss_ouro::Submerge(), npc_vaelastrasz_the_red::UpdateAI(), boss_ragnaros::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI(), boss_hadronox::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_putricide_mutated_abomination::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), npc_warbear_matriarch::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), and CreatureAI::UpdateVictim().

◆ AtTargetAttacked()

void Unit::AtTargetAttacked ( Unit *  target,
bool  canInitialAggro 
)
11296{
11297 if (!target->IsEngaged() && !canInitialAggro)
11298 return;
11299
11300 if (Creature* cTarget = target->ToCreature())
11301 {
11302 if (!cTarget->GetOwnerGUID().IsPlayer())
11303 cTarget->UpdateLeashExtensionTime();
11304 }
11305
11306 target->EngageWithTarget(this);
11307 if (Unit* targetOwner = target->GetCharmerOrOwner())
11308 targetOwner->EngageWithTarget(this);
11309 if (Unit* myOwner = GetCharmerOrOwner())
11310 target->EngageWithTarget(myOwner);
11311
11312 // Patch 3.0.8: All player spells which cause a creature to become aggressive
11313 // to you will now also immediately cause the creature to be tapped.
11314 if (Creature* creature = target->ToCreature())
11315 if (!creature->hasLootRecipient() && IsPlayer())
11316 creature->SetLootRecipient(this);
11317
11319 Player* targetPlayerOwner = target->GetCharmerOrOwnerPlayerOrPlayerItself();
11320 if (myPlayerOwner && targetPlayerOwner && !(myPlayerOwner->duel && myPlayerOwner->duel->Opponent == targetPlayerOwner))
11321 {
11322 myPlayerOwner->UpdatePvP(true);
11323 myPlayerOwner->SetContestedPvP(targetPlayerOwner);
11325 }
11326}
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition SpellDefines.h:74
void UpdatePvP(bool state, bool _override=false)
Definition PlayerUpdates.cpp:1553
void SetContestedPvP(Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
Definition Unit.cpp:13352
virtual bool IsEngaged() const
Definition Unit.h:945

References AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, EngageWithTarget(), GetCharmerOrOwner(), GetCharmerOrOwnerPlayerOrPlayerItself(), IsEngaged(), Object::IsPlayer(), RemoveAurasWithInterruptFlags(), SetContestedPvP(), Object::ToCreature(), and Player::UpdatePvP().

Referenced by AttackerStateUpdate(), CalcAbsorbResist(), DealDamage(), and Spell::DoAllEffectOnTarget().

◆ BuildAuraStateUpdateForTarget()

uint32 Unit::BuildAuraStateUpdateForTarget ( Unit *  target) const
7471{
7473 for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.begin(); itr != m_auraStateAuras.end(); ++itr)
7474 if ((1 << (itr->first - 1)) & PER_CASTER_AURA_STATE_MASK)
7475 if (itr->second->GetBase()->GetCasterGUID() == target->GetGUID())
7476 auraStates |= (1 << (itr->first - 1));
7477
7478 return auraStates;
7479}
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:303

References Object::GetGUID(), Object::GetUInt32Value(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, and UNIT_FIELD_AURASTATE.

Referenced by PatchValuesUpdate().

◆ BuildCooldownPacket() [1/2]

void Unit::BuildCooldownPacket ( WorldPacket &  data,
uint8  flags,
PacketCooldowns const &  cooldowns 
)
16785{
16786 data.Initialize(SMSG_SPELL_COOLDOWN, 8 + 1 + (4 + 4) * cooldowns.size());
16787 data << GetGUID();
16788 data << uint8(flags);
16789 for (std::unordered_map<uint32, uint32>::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
16790 {
16791 data << uint32(itr->first);
16792 data << uint32(itr->second);
16793 }
16794}
void Initialize(uint16 opcode, std::size_t newres=200)
Definition WorldPacket.h:68
@ SMSG_SPELL_COOLDOWN
Definition Opcodes.h:338

References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_SPELL_COOLDOWN.

◆ BuildCooldownPacket() [2/2]

◆ BuildHeartBeatMsg()

void Unit::BuildHeartBeatMsg ( WorldPacket *  data) const
2172{
2173 data->Initialize(MSG_MOVE_HEARTBEAT, 32);
2174 *data << GetPackGUID();
2175 BuildMovementPacket(data);
2176}
PackedGuid const & GetPackGUID() const
Definition Object.h:122
void BuildMovementPacket(ByteBuffer *data) const
Definition Unit.cpp:15599
@ MSG_MOVE_HEARTBEAT
Definition Opcodes.h:268

References BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), and MSG_MOVE_HEARTBEAT.

Referenced by SendMovementFlagUpdate().

◆ BuildMovementPacket()

void Unit::BuildMovementPacket ( ByteBuffer *  data) const
15600{
15601 *data << uint32(GetUnitMovementFlags()); // movement flags
15602 *data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
15603 *data << uint32(GameTime::GetGameTimeMS().count()); // time / counter
15604 *data << GetPositionX();
15605 *data << GetPositionY();
15606 *data << GetPositionZ();
15607 *data << GetOrientation();
15608
15609 // 0x00000200
15611 {
15612 if (m_vehicle)
15613 *data << m_vehicle->GetBase()->GetPackGUID();
15614 else if (GetTransport())
15615 *data << GetTransport()->GetPackGUID();
15616 else
15617 *data << (uint8)0;
15618
15619 *data << float (GetTransOffsetX());
15620 *data << float (GetTransOffsetY());
15621 *data << float (GetTransOffsetZ());
15622 *data << float (GetTransOffsetO());
15623 *data << uint32(GetTransTime());
15624 *data << uint8 (GetTransSeat());
15625
15628 }
15629
15630 // 0x02200000
15633 *data << (float)m_movementInfo.pitch;
15634
15635 *data << (uint32)m_movementInfo.fallTime;
15636
15637 // 0x00001000
15639 {
15640 *data << (float)m_movementInfo.jump.zspeed;
15641 *data << (float)m_movementInfo.jump.sinAngle;
15642 *data << (float)m_movementInfo.jump.cosAngle;
15643 *data << (float)m_movementInfo.jump.xyspeed;
15644 }
15645
15646 // 0x04000000
15648 *data << (float)m_movementInfo.splineElevation;
15649}
std::uint16_t uint16
Definition Define.h:108
@ MOVEMENTFLAG_ONTRANSPORT
Definition UnitDefines.h:381
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:397
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:384
@ MOVEMENTFLAG_SWIMMING
Definition UnitDefines.h:393
@ MOVEMENTFLAG_SPLINE_ELEVATION
Definition UnitDefines.h:398
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
Definition UnitDefines.h:435
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
Definition UnitDefines.h:440
uint32 GetUnitMovementFlags() const
Definition Unit.h:781
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:787
float GetTransOffsetX() const
Definition Object.h:702
float GetTransOffsetY() const
Definition Object.h:703
float GetTransOffsetZ() const
Definition Object.h:704
uint32 GetTransTime() const
Definition Object.h:706
Transport * GetTransport() const
Definition Object.h:701
float GetTransOffsetO() const
Definition Object.h:705
float cosAngle
Definition Object.h:336
float xyspeed
Definition Object.h:336
float zspeed
Definition Object.h:336
float sinAngle
Definition Object.h:336
uint32 time2
Definition Object.h:319
struct MovementInfo::JumpInfo jump
uint32 fallTime
Definition Object.h:326
struct MovementInfo::TransportInfo transport
float splineElevation
Definition Object.h:340
float pitch
Definition Object.h:323

References MovementInfo::JumpInfo::cosAngle, MovementInfo::fallTime, MovementInfo::flags2, Vehicle::GetBase(), GetExtraUnitMovementFlags(), GameTime::GetGameTimeMS(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), WorldObject::GetTransSeat(), WorldObject::GetTransTime(), GetUnitMovementFlags(), MovementInfo::jump, WorldObject::m_movementInfo, m_vehicle, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_INTERPOLATED_MOVEMENT, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_ONTRANSPORT, MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_SWIMMING, MovementInfo::pitch, MovementInfo::JumpInfo::sinAngle, MovementInfo::splineElevation, MovementInfo::TransportInfo::time2, MovementInfo::transport, MovementInfo::JumpInfo::xyspeed, and MovementInfo::JumpInfo::zspeed.

Referenced by BuildHeartBeatMsg(), Object::BuildMovementUpdate(), Player::SendTeleportAckPacket(), and SendTeleportPacket().

◆ BuildValuesUpdate()

void Unit::BuildValuesUpdate ( uint8  updateType,
ByteBuffer *  data,
Player *  target 
)
overrideprotectedvirtual

Reimplemented from Object.

16498{
16499 if (!target)
16500 return;
16501
16503 uint32 visibleFlag = UF_FLAG_PUBLIC;
16504
16505 if (target == this)
16506 visibleFlag |= UF_FLAG_PRIVATE;
16507
16509 if (GetOwnerGUID() == target->GetGUID())
16510 visibleFlag |= UF_FLAG_OWNER;
16511
16514 visibleFlag |= UF_FLAG_SPECIAL_INFO;
16515
16516 if (plr && plr->IsInSameRaidWith(target))
16517 visibleFlag |= UF_FLAG_PARTY_MEMBER;
16518
16519 uint64 cacheKey = static_cast<uint64>(visibleFlag) << 8 | updateType;
16520
16521 auto cacheIt = _valuesUpdateCache.find(cacheKey);
16522 if (cacheIt != _valuesUpdateCache.end())
16523 {
16524 int32 cachePos = static_cast<int32>(data->wpos());
16525 data->append(cacheIt->second.buffer);
16526
16527 BuildValuesCachePosPointers dataAdjustedPos = cacheIt->second.posPointers;
16528 if (cachePos)
16529 dataAdjustedPos.ApplyOffset(cachePos);
16530
16531 PatchValuesUpdate(*data, dataAdjustedPos, target);
16532
16533 return;
16534 }
16535
16536 BuildValuesCachedBuffer cacheValue(500);
16537
16538 ByteBuffer fieldBuffer(400);
16539
16540 UpdateMask updateMask;
16541 updateMask.SetCount(m_valuesCount);
16542
16543 for (uint16 index = 0; index < m_valuesCount; ++index)
16544 {
16545 if (_fieldNotifyFlags & flags[index] ||
16546 ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) ||
16547 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
16549 {
16550 updateMask.SetBit(index);
16551
16552 if (index == UNIT_NPC_FLAGS)
16553 {
16554 cacheValue.posPointers.UnitNPCFlagsPos = int32(fieldBuffer.wpos());
16555 fieldBuffer << m_uint32Values[UNIT_NPC_FLAGS];
16556 }
16557 else if (index == UNIT_FIELD_AURASTATE)
16558 {
16559 cacheValue.posPointers.UnitFieldAuraStatePos = int32(fieldBuffer.wpos());
16560 fieldBuffer << uint32(0); // Fill in later.
16561 }
16562 // FIXME: Some values at server stored in float format but must be sent to client in uint32 format
16563 else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
16564 {
16565 // convert from float to uint32 and send
16566 fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
16567 }
16568 // there are some float values which may be negative or can't get negative due to other checks
16569 else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
16572 (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
16573 {
16574 fieldBuffer << uint32(m_floatValues[index]);
16575 }
16576 // Gamemasters should be always able to select units - remove not selectable flag
16577 else if (index == UNIT_FIELD_FLAGS)
16578 {
16579 cacheValue.posPointers.UnitFieldFlagsPos = int32(fieldBuffer.wpos());
16580 fieldBuffer << m_uint32Values[UNIT_FIELD_FLAGS];
16581 }
16582 // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
16583 else if (index == UNIT_FIELD_DISPLAYID)
16584 {
16585 cacheValue.posPointers.UnitFieldDisplayPos = int32(fieldBuffer.wpos());
16586 fieldBuffer << m_uint32Values[UNIT_FIELD_DISPLAYID];
16587 }
16588 else if (index == UNIT_DYNAMIC_FLAGS)
16589 {
16590 cacheValue.posPointers.UnitDynamicFlagsPos = int32(fieldBuffer.wpos());
16592 fieldBuffer << dynamicFlags;
16593 }
16594 else if (index == UNIT_FIELD_BYTES_2)
16595 {
16596 cacheValue.posPointers.UnitFieldBytes2Pos = int32(fieldBuffer.wpos());
16597 fieldBuffer << m_uint32Values[index];
16598 }
16599 else if (index == UNIT_FIELD_FACTIONTEMPLATE)
16600 {
16601 cacheValue.posPointers.UnitFieldFactionTemplatePos = int32(fieldBuffer.wpos());
16602 fieldBuffer << m_uint32Values[index];
16603 }
16604 else
16605 {
16606 if (sScriptMgr->ShouldTrackValuesUpdatePosByIndex(this, updateType, index))
16607 cacheValue.posPointers.other[index] = static_cast<uint32>(fieldBuffer.wpos());
16608
16609 // send in current format (float as float, uint32 as uint32)
16610 fieldBuffer << m_uint32Values[index];
16611 }
16612 }
16613 }
16614
16615 cacheValue.buffer << uint8(updateMask.GetBlockCount());
16616 updateMask.AppendToPacket(&cacheValue.buffer);
16617 int32 fieldBufferPos = static_cast<int32>(cacheValue.buffer.wpos());
16618 cacheValue.buffer.append(fieldBuffer);
16619 cacheValue.posPointers.ApplyOffset(fieldBufferPos);
16620
16621 int32 cachePos = static_cast<int32>(data->wpos());
16622 data->append(cacheValue.buffer);
16623
16624 BuildValuesCachePosPointers dataAdjustedPos = cacheValue.posPointers;
16625 if (cachePos)
16626 dataAdjustedPos.ApplyOffset(cachePos);
16627
16628 PatchValuesUpdate(*data, dataAdjustedPos, target);
16629
16630 _valuesUpdateCache.insert(std::pair<uint64, BuildValuesCachedBuffer>(cacheKey, std::move(cacheValue)));
16631}
std::uint64_t uint64
Definition Define.h:106
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3358
@ UNIT_DYNFLAG_TAPPED_BY_PLAYER
Definition SharedDefines.h:3357
@ UNIT_DYNFLAG_TAPPED
Definition SharedDefines.h:3356
@ SPELL_AURA_EMPATHY
Definition SpellAuraDefines.h:184
@ UPDATETYPE_VALUES
Definition UpdateData.h:28
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition UpdateFieldFlags.cpp:162
@ UF_FLAG_SPECIAL_INFO
Definition UpdateFieldFlags.h:32
@ UF_FLAG_PUBLIC
Definition UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition UpdateFieldFlags.h:29
@ UF_FLAG_PRIVATE
Definition UpdateFieldFlags.h:28
@ UF_FLAG_PARTY_MEMBER
Definition UpdateFieldFlags.h:33
@ UNIT_NPC_FLAGS
Definition UpdateFields.h:139
@ UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
Definition UpdateFields.h:157
@ UNIT_FIELD_POSSTAT0
Definition UpdateFields.h:146
@ UNIT_FIELD_RANGEDATTACKTIME
Definition UpdateFields.h:121
@ UNIT_FIELD_DISPLAYID
Definition UpdateFields.h:124
@ UNIT_FIELD_FACTIONTEMPLATE
Definition UpdateFields.h:115
@ UNIT_FIELD_POSSTAT4
Definition UpdateFields.h:150
@ UNIT_FIELD_NEGSTAT4
Definition UpdateFields.h:155
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
@ UNIT_FIELD_NEGSTAT0
Definition UpdateFields.h:151
@ UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
Definition UpdateFields.h:158
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
Definition ByteBuffer.h:70
void append(T value)
Definition ByteBuffer.h:129
std::size_t wpos() const
Definition ByteBuffer.h:330
uint16 _fieldNotifyFlags
Definition Object.h:275
bool HasDynamicFlag(uint32 flag) const
Definition Object.h:130
UpdateMask _changesMask
Definition Object.h:271
uint32 * m_uint32Values
Definition Object.h:267
uint16 m_valuesCount
Definition Object.h:273
float * m_floatValues
Definition Object.h:268
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1915
ValuesUpdateCache _valuesUpdateCache
Definition Unit.h:2282
ObjectGuid GetOwnerGUID() const override
Definition Unit.h:719
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition Unit.cpp:5827
void PatchValuesUpdate(ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
Definition Unit.cpp:16633
Definition UpdateMask.h:25
uint32 GetBlockCount() const
Definition UpdateMask.h:62
bool GetBit(uint32 index) const
Definition UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition UpdateMask.h:65
void SetBit(uint32 index)
Definition UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition UpdateMask.h:49
Definition UnitUtils.h:65
void ApplyOffset(uint32 offset)
Definition UnitUtils.h:70
Definition UnitUtils.h:110

References Object::_changesMask, Object::_fieldNotifyFlags, _valuesUpdateCache, ByteBuffer::append(), UpdateMask::AppendToPacket(), BuildValuesCachePosPointers::ApplyOffset(), BuildValuesCachedBuffer::buffer, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), GetOwnerGUID(), HasAuraTypeWithCaster(), Object::HasDynamicFlag(), Object::HasFlag(), Player::IsInSameRaidWith(), Object::m_floatValues, Object::m_uint32Values, Object::m_valuesCount, BuildValuesCachePosPointers::other, PatchValuesUpdate(), PER_CASTER_AURA_STATE_MASK, BuildValuesCachedBuffer::posPointers, UpdateMask::SetBit(), UpdateMask::SetCount(), SPELL_AURA_EMPATHY, sScriptMgr, UF_FLAG_OWNER, UF_FLAG_PARTY_MEMBER, UF_FLAG_PRIVATE, UF_FLAG_PUBLIC, UF_FLAG_SPECIAL_INFO, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FACTIONTEMPLATE, UNIT_FIELD_FLAGS, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_NEGSTAT4, UNIT_FIELD_POSSTAT0, UNIT_FIELD_POSSTAT4, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, BuildValuesCachePosPointers::UnitNPCFlagsPos, UnitUpdateFieldFlags, UPDATETYPE_VALUES, and ByteBuffer::wpos().

◆ CalcAbsorbResist()

void Unit::CalcAbsorbResist ( DamageInfo &  dmgInfo,
bool  Splited = false,
uint8  casterLevel = 0 
)
static
2338{
2339 Unit* victim = dmgInfo.GetVictim();
2340 Unit* attacker = dmgInfo.GetAttacker();
2341 uint32 damage = dmgInfo.GetDamage();
2342 SpellSchoolMask schoolMask = dmgInfo.GetSchoolMask();
2343 SpellInfo const* spellInfo = dmgInfo.GetSpellInfo();
2344 bool const skipCombat = dmgInfo.SkipsCombat() || (attacker && attacker->IsInPreDeathAuraTick());
2345
2346 if (!victim || !victim->IsAlive() || !damage)
2347 return;
2348
2349 // Magic damage, check for resists
2350 // Ignore spells that cant be resisted
2351 // Xinef: holy resistance exists for npcs
2352 if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->IsCreature()) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))))
2353 {
2354 float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim, nullptr, casterLevel);
2355
2356 float discreteResistProbability[11];
2357 for (uint32 i = 0; i < 11; ++i)
2358 {
2359 discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
2360 if (discreteResistProbability[i] < 0.0f)
2361 discreteResistProbability[i] = 0.0f;
2362 }
2363
2364 if (averageResist <= 0.1f)
2365 {
2366 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
2367 discreteResistProbability[1] = 5.0f * averageResist;
2368 discreteResistProbability[2] = 2.5f * averageResist;
2369 }
2370
2371 float r = float(rand_norm());
2372 uint32 i = 0;
2373 float probabilitySum = discreteResistProbability[0];
2374
2375 while (r >= probabilitySum && i < 10)
2376 probabilitySum += discreteResistProbability[++i];
2377
2378 float damageResisted = float(damage * i / 10);
2379
2380 if (damageResisted) // if equal to 0, checking these is pointless
2381 {
2382 if (attacker)
2383 {
2384 float mult = attacker->GetTotalAuraMultiplier(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, [schoolMask, spellInfo](AuraEffect const* aurEff)
2385 {
2386 if (!(aurEff->GetMiscValue() & schoolMask))
2387 return false;
2388
2389 if (!aurEff->IsAffectedOnSpell(spellInfo))
2390 return false;
2391
2392 return true;
2393 });
2394 damageResisted -= damageResisted * (mult - 1.0f);
2395 }
2396
2397 // pussywizard:
2398 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
2399 {
2400 uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK);
2401 uint32 armorReduction = damage - damageAfterArmor;
2402 if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
2403 damageResisted = armorReduction;
2404 }
2405 }
2406
2407 dmgInfo.ResistDamage(uint32(damageResisted));
2408 }
2409
2410 // Ignore Absorption Auras
2411 float auraAbsorbMod = 0;
2412 if (attacker)
2413 {
2415 auraAbsorbMod = std::max(auraAbsorbMod, float(attacker->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, [spellInfo, schoolMask](AuraEffect const* aurEff)
2416 {
2417 if (!(aurEff->GetMiscValue() & schoolMask))
2418 return false;
2419
2420 if (!aurEff->IsAffectedOnSpell(spellInfo))
2421 return false;
2422
2423 return true;
2424 })));
2425 RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
2426 }
2427
2428 // We're going to call functions which can modify content of the list during iteration over it's elements
2429 // Let's copy the list so we can prevent iterator invalidation
2431 std::sort(vSchoolAbsorbCopy.begin(), vSchoolAbsorbCopy.end(), Acore::AbsorbAuraOrderPred());
2432
2433 // absorb without mana cost
2434 for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2435 {
2436 AuraEffect* absorbAurEff = *itr;
2437 // Check if aura was removed during iteration - we don't need to work on such auras
2438 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2439 if (!aurApp)
2440 continue;
2441 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2442 continue;
2443
2444 // get amount which can be still absorbed by the aura
2445 int32 currentAbsorb = absorbAurEff->GetAmount();
2446 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2447 if (currentAbsorb < 0)
2448 currentAbsorb = 0;
2449
2450 uint32 tempAbsorb = uint32(currentAbsorb);
2451
2452 bool defaultPrevented = false;
2453
2454 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2455 currentAbsorb = tempAbsorb;
2456
2457 if (defaultPrevented)
2458 continue;
2459
2460 // absorb must be smaller than the damage itself
2461 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2462
2463 // xinef: do this after absorb is rounded to damage...
2464 AddPct(currentAbsorb, -auraAbsorbMod);
2465
2466 dmgInfo.AbsorbDamage(currentAbsorb);
2467
2468 tempAbsorb = currentAbsorb;
2469 absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2470
2471 // Check if our aura is using amount to count damage
2472 if (absorbAurEff->GetAmount() >= 0)
2473 {
2474 // Reduce shield amount
2475 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2476 // Aura cannot absorb anything more - remove it
2477 if (absorbAurEff->GetAmount() <= 0)
2478 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2479 }
2480 }
2481
2482 // absorb by mana cost
2484 for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2485 {
2486 AuraEffect* absorbAurEff = *itr;
2487 // Check if aura was removed during iteration - we don't need to work on such auras
2488 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2489 if (!aurApp)
2490 continue;
2491 // check damage school mask
2492 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2493 continue;
2494
2495 // get amount which can be still absorbed by the aura
2496 int32 currentAbsorb = absorbAurEff->GetAmount();
2497 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2498 if (currentAbsorb < 0)
2499 currentAbsorb = 0;
2500
2501 uint32 tempAbsorb = currentAbsorb;
2502
2503 bool defaultPrevented = false;
2504
2505 absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2506 currentAbsorb = tempAbsorb;
2507
2508 if (defaultPrevented)
2509 continue;
2510
2511 // absorb must be smaller than the damage itself
2512 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2513
2514 // xinef: do this after absorb is rounded to damage...
2515 AddPct(currentAbsorb, -auraAbsorbMod);
2516
2517 int32 manaReduction = currentAbsorb;
2518
2519 // lower absorb amount by talents
2520 if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
2521 manaReduction = int32(float(manaReduction) * manaMultiplier);
2522
2523 int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
2524
2525 // take case when mana has ended up into account
2526 currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
2527
2528 dmgInfo.AbsorbDamage(currentAbsorb);
2529
2530 tempAbsorb = currentAbsorb;
2531 absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2532
2533 // Check if our aura is using amount to count damage
2534 if (absorbAurEff->GetAmount() >= 0)
2535 {
2536 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2537 if ((absorbAurEff->GetAmount() <= 0))
2538 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2539 }
2540 }
2541
2542 // split damage auras - only when not damaging self
2543 // Xinef: not true - Warlock Hellfire
2544 if (/*victim != attacker &&*/ !Splited)
2545 {
2546 // We're going to call functions which can modify content of the list during iteration over it's elements
2547 // Let's copy the list so we can prevent iterator invalidation
2548 AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); // Not used by any spell
2549 for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2550 {
2551 // Check if aura was removed during iteration - we don't need to work on such auras
2552 if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
2553 continue;
2554 // check damage school mask
2555 if (!((*itr)->GetMiscValue() & schoolMask))
2556 continue;
2557
2558 // Damage can be splitted only if aura has an alive caster
2559 Unit* caster = (*itr)->GetCaster();
2560 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2561 continue;
2562
2563 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2564 int32 splitDamage = (*itr)->GetAmount();
2565
2566 // absorb must be smaller than the damage itself
2567 splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
2568
2569 dmgInfo.AbsorbDamage(splitDamage);
2570
2571 uint32 splitted = splitDamage;
2572 uint32 splitted_absorb = 0;
2573 uint32 splitted_resist = 0;
2574
2575 uint32 procAttacker = 0, procVictim = 0;
2576 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, schoolMask, dmgInfo.GetDamageType());
2577 splittedDmgInfo.AddHitMask(PROC_HIT_NORMAL);
2578 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2579 {
2580 splittedDmgInfo.AddHitMask(PROC_HIT_IMMUNE);
2581 splittedDmgInfo.AbsorbDamage(splitted);
2582 }
2583 else
2584 {
2585 Unit::CalcAbsorbResist(splittedDmgInfo, true, casterLevel);
2586 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2587 }
2588
2589 splitted_absorb = splittedDmgInfo.GetAbsorb();
2590 splitted_resist = splittedDmgInfo.GetResist();
2591 splitted = splittedDmgInfo.GetDamage();
2592
2593 // Add absorb to hitMask if damage was absorbed
2594 if (splittedDmgInfo.GetAbsorb())
2595 splittedDmgInfo.AddHitMask(PROC_HIT_ABSORB);
2596
2597 // create procs
2598 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2599 caster->ProcSkillsAndReactives(true, attacker, procVictim, splittedDmgInfo.GetHitMask(), BASE_ATTACK, spellInfo, splitted, nullptr, -1, nullptr, &splittedDmgInfo);
2600
2601 if (attacker)
2602 {
2603 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, schoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2604 }
2605
2606 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2607
2608 // Split damage is a hostile interaction for its recipient too.
2609 if (splitDamage && attacker && !attacker->IsFriendlyTo(caster) && !skipCombat)
2610 attacker->AtTargetAttacked(caster, !spellInfo || spellInfo->HasInitialAggro());
2611
2612 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, splitSpellInfo,
2613 false, false, nullptr, skipCombat);
2614 }
2615
2616 // We're going to call functions which can modify content of the list during iteration over it's elements
2617 // Let's copy the list so we can prevent iterator invalidation
2619 for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(); (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2620 {
2621 // Check if aura was removed during iteration - we don't need to work on such auras
2622 AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2623 if (!aurApp)
2624 continue;
2625
2626 // check damage school mask
2627 if (!((*itr)->GetMiscValue() & schoolMask))
2628 continue;
2629
2630 // Damage can be splitted only if aura has an alive caster
2631 Unit* caster = (*itr)->GetCaster();
2632 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2633 continue;
2634
2635 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2636 uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
2637 SpellSchoolMask splitSchoolMask = schoolMask;
2638
2639 (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage);
2640
2641 // absorb must be smaller than the damage itself
2642 splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
2643
2644 // Roar of Sacrifice, dont absorb it
2645 if (splitSpellInfo->Id != 53480)
2646 dmgInfo.AbsorbDamage(splitDamage);
2647 else
2648 splitSchoolMask = SPELL_SCHOOL_MASK_NATURE;
2649
2650 uint32 splitted = splitDamage;
2651 uint32 splitted_absorb = 0;
2652 uint32 splitted_resist = 0;
2653
2654 uint32 procAttacker = 0, procVictim = 0;
2655 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, splitSchoolMask, dmgInfo.GetDamageType());
2656 splittedDmgInfo.AddHitMask(PROC_HIT_NORMAL);
2657 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2658 {
2659 splittedDmgInfo.AddHitMask(PROC_HIT_IMMUNE);
2660 splittedDmgInfo.AbsorbDamage(splitted);
2661 }
2662 else
2663 {
2664 Unit::CalcAbsorbResist(splittedDmgInfo, true, casterLevel);
2665 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2666 }
2667
2668 splitted_absorb = splittedDmgInfo.GetAbsorb();
2669 splitted_resist = splittedDmgInfo.GetResist();
2670 splitted = splittedDmgInfo.GetDamage();
2671
2672 // Add absorb to hitMask if damage was absorbed
2673 if (splittedDmgInfo.GetAbsorb())
2674 splittedDmgInfo.AddHitMask(PROC_HIT_ABSORB);
2675
2676 // create procs
2677 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2678 caster->ProcSkillsAndReactives(true, attacker, procVictim, splittedDmgInfo.GetHitMask(), BASE_ATTACK, spellInfo, splitted);
2679
2680 if (attacker)
2681 {
2682 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, splitSchoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2683 }
2684
2685 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2686
2687 // Split damage is a hostile interaction for its recipient too.
2688 if (splitDamage && attacker && !attacker->IsFriendlyTo(caster) && !skipCombat)
2689 attacker->AtTargetAttacked(caster, !spellInfo || spellInfo->HasInitialAggro());
2690
2691 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo,
2692 false, false, nullptr, skipCombat);
2693 }
2694 }
2695}
double rand_norm()
Definition Random.cpp:85
@ POWER_MANA
Definition SharedDefines.h:257
@ SPELL_ATTR4_NO_CAST_LOG
Definition SharedDefines.h:518
SpellSchoolMask
Definition SharedDefines.h:283
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:288
@ SPELL_SCHOOL_MASK_HOLY
Definition SharedDefines.h:286
@ SPELL_AURA_MANA_SHIELD
Definition SpellAuraDefines.h:160
@ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL
Definition SpellAuraDefines.h:257
@ SPELL_AURA_SPLIT_DAMAGE_FLAT
Definition SpellAuraDefines.h:216
@ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL
Definition SpellAuraDefines.h:258
@ SPELL_AURA_SPLIT_DAMAGE_PCT
Definition SpellAuraDefines.h:144
@ SPELL_AURA_SCHOOL_ABSORB
Definition SpellAuraDefines.h:132
@ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST
Definition SpellAuraDefines.h:333
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition SpellAuraDefines.h:394
@ SPELL_ATTR0_CU_BINARY_SPELL
Definition SpellInfo.h:197
@ SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC
Definition SpellInfo.h:200
@ PROC_HIT_IMMUNE
Definition SpellMgr.h:265
@ PROC_HIT_ABSORB
Definition SpellMgr.h:267
@ PROC_HIT_NORMAL
Definition SpellMgr.h:257
void createProcFlags(SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
Definition Unit.cpp:12385
@ DIRECT_DAMAGE
Definition Unit.h:262
@ MELEE_HIT_NORMAL
Definition Unit.h:300
T RoundToInterval(T &num, T floor, T ceil)
Definition Util.h:70
Definition SpellAuraEffects.h:352
Definition SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
bool IsAffectedOnSpell(SpellInfo const *spell) const
Definition SpellAuraEffects.cpp:1093
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66
Unit * GetCaster() const
Definition SpellAuraEffects.h:47
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2684
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2702
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2716
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2730
void ResistDamage(uint32 amount)
Definition Unit.cpp:271
void AbsorbDamage(uint32 amount)
Definition Unit.cpp:264
Unit * GetVictim() const
Definition Unit.h:376
bool SkipsCombat() const
Definition Unit.h:385
Unit * GetAttacker() const
Definition Unit.h:375
SpellInfo const * GetSpellInfo() const
Definition Unit.h:377
DamageEffectType GetDamageType() const
Definition Unit.h:379
SpellSchoolMask GetSchoolMask() const
Definition Unit.h:378
uint32 GetDamage() const
Definition Unit.h:381
bool HasInitialAggro() const
Definition SpellInfo.cpp:1333
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10858
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1445
std::vector< AuraEffect * > AuraEffectList
Definition Unit.h:686
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr, bool skipCombat=false)
Definition Unit.cpp:990
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition Unit.cpp:2226
static float GetEffectiveResistChance(Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim, SpellInfo const *spellInfo=nullptr, uint8 casterLevel=0)
Definition Unit.cpp:2299
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:6108
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition Unit.cpp:6113
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6540
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:7096
void ProcSkillsAndReactives(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:12459
bool IsImmunedToDamageOrSchool(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9785
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, AuraEffect const *except=nullptr) const
Definition Unit.cpp:6143
bool IsInPreDeathAuraTick() const
Definition Unit.h:1809
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false, uint8 casterLevel=0)
Definition Unit.cpp:2337
Definition Unit.h:329

References DamageInfo::AbsorbDamage(), DamageInfo::AddHitMask(), AddPct(), AtTargetAttacked(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculatePct(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectManaShieldHandlers(), createProcFlags(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, SpellInfo::Effects, DamageInfo::GetAbsorb(), AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), DamageInfo::GetAttacker(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraApplication::GetBase(), AuraEffect::GetCaster(), DamageInfo::GetDamage(), DamageInfo::GetDamageType(), GetEffectiveResistChance(), AuraEffect::GetEffIndex(), Object::GetGUID(), DamageInfo::GetHitMask(), GetMaxPositiveAuraModifier(), GetMaxPositiveAuraModifierByMiscMask(), AuraEffect::GetMiscValue(), DamageInfo::GetResist(), DamageInfo::GetSchoolMask(), DamageInfo::GetSpellInfo(), AuraEffect::GetSpellInfo(), GetTotalAuraMultiplier(), DamageInfo::GetVictim(), SpellInfo::HasAttribute(), SpellInfo::HasInitialAggro(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), IsAlive(), Object::IsCreature(), IsFriendlyTo(), IsImmunedToDamageOrSchool(), IsInPreDeathAuraTick(), Object::IsInWorld(), MELEE_HIT_NORMAL, ModifyPower(), POWER_MANA, PROC_HIT_ABSORB, PROC_HIT_IMMUNE, PROC_HIT_NORMAL, ProcSkillsAndReactives(), rand_norm(), Aura::Remove(), DamageInfo::ResistDamage(), RoundToInterval(), SendSpellNonMeleeDamageLog(), AuraEffect::SetAmount(), DamageInfo::SkipsCombat(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC, SPELL_ATTR4_NO_CAST_LOG, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPLIT_DAMAGE_FLAT, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NATURE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), DealDamageShieldDamage(), Spell::DoAllEffectOnTarget(), Player::EnvironmentalDamage(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcArmorReducedDamage()

uint32 Unit::CalcArmorReducedDamage ( Unit const *  attacker,
Unit const *  victim,
const uint32  damage,
SpellInfo const *  spellInfo,
uint8  attackerLevel = 0,
WeaponAttackType  attackType = MAX_ATTACK 
)
static
2227{
2228 float armor = float(victim->GetArmor());
2229
2230 // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
2231 if (attacker)
2232 {
2233 armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
2234
2235 if (spellInfo)
2236 if (Player* modOwner = attacker->GetSpellModOwner())
2237 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
2238
2239 // Apply ability-specific ignore target resist effects for physical damage (armor)
2240 AuraEffectList const& targetIgnoreRes = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
2241 for (AuraEffect const* aurEff : targetIgnoreRes)
2242 if (aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && aurEff->IsAffectedOnSpell(spellInfo))
2243 armor = std::floor(AddPct(armor, -aurEff->GetAmount()));
2244
2245 // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
2246 if (attacker->IsPlayer())
2247 {
2248 float bonusPct = 0;
2249 bonusPct += attacker->GetTotalAuraModifier(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, [spellInfo,attacker](AuraEffect const* aurEff)
2250 {
2251 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
2252 {
2253 if (!spellInfo || aurEff->IsAffectedOnSpell(spellInfo) || aurEff->GetMiscValue() & spellInfo->GetSchoolMask())
2254 return true;
2255 else if (!aurEff->GetMiscValue() && !aurEff->HasSpellClassMask())
2256 return true;
2257 }
2258 else
2259 {
2260 if (attacker->ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
2261 return true;
2262 }
2263 return false;
2264 });
2265
2266 float maxArmorPen = 0;
2267 if (victim->GetLevel() < 60)
2268 maxArmorPen = float(400 + 85 * victim->GetLevel());
2269 else
2270 maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
2271
2272 // Cap armor penetration to this number
2273 maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
2274 // Figure out how much armor do we ignore
2275 float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
2276 // Got the value, apply it
2277 armor -= std::min(armorPen, maxArmorPen);
2278 }
2279 }
2280
2281 if (armor < 0.0f)
2282 armor = 0.0f;
2283
2284 float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
2285 if (levelModifier > 59)
2286 levelModifier = levelModifier + (4.5f * (levelModifier - 59));
2287
2288 float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
2289 tmpvalue = tmpvalue / (1.0f + tmpvalue);
2290
2291 if (tmpvalue < 0.0f)
2292 tmpvalue = 0.0f;
2293 if (tmpvalue > 0.75f)
2294 tmpvalue = 0.75f;
2295
2296 return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f)));
2297}
@ SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
Definition SpellAuraDefines.h:343
@ SPELL_AURA_MOD_TARGET_RESISTANCE
Definition SpellAuraDefines.h:186
@ SPELLMOD_IGNORE_ARMOR
Definition SpellDefines.h:97
@ CR_ARMOR_PENETRATION
Definition Unit.h:255
int32 EquippedItemClass
Definition SpellInfo.h:399
STL namespace.

References AddPct(), CalculatePct(), CR_ARMOR_PENETRATION, SpellInfo::EquippedItemClass, GetArmor(), GetAuraEffectsByType(), GetLevel(), AuraEffect::GetMiscValue(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Player::HasItemFitToSpellRequirements(), AuraEffect::HasSpellClassMask(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), Object::IsPlayer(), SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_IGNORE_ARMOR, and Object::ToPlayer().

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), Spell::DoAllEffectOnTarget(), boss_priestess_lackey_commonAI::GetThreatMod(), boss_faction_championsAI::GetThreatMod(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcHealAbsorb()

void Unit::CalcHealAbsorb ( HealInfo &  healInfo)
static
2698{
2699 if (!healInfo.GetHeal())
2700 return;
2701
2702 int32 const healing = static_cast<int32>(healInfo.GetHeal());
2703 int32 absorbAmount = 0;
2704
2705 // Need remove expired auras after
2706 bool existExpired = false;
2707
2708 // absorb without mana cost
2710 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && absorbAmount <= healing; ++i)
2711 {
2712 if (!((*i)->GetMiscValue() & healInfo.GetSpellInfo()->SchoolMask))
2713 continue;
2714
2715 // Max Amount can be absorbed by this aura
2716 int32 currentAbsorb = (*i)->GetAmount();
2717
2718 // Found empty aura (impossible but..)
2719 if (currentAbsorb <= 0)
2720 {
2721 existExpired = true;
2722 continue;
2723 }
2724
2725 // currentAbsorb - damage can be absorbed by shield
2726 // If need absorb less damage
2727 if (healing < currentAbsorb + absorbAmount)
2728 currentAbsorb = healing - absorbAmount;
2729
2730 absorbAmount += currentAbsorb;
2731
2732 // Reduce shield amount
2733 (*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
2734 // Need remove it later
2735 if ((*i)->GetAmount() <= 0)
2736 existExpired = true;
2737 }
2738
2739 // Remove all expired absorb auras
2740 if (existExpired)
2741 {
2742 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
2743 {
2744 AuraEffect* auraEff = *i;
2745 ++i;
2746 if (auraEff->GetAmount() <= 0)
2747 {
2748 uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
2750 if (healInfo.GetTarget()->m_removedAurasCount > removedAuras)
2751 i = vHealAbsorb.begin();
2752 }
2753 }
2754 }
2755
2756 if (absorbAmount > 0)
2757 healInfo.AbsorbHeal(absorbAmount);
2758}
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
Definition SpellAuraDefines.h:364
SpellInfo const * GetSpellInfo() const
Definition Unit.h:443
void AbsorbHeal(uint32 amount)
Definition Unit.h:412
Unit * GetTarget() const
Definition Unit.h:438
uint32 GetHeal() const
Definition Unit.h:439
uint32 SchoolMask
Definition SpellInfo.h:416

References HealInfo::AbsorbHeal(), AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetBase(), HealInfo::GetHeal(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), m_removedAurasCount, Aura::Remove(), SpellInfo::SchoolMask, and SPELL_AURA_SCHOOL_HEAL_ABSORB.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), and HealBySpell().

◆ CalculateAOEDamageReduction()

int32 Unit::CalculateAOEDamageReduction ( int32  damage,
uint32  schoolMask,
bool  npcCaster 
) const
16059{
16060 damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
16061 if (npcCaster)
16063
16064 return damage;
16065}
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:373
@ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:292
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6133

References GetTotalAuraMultiplierByMiscMask(), SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, and SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE.

Referenced by Spell::DoAllEffectOnLaunchTarget(), AuraEffect::HandlePeriodicDamageAurasTick(), and spell_dk_death_and_decay::RecalculateDamage().

◆ CalculateDamage()

uint32 Unit::CalculateDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
uint8  itemDamagesMask = 0 
)
3186{
3187 float minDamage = 0.0f;
3188 float maxDamage = 0.0f;
3189
3190 if (normalized || !addTotalPct || itemDamagesMask)
3191 {
3192 // get both by default
3193 if (!itemDamagesMask)
3194 {
3195 itemDamagesMask = (1 << 0) | (1 << 1);
3196 }
3197
3198 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
3199 {
3200 if (itemDamagesMask & (1 << i))
3201 {
3202 float minTmp, maxTmp;
3203 CalculateMinMaxDamage(attType, normalized, addTotalPct, minTmp, maxTmp, i);
3204 minDamage += minTmp;
3205 maxDamage += maxTmp;
3206 }
3207 }
3208 }
3209 else
3210 {
3211 switch (attType)
3212 {
3213 case RANGED_ATTACK:
3216 break;
3217 case BASE_ATTACK:
3220 break;
3221 case OFF_ATTACK:
3224 break;
3225 default:
3226 break;
3227 }
3228 }
3229
3230 minDamage = std::max(0.f, minDamage);
3231 maxDamage = std::max(0.f, maxDamage);
3232
3233 if (minDamage > maxDamage)
3234 {
3235 std::swap(minDamage, maxDamage);
3236 }
3237
3238 return urand(uint32(minDamage), uint32(maxDamage));
3239}
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ UNIT_FIELD_MINDAMAGE
Definition UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition UpdateFields.h:128
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition UpdateFields.h:130
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition UpdateFields.h:169
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition UpdateFields.h:168
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition UpdateFields.h:129
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0

References BASE_ATTACK, CalculateMinMaxDamage(), Object::GetFloatValue(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, and urand().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ CalculateDefaultCoefficient()

float Unit::CalculateDefaultCoefficient ( SpellInfo const *  spellInfo,
DamageEffectType  damagetype 
) const
13301{
13302 // Damage over Time spells bonus calculation
13303 float DotFactor = 1.0f;
13304 if (damagetype == DOT)
13305 {
13306 int32 DotDuration = spellInfo->GetDuration();
13307 if (!spellInfo->IsChanneled() && DotDuration > 0)
13308 DotFactor = DotDuration / 15000.0f;
13309
13310 if (uint32 DotTicks = spellInfo->GetMaxTicks())
13311 DotFactor /= DotTicks;
13312 }
13313
13314 int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
13315 // Distribute Damage over multiple effects, reduce by AoE
13316 CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
13317
13318 // As wowwiki says: C = (Cast Time / 3.5)
13319 return (CastingTime / 3500.0f) * DotFactor;
13320}
@ DOT
Definition Unit.h:264
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
Definition Unit.cpp:13182

References SpellInfo::CalcCastTime(), DOT, GetCastingTimeForBonus(), SpellInfo::GetDuration(), SpellInfo::GetMaxTicks(), and SpellInfo::IsChanneled().

Referenced by SpellDamageBonusTaken(), and SpellHealingBonusTaken().

◆ CalculateLevelPenalty()

float Unit::CalculateLevelPenalty ( SpellInfo const *  spellProto) const
3242{
3243 if (!IsPlayer())
3244 return 1.0f;
3245
3246 if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
3247 return 1.0f;
3248
3249 float LvlPenalty = 0.0f;
3250
3251 // xinef: added brackets
3252 if (spellProto->SpellLevel < 20)
3253 LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
3254
3255 float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
3256 if (LvlFactor > 1.0f)
3257 LvlFactor = 1.0f;
3258
3259 return AddPct(LvlFactor, -LvlPenalty);
3260}
uint8 GetLevel() const
Definition Unit.h:1117

References AddPct(), GetLevel(), Object::IsPlayer(), SpellInfo::MaxLevel, and SpellInfo::SpellLevel.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), and SpellHealingBonusTaken().

◆ CalculateMeleeDamage()

void Unit::CalculateMeleeDamage ( Unit *  victim,
CalcDamageInfo *  damageInfo,
WeaponAttackType  attackType = BASE_ATTACK,
const bool  sittingVictim = false 
)
1678{
1679 damageInfo->attacker = this;
1680 damageInfo->target = victim;
1681
1682 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1683 {
1684 damageInfo->damages[i].damageSchoolMask = GetMeleeDamageSchoolMask(attackType, i);
1685 damageInfo->damages[i].damage = 0;
1686 damageInfo->damages[i].absorb = 0;
1687 damageInfo->damages[i].resist = 0;
1688 }
1689
1690 damageInfo->attackType = attackType;
1691 damageInfo->cleanDamage = 0;
1692 damageInfo->blocked_amount = 0;
1693
1694 damageInfo->TargetState = 0;
1695 damageInfo->HitInfo = 0;
1696 damageInfo->procAttacker = PROC_FLAG_NONE;
1697 damageInfo->procVictim = PROC_FLAG_NONE;
1698 damageInfo->hitOutCome = MELEE_HIT_EVADE;
1699
1700 if (!victim)
1701 return;
1702
1703 if (!IsAlive() || !victim->IsAlive())
1704 return;
1705
1706 // Select HitInfo/procAttacker/procVictim flag based on attack type
1707 switch (attackType)
1708 {
1709 case BASE_ATTACK:
1712 break;
1713 case OFF_ATTACK:
1716 damageInfo->HitInfo = HITINFO_OFFHAND;
1717 break;
1718 default:
1719 return;
1720 }
1721
1722 // School Immune check
1723 uint8 immunedMask = 0;
1724 float minDamage = 0.0f;
1725 float maxDamage = 0.0f;
1726
1727 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1729 immunedMask |= (1 << i);
1730
1731 // Part 0 always carries attack power damage, so the swing can only be immune if part 0 is immune.
1732 // Part 1 then blocks immunity only when it carries damage (0 for an empty slot and for creatures).
1733 if (immunedMask & (1 << 0) && !(immunedMask & (1 << 1)))
1734 CalculateMinMaxDamage(attackType, false, true, minDamage, maxDamage, 1);
1735
1736 if (immunedMask & (1 << 0) && (immunedMask & (1 << 1) || maxDamage <= 0))
1737 {
1738 damageInfo->HitInfo |= HITINFO_NORMALSWING;
1739 damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
1740 return;
1741 }
1742
1743 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1744 {
1745 // only players have secondary weapon damage
1746 if (i > 0 && !IsPlayer())
1747 {
1748 break;
1749 }
1750
1751 if (immunedMask & (1 << i))
1752 {
1753 continue;
1754 }
1755
1756 SpellSchoolMask schoolMask = SpellSchoolMask(damageInfo->damages[i].damageSchoolMask);
1757 bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL);
1758
1759 uint32 damage = 0;
1760 uint8 itemDamagesMask = (IsPlayer()) ? (1 << i) : 0;
1761
1762 damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask);
1763 // Add melee damage bonus
1764 damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, nullptr, schoolMask);
1765 damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, nullptr, schoolMask);
1766
1767 // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
1768 sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
1769
1770 if (victim->GetAI())
1771 {
1772 victim->GetAI()->OnCalculateMeleeDamageReceived(damage, this);
1773 }
1774
1775 // Calculate armor reduction
1777 {
1778 damageInfo->damages[i].damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
1779 damageInfo->cleanDamage += damage - damageInfo->damages[i].damage;
1780 }
1781 else
1782 {
1783 damageInfo->damages[i].damage = damage;
1784 }
1785 }
1786
1787 damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType);
1788
1789 // If the victim was a sitting player and we didn't roll a miss, then crit.
1790 if (sittingVictim && damageInfo->hitOutCome != MELEE_HIT_MISS)
1791 {
1792 damageInfo->hitOutCome = MELEE_HIT_CRIT;
1793 }
1794 switch (damageInfo->hitOutCome)
1795 {
1796 case MELEE_HIT_EVADE:
1798 damageInfo->TargetState = VICTIMSTATE_EVADES;
1799
1800 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1801 {
1802 damageInfo->damages[i].damage = 0;
1803 }
1804
1805 damageInfo->cleanDamage = 0;
1806 return;
1807 case MELEE_HIT_MISS:
1808 damageInfo->HitInfo |= HITINFO_MISS;
1809 damageInfo->TargetState = VICTIMSTATE_INTACT;
1810
1811 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1812 {
1813 damageInfo->damages[i].damage = 0;
1814 }
1815 damageInfo->cleanDamage = 0;
1816 break;
1817 case MELEE_HIT_NORMAL:
1818 damageInfo->TargetState = VICTIMSTATE_HIT;
1819 break;
1820 case MELEE_HIT_CRIT:
1821 {
1822 damageInfo->HitInfo |= HITINFO_CRITICALHIT;
1823 damageInfo->TargetState = VICTIMSTATE_HIT;
1824 // Crit bonus calc
1825 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1826 {
1827 damageInfo->damages[i].damage *= 2;
1828
1829 float mod = 0.0f;
1830 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1831 if (damageInfo->attackType == RANGED_ATTACK)
1832 {
1834 }
1835 else
1836 {
1838
1839 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1841 }
1842
1843 uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask();
1844
1845 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1847 if (mod != 0)
1848 {
1849 AddPct(damageInfo->damages[i].damage, mod);
1850 }
1851 }
1852 break;
1853 }
1854 case MELEE_HIT_PARRY:
1855 damageInfo->TargetState = VICTIMSTATE_PARRY;
1856 damageInfo->cleanDamage = 0;
1857
1858 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1859 {
1860 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1861 damageInfo->damages[i].damage = 0;
1862 }
1863 break;
1864 case MELEE_HIT_DODGE:
1865 damageInfo->TargetState = VICTIMSTATE_DODGE;
1866 damageInfo->cleanDamage = 0;
1867
1868 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1869 {
1870 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1871 damageInfo->damages[i].damage = 0;
1872 }
1873 break;
1874 case MELEE_HIT_BLOCK:
1875 {
1876 damageInfo->TargetState = VICTIMSTATE_HIT;
1877 damageInfo->HitInfo |= HITINFO_BLOCK;
1878 damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
1879 // double blocked amount if block is critical
1880 if (damageInfo->target->isBlockCritical())
1881 damageInfo->blocked_amount += damageInfo->blocked_amount;
1882
1883 uint32 remainingBlock = damageInfo->blocked_amount;
1884 uint8 fullBlockMask = 0;
1885 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1886 {
1887 if (remainingBlock && remainingBlock >= damageInfo->damages[i].damage)
1888 {
1889 fullBlockMask |= (1 << i);
1890
1891 remainingBlock -= damageInfo->damages[i].damage;
1892 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1893 damageInfo->damages[i].damage = 0;
1894 }
1895 else
1896 {
1897 damageInfo->cleanDamage += remainingBlock;
1898 damageInfo->damages[i].damage -= remainingBlock;
1899 remainingBlock = 0;
1900 }
1901 }
1902
1903 // full block
1904 if (fullBlockMask == ((1 << 0) | (1 << 1)))
1905 {
1906 damageInfo->TargetState = VICTIMSTATE_BLOCKS;
1907 damageInfo->blocked_amount -= remainingBlock;
1908 }
1909 break;
1910 }
1911 case MELEE_HIT_GLANCING:
1912 {
1913 damageInfo->HitInfo |= HITINFO_GLANCING;
1914 damageInfo->TargetState = VICTIMSTATE_HIT;
1915 int32 leveldif = int32(victim->getLevelForTarget(this)) - int32(GetLevel());
1916 leveldif = std::min(std::max(leveldif, 1), 3);
1917
1918 // 1-10% damage reduction against same level and +1 targets, up to 20-30% against a +3 boss
1919 int32 const reductionMax = leveldif * 10;
1920 int32 const reductionMin = std::max(1, reductionMax - 10);
1921 float reducePercent = 1.0f - irand(reductionMin, reductionMax) / 100.0f;
1922
1923 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1924 {
1925 uint32 reducedDamage = uint32(reducePercent * damageInfo->damages[i].damage);
1926 damageInfo->cleanDamage += damageInfo->damages[i].damage - reducedDamage;
1927 damageInfo->damages[i].damage = reducedDamage;
1928 }
1929 break;
1930 }
1931 case MELEE_HIT_CRUSHING:
1932 damageInfo->HitInfo |= HITINFO_CRUSHING;
1933 damageInfo->TargetState = VICTIMSTATE_HIT;
1934
1935 // 150% normal damage
1936 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1937 {
1938 damageInfo->damages[i].damage += (damageInfo->damages[i].damage / 2);
1939 }
1940 break;
1941 default:
1942 break;
1943 }
1944
1945 // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss
1946 if (!(damageInfo->HitInfo & HITINFO_MISS))
1947 damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
1948
1949 uint32 tmpHitInfo[MAX_ITEM_PROTO_DAMAGES] = { };
1950
1951 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1952 {
1953 int32 dmg = damageInfo->damages[i].damage;
1954 int32 cleanDamage = damageInfo->cleanDamage;
1955 // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
1956 if (CanApplyResilience())
1957 {
1958 int32 resilienceReduction = damageInfo->damages[i].damage;
1959 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
1960
1961 resilienceReduction = damageInfo->damages[i].damage - resilienceReduction;
1962 dmg -= resilienceReduction;
1963 cleanDamage += resilienceReduction;
1964 }
1965
1966 damageInfo->damages[i].damage = std::max(0, dmg);
1967 damageInfo->cleanDamage = std::max(0, cleanDamage);
1968
1969 // Calculate absorb resist
1970 if (damageInfo->damages[i].damage > 0)
1971 {
1972 damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE;
1973
1974 // Calculate absorb & resists
1975 DamageInfo dmgInfo(*damageInfo, i);
1976 Unit::CalcAbsorbResist(dmgInfo);
1977 damageInfo->damages[i].absorb = dmgInfo.GetAbsorb();
1978 damageInfo->damages[i].resist = dmgInfo.GetResist();
1979
1980 if (damageInfo->damages[i].absorb)
1981 {
1982 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB);
1983 }
1984
1985 if (damageInfo->damages[i].resist)
1986 {
1987 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST);
1988 }
1989
1990 damageInfo->damages[i].damage = dmgInfo.GetDamage();
1991 }
1992 }
1993
1994 // set proper HitInfo flags
1995 if ((tmpHitInfo[0] & HITINFO_FULL_ABSORB) != 0)
1996 {
1997 // set partial absorb when secondary damage isn't full absorbed
1998 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_ABSORB) != 0) ? HITINFO_PARTIAL_ABSORB : HITINFO_FULL_ABSORB;
1999 }
2000 else
2001 {
2002 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_ABSORB);
2003 }
2004
2005 if ((tmpHitInfo[0] & HITINFO_FULL_RESIST) != 0)
2006 {
2007 // set partial resist when secondary damage isn't full resisted
2008 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_RESIST) != 0) ? HITINFO_PARTIAL_RESIST : HITINFO_FULL_RESIST;
2009 }
2010 else
2011 {
2012 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_RESIST);
2013 }
2014
2015}
int32 irand(int32 min, int32 max)
Definition Random.cpp:37
@ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
Definition SpellAuraDefines.h:232
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE
Definition SpellAuraDefines.h:267
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
Definition SpellAuraDefines.h:226
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
Definition SpellAuraDefines.h:266
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:113
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition SpellMgr.h:143
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:140
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:114
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition SpellMgr.h:144
@ PROC_FLAG_NONE
Definition SpellMgr.h:108
@ VICTIMSTATE_INTACT
Definition Unit.h:86
@ VICTIMSTATE_HIT
Definition Unit.h:87
@ VICTIMSTATE_DODGE
Definition Unit.h:88
@ VICTIMSTATE_IS_IMMUNE
Definition Unit.h:93
@ VICTIMSTATE_PARRY
Definition Unit.h:89
@ VICTIMSTATE_BLOCKS
Definition Unit.h:91
@ VICTIMSTATE_EVADES
Definition Unit.h:92
@ HITINFO_PARTIAL_ABSORB
Definition Unit.h:106
@ HITINFO_FULL_RESIST
Definition Unit.h:107
@ HITINFO_NORMALSWING
Definition Unit.h:99
@ HITINFO_BLOCK
Definition Unit.h:113
@ HITINFO_CRUSHING
Definition Unit.h:118
@ HITINFO_SWINGNOHITSOUND
Definition Unit.h:122
@ HITINFO_MISS
Definition Unit.h:104
@ HITINFO_FULL_ABSORB
Definition Unit.h:105
@ HITINFO_OFFHAND
Definition Unit.h:102
@ HITINFO_GLANCING
Definition Unit.h:117
@ HITINFO_CRITICALHIT
Definition Unit.h:109
@ HITINFO_PARTIAL_RESIST
Definition Unit.h:108
@ HITINFO_AFFECTS_VICTIM
Definition Unit.h:101
@ MELEE_HIT_CRUSHING
Definition Unit.h:300
@ MELEE_HIT_BLOCK
Definition Unit.h:299
@ MELEE_HIT_CRIT
Definition Unit.h:300
@ MELEE_HIT_EVADE
Definition Unit.h:299
@ MELEE_HIT_DODGE
Definition Unit.h:299
@ MELEE_HIT_MISS
Definition Unit.h:299
@ MELEE_HIT_PARRY
Definition Unit.h:299
@ MELEE_HIT_GLANCING
Definition Unit.h:300
virtual void OnCalculateMeleeDamageReceived(uint32 &, Unit *)
Called during damage calculations.
Definition UnitAI.h:388
bool isBlockCritical()
Definition Unit.cpp:3324
uint32 MeleeDamageBonusTaken(Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:10171
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
uint8 getLevelForTarget(WorldObject const *) const override
Definition Unit.h:1118
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6123
bool CanApplyResilience() const
Definition Unit.h:1186
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
Definition Unit.cpp:3185
virtual uint32 GetShieldBlockValue() const =0
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:14905
UnitAI * GetAI()
Definition Unit.h:699
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2203
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:6103
MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const *victim, WeaponAttackType attType) const
Definition Unit.cpp:2983
uint32 GetCreatureTypeMask() const
Definition Unit.h:834
uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:9981
uint32 damageSchoolMask
Definition Unit.h:495
uint32 blocked_amount
Definition Unit.h:501
MeleeHitOutcome hitOutCome
Definition Unit.h:509
uint32 cleanDamage
Definition Unit.h:508
uint32 TargetState
Definition Unit.h:503
uint32 resist
Definition Unit.h:498

References CalcDamageInfo::absorb, AddPct(), ApplyResilience(), CalcDamageInfo::attacker, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculateDamage(), CalculateMinMaxDamage(), CanApplyResilience(), CalcDamageInfo::cleanDamage, CR_CRIT_TAKEN_MELEE, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), GetLevel(), getLevelForTarget(), GetMeleeDamageSchoolMask(), DamageInfo::GetResist(), GetShieldBlockValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplierByMiscMask(), CalcDamageInfo::HitInfo, HITINFO_AFFECTS_VICTIM, HITINFO_BLOCK, HITINFO_CRITICALHIT, HITINFO_CRUSHING, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_GLANCING, HITINFO_MISS, HITINFO_NORMALSWING, HITINFO_OFFHAND, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_SWINGNOHITSOUND, CalcDamageInfo::hitOutCome, irand(), IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, MeleeDamageBonusDone(), MeleeDamageBonusTaken(), OFF_ATTACK, UnitAI::OnCalculateMeleeDamageReceived(), PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_NONE, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, CalcDamageInfo::procAttacker, CalcDamageInfo::procVictim, RANGED_ATTACK, CalcDamageInfo::resist, RollMeleeOutcomeAgainst(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, CalcDamageInfo::target, CalcDamageInfo::TargetState, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, VICTIMSTATE_EVADES, VICTIMSTATE_HIT, VICTIMSTATE_INTACT, VICTIMSTATE_IS_IMMUNE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ CalculateMinMaxDamage()

virtual void Unit::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex = 0 
)
pure virtual

◆ CalculateSpellDamageTaken()

void Unit::CalculateSpellDamageTaken ( SpellNonMeleeDamage *  damageInfo,
int32  damage,
SpellInfo const *  spellInfo,
WeaponAttackType  attackType = BASE_ATTACK,
bool  crit = false 
)
1505{
1506 if (damage < 0)
1507 return;
1508
1509 Unit* victim = damageInfo->target;
1510 if (!victim || !victim->IsAlive())
1511 return;
1512
1513 SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
1514 uint32 crTypeMask = victim->GetCreatureTypeMask();
1515
1516 // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
1517 sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
1518
1519 if (victim->GetAI())
1520 {
1521 victim->GetAI()->OnCalculateSpellDamageReceived(damage, this);
1522 }
1523
1524 int32 cleanDamage = 0;
1525 if (!spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
1526 {
1527 int32 oldDamage = damage;
1528 damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType);
1529 cleanDamage = oldDamage - damage;
1530 }
1531
1532 bool blocked = false;
1533 // Per-school calc
1534 switch (spellInfo->DmgClass)
1535 {
1536 // Melee and Ranged Spells
1539 {
1540 // Physical Damage
1541 if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
1542 {
1543 // Get blocked status
1544 blocked = isSpellBlocked(victim, spellInfo, attackType);
1545 }
1546
1547 if (crit)
1548 {
1549 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1550
1551 // Calculate crit bonus (100% for melee/ranged spells)
1552 int32 crit_bonus = damage;
1553 crit_bonus += damage;
1554
1555 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1556 float crit_mod = 0.0f;
1557 if (attackType == RANGED_ATTACK)
1559 else
1561
1562 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1563 crit_mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask());
1564 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1566
1567 if (crit_bonus != 0 && crit_mod != 0.0f)
1568 AddPct(crit_bonus, crit_mod);
1569
1570 crit_bonus -= damage;
1571
1572 // adds additional damage to critBonus (from talents)
1573 if (Player* modOwner = GetSpellModOwner())
1574 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
1575
1576 damage = crit_bonus + damage;
1577 }
1578
1579 // Spell weapon based damage CAN BE crit & blocked at same time
1580 if (blocked)
1581 {
1582 damageInfo->blocked = victim->GetShieldBlockValue();
1583 // double blocked amount if block is critical
1584 if (victim->isBlockCritical())
1585 damageInfo->blocked *= 2;
1586 if (damage < int32(damageInfo->blocked))
1587 damageInfo->blocked = uint32(damage);
1588
1589 damage -= damageInfo->blocked;
1590 cleanDamage += damageInfo->blocked;
1591 }
1592
1593 int32 resilienceReduction = damage;
1594 if (CanApplyResilience())
1595 {
1596 if (attackType != RANGED_ATTACK)
1597 {
1598 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_MELEE);
1599 }
1600 else
1601 {
1602 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_RANGED);
1603 }
1604 }
1605
1606 resilienceReduction = damage - resilienceReduction;
1607 damage -= resilienceReduction;
1608 cleanDamage += resilienceReduction;
1609 break;
1610 }
1611 // Magical Attacks
1614 {
1615 // If crit add critical bonus
1616 if (crit)
1617 {
1618 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1619 damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim);
1620 }
1621
1622 int32 resilienceReduction = damage;
1623 if (CanApplyResilience())
1624 {
1625 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
1626 }
1627
1628 resilienceReduction = damage - resilienceReduction;
1629 damage -= resilienceReduction;
1630 cleanDamage += resilienceReduction;
1631 break;
1632 }
1633 default:
1634 break;
1635 }
1636
1637 damageInfo->cleanDamage = std::max(0, cleanDamage);
1638 damageInfo->damage = std::max(0, damage);
1639
1640 // Calculate absorb resist
1641 if (damageInfo->damage > 0)
1642 {
1643 DamageInfo dmgInfo(*damageInfo, SPELL_DIRECT_DAMAGE, BASE_ATTACK, 0);
1644 Unit::CalcAbsorbResist(dmgInfo);
1645 damageInfo->absorb = dmgInfo.GetAbsorb();
1646 damageInfo->resist = dmgInfo.GetResist();
1647 damageInfo->damage = dmgInfo.GetDamage();
1648 }
1649}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1552
@ SPELL_DAMAGE_CLASS_MAGIC
Definition SharedDefines.h:1550
@ SPELL_DAMAGE_CLASS_NONE
Definition SharedDefines.h:1549
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1551
@ SPELL_HIT_TYPE_CRIT
Definition SharedDefines.h:1540
@ SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS
Definition SharedDefines.h:526
@ SPELLMOD_CRIT_DAMAGE_BONUS
Definition SpellDefines.h:99
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:263
virtual void OnCalculateSpellDamageReceived(int32 &, Unit *)
Definition UnitAI.h:389
bool isSpellBlocked(Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
Definition Unit.cpp:3298
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:9218
Unit * target
Definition Unit.h:521
uint32 HitInfo
Definition Unit.h:532
uint32 damage
Definition Unit.h:524
uint32 absorb
Definition Unit.h:527
Unit * attacker
Definition Unit.h:522
uint32 schoolMask
Definition Unit.h:526
uint32 cleanDamage
Definition Unit.h:534
uint32 resist
Definition Unit.h:528
uint32 blocked
Definition Unit.h:531

References SpellNonMeleeDamage::absorb, AddPct(), ApplyResilience(), SpellNonMeleeDamage::attacker, BASE_ATTACK, SpellNonMeleeDamage::blocked, CalcAbsorbResist(), CalcArmorReducedDamage(), CanApplyResilience(), SpellNonMeleeDamage::cleanDamage, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, SpellNonMeleeDamage::damage, SpellInfo::DmgClass, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), GetShieldBlockValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), isSpellBlocked(), UnitAI::OnCalculateSpellDamageReceived(), RANGED_ATTACK, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_DIRECT_DAMAGE, SPELL_HIT_TYPE_CRIT, SPELL_SCHOOL_MASK_NORMAL, SpellCriticalDamageBonus(), SPELLMOD_CRIT_DAMAGE_BONUS, sScriptMgr, and SpellNonMeleeDamage::target.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ CanApplyResilience()

bool Unit::CanApplyResilience ( ) const
inline

◆ CanDualWield()

◆ CanEnterWater()

virtual bool Unit::CanEnterWater ( ) const
pure virtual

Implemented in Creature, and Player.

◆ CanFly()

◆ CanFreeMove()

bool Unit::CanFreeMove ( ) const
inline
1745 {
1748 }
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:184
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:180
@ UNIT_STATE_IN_FLIGHT
Definition UnitDefines.h:181
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:176

References GetOwnerGUID(), HasUnitState(), UNIT_STATE_CONFUSED, UNIT_STATE_DISTRACTED, UNIT_STATE_FLEEING, UNIT_STATE_IN_FLIGHT, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by Creature::IsFreeToMove().

◆ CanHaveThreatList()

bool Unit::CanHaveThreatList ( bool  skipAliveCheck = false) const
11266{
11267 // Delegate to ThreatManager's cached value for consistency
11269 return false;
11270
11271 // only alive units can have threat list
11272 if (!skipAliveCheck && !IsAlive())
11273 return false;
11274
11275 // vehicles can not have threat list in battlegrounds
11276 if (ToCreature()->IsVehicle() && GetMap()->IsBattlegroundOrArena())
11277 return false;
11278
11279 return true;
11280}
static bool CanHaveThreatList(Unit const *who)
Definition ThreatManager.cpp:207
bool IsVehicle() const
Definition Unit.h:806

References ThreatManager::CanHaveThreatList(), WorldObject::GetMap(), IsAlive(), IsVehicle(), m_threatManager, and Object::ToCreature().

Referenced by AddThreat(), Creature::CanPeriodicallyCallForAssistance(), ScriptedAI::DoResetThreatList(), Spell::EffectTaunt(), Spell::EffectThreat(), EngageWithTarget(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleModDetaunt(), AuraEffect::HandleModTaunt(), spell_pet_guard_dog::HandleProc(), Spell::HandleThreatSpells(), IsEngagedBy(), CreatureAI::JustEnteredCombat(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), SmartScript::ProcessAction(), and Creature::SelectVictim().

◆ CanInstantCast()

bool Unit::CanInstantCast ( ) const
inline
1604{ return _instantCast; }

References _instantCast.

Referenced by WorldObject::ModSpellCastTime().

◆ CanModifyStats()

◆ CanProc()

bool Unit::CanProc ( )
inline
1574{ return !m_procDeep; }

References m_procDeep.

Referenced by Spell::DoAllEffectOnTarget().

◆ CanRestoreMana()

bool Unit::CanRestoreMana ( SpellInfo const *  spellInfo) const
17017{
17018 // Aura of Despair exceptions
17019 switch (spellInfo->Id)
17020 {
17021 case 16666: // Demonic Rune
17022 case 27869: // Dark Rune
17023 case 30824: // Shamanistic Rage
17024 case 31786: // Spiritual Attunement
17025 case 31930: // Judgements of the Wise
17026 case 34075: // Aspect of the Viper
17027 case 34720: // Thrill of the hunt
17028 case 47755: // Rapture
17029 case 54425: // Improved Felhunter
17030 case 57319: // Blessing of Sanctuary
17031 case 63337: // Saronite Vapors (regenerate mana)
17032 case 63375: // Improved stormstrike
17033 case 64372: // Lifebloom
17034 case 68285: // Improved Leader of the Pack
17035 return true;
17036 case 54428: // Divine Plea - only with talent Guarded by the Light
17037 return HasSpell(53583);
17038 default:
17039 break;
17040 }
17041
17042 return false;
17043}
virtual bool HasSpell(uint32) const
Definition Unit.h:1599

References HasSpell(), and SpellInfo::Id.

Referenced by IsImmunedToSpellEffect().

◆ CanSparringWith()

bool Unit::CanSparringWith ( Unit const *  attacker) const
protected
3876{
3878 return false;
3879
3880 if (!attacker)
3881 return false;
3882
3883 if (!attacker->IsCreature() || attacker->IsCharmedOwnedByPlayerOrPlayer())
3884 return false;
3885
3886 if (Creature const* creature = ToCreature())
3887 if (!creature->GetSparringPct())
3888 return false;
3889
3890 return true;
3891}
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition Unit.h:1326

References IsCharmedOwnedByPlayerOrPlayer(), Object::IsCreature(), and Object::ToCreature().

Referenced by AttackerStateUpdate(), and DealDamage().

◆ CanSwim()

bool Unit::CanSwim ( ) const
virtual

this method checks the current flag of a unit

These flags can be set within the database or dynamically changed at runtime UNIT_FLAG_SWIMMING must be updated when a unit enters a swimmable area

Reimplemented in Creature.

15665{
15666 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
15668 return false;
15670 return true;
15672 return false;
15674 return true;
15676}
@ UNIT_FLAG2_UNUSED_6
Definition UnitDefines.h:314
@ UNIT_FLAG_CANNOT_SWIM
Definition UnitDefines.h:271
@ UNIT_FLAG_POSSESSED
Definition UnitDefines.h:281
@ UNIT_FLAG_SWIMMING
Definition UnitDefines.h:272
@ UNIT_FLAG_RENAME
Definition UnitDefines.h:261
@ UNIT_FLAG_PET_IN_COMBAT
Definition UnitDefines.h:268
bool HasUnitFlag2(UnitFlags2 flags) const
Definition Unit.h:759

References HasUnitFlag(), HasUnitFlag2(), UNIT_FLAG2_UNUSED_6, UNIT_FLAG_CANNOT_SWIM, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_POSSESSED, UNIT_FLAG_RENAME, and UNIT_FLAG_SWIMMING.

Referenced by PathGenerator::BuildPolyPath(), and Creature::CanSwim().

◆ CanUseAttackType()

◆ CastCustomSpell() [1/5]

SpellCastResult Unit::CastCustomSpell ( SpellInfo const *  spellInfo,
CustomSpellValues const &  value,
Unit *  victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1467{
1468 SpellCastTargets targets;
1469 targets.SetUnitTarget(victim);
1470
1471 return CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
1472}
Definition Spell.h:121
void SetUnitTarget(Unit *target)
Definition Spell.cpp:276

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastCustomSpell() [2/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
CustomSpellValues const &  value,
Unit *  victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1455{
1456 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1457 if (!spellInfo)
1458 {
1459 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1461 }
1462
1463 return CastCustomSpell(spellInfo, value, victim, triggerFlags, castItem, triggeredByAura, originalCaster);
1464}
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition SharedDefines.h:1044
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1428

References CastCustomSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastCustomSpell() [3/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit *  victim,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1441{
1442 CustomSpellValues values;
1443 values.AddSpellMod(mod, value);
1444 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1445}
@ TRIGGERED_NONE
Definition SpellDefines.h:141
Definition SpellDefines.h:177
void AddSpellMod(SpellValueMod mod, int32 value)
Definition SpellDefines.h:179

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastCustomSpell() [4/5]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit *  victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1448{
1449 CustomSpellValues values;
1450 values.AddSpellMod(mod, value);
1451 return CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
1452}

References CustomSpellValues::AddSpellMod(), and CastCustomSpell().

◆ CastCustomSpell() [5/5]

SpellCastResult Unit::CastCustomSpell ( Unit *  victim,
uint32  spellId,
int32 const *  bp0,
int32 const *  bp1,
int32 const *  bp2,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1429{
1430 CustomSpellValues values;
1431 if (bp0)
1432 values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
1433 if (bp1)
1434 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
1435 if (bp2)
1436 values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
1437 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1438}
@ SPELLVALUE_BASE_POINT1
Definition SpellDefines.h:122
@ SPELLVALUE_BASE_POINT2
Definition SpellDefines.h:123
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:121

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), SPELLVALUE_BASE_POINT0, SPELLVALUE_BASE_POINT1, SPELLVALUE_BASE_POINT2, TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

Referenced by spell_pri_guardian_spirit::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump_aura::AfterDispel(), spell_dru_lifebloom::AfterRemove(), Player::ApplyEnchantment(), CastCustomSpell(), CastCustomSpell(), CastCustomSpell(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), npc_gas_cloud::npc_gas_cloudAI::CastMainSpell(), CastPetAura(), spell_ruby_sanctum_rallying_shout::CountAllies(), spell_igb_rocket_artillery_explosion::DamageGunship(), boss_illidari_council_memberAI::DamageTaken(), boss_tenris_mirkblood::DamageTaken(), boss_leotheras_the_blind::DemonTime(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), Spell::EffectDestroyAllTotems(), Spell::EffectDispel(), Spell::EffectFeedPet(), Spell::EffectForceCast(), Spell::EffectSchoolDMG(), Spell::EffectSummonType(), EnterVehicle(), EnterVehicleUnattackable(), AuraMunchingQueue::Execute(), TriggerWickedSpirit::Execute(), spell_sha_totem_of_wrath::HandleAfterCast(), spell_reflective_shield_aura::HandleAfterEffectAbsorb(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_pri_shadow_word_death::HandleDamage(), spell_dk_corpse_explosion::HandleDamage(), spell_dru_lifebloom::HandleDispel(), spell_igb_burning_pitch::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_deathbringer_blood_link::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_gen_dummy_trigger::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_item_deadly_precision_dummy::HandleDummy(), spell_pal_divine_storm_dummy::HandleDummy(), spell_sha_ancestral_awakening_proc::HandleDummy(), spell_sha_cleansing_totem_pulse::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_slam::HandleDummy(), spell_warr_bloodthirst::HandleDummy(), spell_egg_explosion::HandleDummyHitTarget(), spell_warr_execute::HandleEffect(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_hun_rapid_recuperation::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_deathbringer_blood_link_aura::HandleProc(), spell_soul_deflection::HandleProc(), spell_reliquary_of_souls_aura_of_desire_aura::HandleProc(), spell_black_temple_consuming_strikes_aura::HandleProc(), spell_gen_overlords_brand::HandleProc(), spell_gen_overlords_brand_dot::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_dk_butchery::HandleProc(), spell_dk_vendetta::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_dru_glyph_of_innervate::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_hun_cobra_strikes::HandleProc(), spell_mage_empowered_fire::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_sha_shamanistic_rage::HandleProc(), spell_anetheron_vampiric_aura::HandleProc(), spell_deathbringer_blood_beast_blood_link::HandleProc(), spell_the_lich_king_dark_hunger_aura::HandleProc(), spell_yogg_saron_grim_reprisal_aura::HandleProc(), spell_dk_improved_blood_presence_triggered::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dk_necrosis::HandleProc(), spell_dru_living_seed::HandleProc(), spell_dru_glyph_of_rejuvenation::HandleProc(), spell_dru_t3_8p_bonus::HandleProc(), spell_dru_t10_restoration_4p_bonus_dummy::HandleProc(), spell_gen_blade_warding::HandleProc(), spell_gen_vampiric_touch::HandleProc(), spell_gen_petrified_bark::HandleProc(), spell_gen_earth_shield_toc::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_hun_thrill_of_the_hunt::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_item_alchemists_stone::HandleProc(), spell_item_charm_witch_doctor::HandleProc(), spell_item_frozen_shadoweave::HandleProc(), spell_item_persistent_shield::HandleProc(), spell_item_pet_healing::HandleProc(), spell_item_swift_hand_justice_dummy::HandleProc(), spell_mage_burnout::HandleProc(), spell_mage_master_of_elements::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), spell_pal_sheath_of_light::HandleProc(), spell_pal_judgement_of_light_heal::HandleProc(), spell_pal_judgement_of_wisdom_mana::HandleProc(), spell_pal_spiritual_attunement::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pal_t8_2p_bonus::HandleProc(), spell_pal_glyph_of_holy_light_dummy::HandleProc(), spell_pal_illumination::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_pri_vampiric_embrace::HandleProc(), spell_pri_glyph_of_dispel_magic::HandleProc(), spell_pri_aq_3p_bonus::HandleProc(), spell_pri_t10_heal_2p_bonus::HandleProc(), spell_pri_blessed_recovery::HandleProc(), spell_rog_blade_flurry::HandleProc(), spell_rog_quick_recovery::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_glyph_of_healing_wave::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_sha_lightning_overload::HandleProc(), spell_sha_ancestral_awakening::HandleProc(), spell_sha_flametongue_weapon::HandleProc(), spell_sha_glyph_of_totem_of_wrath::HandleProc(), spell_sha_windfury_weapon::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_warr_deep_wounds_aura::HandleProc(), spell_warr_item_t10_prot_4p_bonus::HandleProc(), spell_putricide_gaseous_bloat_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_gen_vampiric_might::HandleProc(), spell_gen_mirrored_soul::HandleProc(), spell_warl_improved_drain_soul::HandleProc(), AuraEffect::HandleProcTriggerSpellWithValueAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_igb_rocket_pack_aura::HandleRemove(), spell_warl_haunt_aura::HandleRemove(), spell_vehicle_throw_passenger::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kelthuzad_detonate_mana_aura::HandleScript(), spell_hun_chimera_shot::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_sha_stoneclaw_totem::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), AuraEffect::HandleShapeshiftBoosts(), spell_illidari_council_circle_of_healing::HandleSharedRule(), HandleSpellClick(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_putricide_mutated_plague_aura::HandleTriggerSpell(), boss_sathrovarr::JustEngagedWith(), boss_essence_of_suffering::boss_essence_of_sufferingAI::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_felblood_kaelthas::JustEngagedWith(), boss_kalecgos::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_najentus::JustEngagedWith(), boss_morogrim_tidewalker::JustEngagedWith(), boss_felmyst::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_janalai_hatcher::MovementInform(), npc_frost_tomb::npc_frost_tomb(), spell_dru_tiger_s_fury::OnHit(), spell_gen_flurry_of_claws::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_pal_glyph_of_divinity::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_kalecgos_curse_of_boundless_agony_aura::OnRemove(), spell_halion_marks_aura::OnRemove(), spell_putricide_mutated_plague_aura::OnRemove(), spell_the_lich_king_necrotic_plague_aura::OnRemove(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), spell_hor_shared_suffering_aura::OnRemove(), spell_sindragosa_instability_aura::OnRemove(), spell_the_lich_king_necrotic_plague_jump_aura::OnRemove(), npc_wild_wyrm::PassengerBoarded(), spell_karazhan_overload_aura::PeriodicTick(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_doomfire::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), spell_sha_mana_tide::PeriodicTick(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11198_take_down_tethyr::PrepareSpellScript(), SmartScript::ProcessAction(), spell_illidari_council_reflective_shield_aura::ReflectDamage(), spell_pri_power_word_shield_aura::ReflectDamage(), boss_kiljaeden::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_kiljaeden::ScheduleBasicAbilities(), boss_magtheridon::ScheduleCombatEvents(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), boss_krik_thir::boss_krik_thirAI::SummonWatcher(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_the_lich_king_life_siphon::TriggerHeal(), spell_pal_divine_storm::TriggerHeal(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), npc_coren_direbrew::UpdateAI(), boss_huhuran::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_anubarak_trial::UpdateAI(), boss_bronjahm::UpdateAI(), boss_devourer_of_souls::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_living_constellation::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), boss_ignis::UpdateAI(), npc_ulduar_vx001::UpdateAI(), boss_thorim::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), and boss_toravon::boss_toravonAI::UpdateAI().

◆ CastDelayedSpellWithPeriodicAmount()

void Unit::CastDelayedSpellWithPeriodicAmount ( Unit *  caster,
uint32  spellId,
AuraType  auraType,
int32  addAmount,
uint8  effectIndex = 0,
TriggerCastFlags  extraTriggerFlags = TRIGGERED_NONE 
)
15966{
15967 AuraEffect* aurEff = nullptr;
15968 for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
15969 {
15970 aurEff = *i;
15971 if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
15972 continue;
15973
15974 addAmount += ((aurEff->GetOldAmount() * std::max<int32>(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks());
15975 break;
15976 }
15977
15978 TriggerCastFlags triggerFlags =
15980
15981 // xinef: delay only for casting on different unit
15982 if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
15983 caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, triggerFlags, nullptr, aurEff,
15984 caster->GetGUID());
15985 else
15986 caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId, aurEff, auraType,
15987 triggerFlags), caster->m_Events.CalculateQueueTime(400));
15988}
TriggerCastFlags
Definition SpellDefines.h:140
@ TRIGGERED_NO_PERIODIC_RESET
Will ignore equipped item requirements.
Definition SpellDefines.h:163
@ CONFIG_MUNCHING_BLIZZLIKE
Definition WorldConfig.h:149
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
int32 GetOldAmount() const
Definition SpellAuraEffects.h:116
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7093
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
Definition Unit.cpp:15926
uint64 CalculateQueueTime(uint64 delay) const
Definition EventProcessor.cpp:164
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true, uint8 eventGroup=0)
Definition EventProcessor.cpp:136

References EventProcessor::AddEvent(), EventProcessor::CalculateQueueTime(), CastCustomSpell(), CONFIG_MUNCHING_BLIZZLIKE, AuraEffect::GetCasterGUID(), AuraEffect::GetEffIndex(), Object::GetGUID(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetOldAmount(), AuraEffect::GetTickNumber(), AuraEffect::GetTotalTicks(), WorldObject::m_Events, m_modAuras, SPELLVALUE_BASE_POINT0, sWorld, TRIGGERED_FULL_MASK, and TRIGGERED_NO_PERIODIC_RESET.

Referenced by spell_mage_ignite::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_hun_piercing_shots::HandleProc(), spell_pal_righteous_vengeance::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_t8_elemental_4p_bonus::HandleProc(), and spell_sha_t9_elemental_4p_bonus::HandleProc().

◆ CastPetAura()

void Unit::CastPetAura ( PetAura const *  aura)
13426{
13427 uint32 auraId = aura->GetAura(GetEntry());
13428 if (!auraId)
13429 return;
13430
13431 if (auraId == 35696) // Demonic Knowledge
13432 {
13433 int32 basePoints = aura->GetDamage();
13434 CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
13435 }
13436 else
13437 CastSpell(this, auraId, true);
13438}

References CastCustomSpell(), CastSpell(), PetAura::GetAura(), PetAura::GetDamage(), and Object::GetEntry().

Referenced by Pet::CastPetAuras().

◆ CastSpell() [1/9]

SpellCastResult WorldObject::CastSpell ( CastSpellTargetArg const &  targets,
SpellInfo const *  info,
CastSpellExtraArgs const &  args = {} 
)
3293{
3294 if (!info)
3296
3297 if (!targets.Targets)
3298 {
3299 LOG_ERROR("spells", "CastSpell: invalid target passed to spell {} by caster {}",
3300 info->Id, GetGUID().ToString());
3302 }
3303
3304 // some scripts rely on the triggering aura's caster being the original caster
3305 ObjectGuid originalCaster = args.OriginalCaster;
3306 if (!originalCaster && args.TriggeringAura)
3307 originalCaster = args.TriggeringAura->GetCasterGUID();
3308
3309 Spell* spell = new Spell(this, info, args.TriggerFlags, originalCaster);
3310 for (auto const& kv : args.SpellValueOverrides)
3311 spell->SetSpellValue(kv.first, kv.second);
3312 spell->m_CastItem = args.CastItem;
3313 return spell->prepare(&*targets.Targets, args.TriggeringAura);
3314}
@ SPELL_FAILED_BAD_TARGETS
Definition SharedDefines.h:949
Item * m_CastItem
Definition Spell.h:536

◆ CastSpell() [2/9]

SpellCastResult WorldObject::CastSpell ( CastSpellTargetArg const &  targets,
uint32  spellId,
CastSpellExtraArgs const &  args = {} 
)
3280{
3281 SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId);
3282 if (!info)
3283 {
3284 LOG_ERROR("spells", "CastSpell: unknown spell {} by caster {}",
3285 spellId, GetGUID().ToString());
3287 }
3288 return CastSpell(targets, info, args);
3289}

◆ CastSpell() [3/9]

SpellCastResult Unit::CastSpell ( float  x,
float  y,
float  z,
uint32  spellId,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1475{
1476 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1477 if (!spellInfo)
1478 {
1479 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1481 }
1482
1483 SpellCastTargets targets;
1484 targets.SetDst(x, y, z, GetOrientation());
1485
1486 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1487}
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition Spell.cpp:443

References CastSpell(), Object::GetGUID(), Position::GetOrientation(), LOG_ERROR, SpellCastTargets::SetDst(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [4/9]

SpellCastResult Unit::CastSpell ( GameObject *  go,
uint32  spellId,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1490{
1491 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1492 if (!spellInfo)
1493 {
1494 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1496 }
1497
1498 SpellCastTargets targets;
1499 targets.SetGOTarget(go);
1500
1501 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1502}
void SetGOTarget(GameObject *target)
Definition Spell.cpp:308

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetGOTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [5/9]

SpellCastResult Unit::CastSpell ( SpellCastTargets const &  targets,
SpellInfo const *  spellInfo,
CustomSpellValues const *  value,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
Todo:
: this is a workaround - not needed anymore, but required for some scripts :(
1372{
1373 if (!spellInfo)
1374 {
1375 LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster {}", GetGUID().ToString());
1377 }
1378
1380 if (!originalCaster && triggeredByAura)
1381 {
1382 originalCaster = triggeredByAura->GetCasterGUID();
1383 }
1384
1385 Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
1386
1387 if (value)
1388 {
1389 for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr)
1390 {
1391 spell->SetSpellValue(itr->first, itr->second);
1392 }
1393 }
1394
1395 spell->m_CastItem = castItem;
1396 return spell->prepare(&targets, triggeredByAura);
1397}
void SetSpellValue(SpellValueMod mod, int32 value)
Definition Spell.cpp:8871

References AuraEffect::GetCasterGUID(), Object::GetGUID(), LOG_ERROR, Spell::m_CastItem, Spell::prepare(), Spell::SetSpellValue(), SPELL_FAILED_SPELL_UNAVAILABLE, and Position::ToString().

Referenced by Player::_addSpell(), Player::_addTalentAurasAndSpells(), _ExitVehicle(), Player::_LoadGlyphAuras(), Battleground::_ProcessResurrect(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_rog_cheat_death::Absorb(), boss_yoggsaron_keeper::Activate(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Player::ActivateSpec(), spell_halion_combustion_consumption_aura::AddMarkStack(), Battleground::AddPlayer(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundMap::AddPlayerToMap(), Battleground::AddPlayerToResurrectQueue(), Battlefield::AddPlayerToResurrectQueue(), boss_yoggsaron_sara::AddPortals(), Pet::addSpell(), spell_item_thrallmar_and_honor_hold_favor::AfterApply(), spell_dru_savage_roar_aura::AfterApply(), spell_the_cleansing_cleansing_soul::AfterRemove(), spell_astromancer_wrath_of_the_astromancer::AfterRemove(), spell_item_darkmoon_card_illusion::AfterRemove(), spell_gen_lifebloom::AfterRemove(), spell_oculus_stop_time_aura::Apply(), spell_sha_earthbind_totem::Apply(), spell_warl_health_funnel::ApplyEffect(), ApplyEmpoweredStacks(), Player::ApplyEnchantment(), Player::ApplyEquipSpell(), Player::ApplyItemObtainSpells(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacle(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orb(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacle(), WorldState::BuffAdalsSongOfBattle(), WorldState::BuffMagtheridonTeam(), Player::BuildPlayerRepop(), spell_igb_incinerating_blast::CalculateDamage(), spell_igb_cannon_blast::CalculatePower(), npc_echo_of_medivh::CastChangeFacing(), npc_chesspiece::CastChangeFacing(), CastCustomSpell(), npc_hallows_end_soh::CastFires(), Player::CastItemCombatSpell(), npc_volatile_ooze::npc_volatile_oozeAI::CastMainSpell(), Pet::CastPendingSpell(), CastPetAura(), boss_mor_grayhoof::CastRandomSpell(), CastSpell(), CastSpell(), CastSpell(), CastSpell(), CastSpell(), CastSpell(), spell_summon_gauntlet_mobs_periodic::CastTheNextTwoSpells(), spell_the_lich_king_defile::ChangeDamageAndGrow(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), spell_eredar_twins_handle_touch::CheckCast(), Spell::CheckCast(), spell_baltharus_enervating_brand_trigger::CheckDistance(), Spell::CheckItems(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_combustion::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), spell_dk_raise_dead::ConsumeReagents(), spell_frost_giant_death_plague::CountTargets(), instance_blackrock_spire::CreatureLooted(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_jenny::DamageTaken(), boss_baron_geddon::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_sartharion::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_power_spark::DamageTaken(), npc_collapsing_star::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), DealDamage(), DealMeleeDamage(), spell_warl_seed_of_corruption_dummy::Detonate(), brann_bronzebeard::DoAbedneumSearingGaze(), boss_hodir::DoAction(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), npc_eris_hevenfire::npc_eris_hevenfireAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), npc_kalecgos_kj::DoAction(), npc_pilgrims_bounty_chair::DoAction(), npc_icc_blood_beast::npc_icc_blood_beastAI::DoAction(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_molten_golem::DoAction(), boss_steelbreaker::DoAction(), npc_ulduar_bot_summon_trigger::DoAction(), boss_thorim_sif::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron_cloud::DoAction(), boss_yoggsaron::DoAction(), boss_yoggsaron_brain::DoAction(), boss_yoggsaron_keeper::DoAction(), Spell::DoAllEffectOnTarget(), UnitAI::DoCast(), UnitAI::DoCast(), UnitAI::DoCastAOE(), ScriptedAI::DoCastSpell(), InstanceScript::DoCastSpellOnPlayer(), InstanceScript::DoCastSpellOnPlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), npc_midsummer_ribbon_pole_target::DoFireworkChecks(), npc_midsummer_ribbon_pole_target::DoGroundFlowerChecks(), brann_bronzebeard::DoMarnakDarkMatter(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), npc_midsummer_ribbon_pole_target::DoSpewLavaChecks(), boss_skeram::DoTeleport(), Spell::DoTriggersOnSpellHit(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectApplyGlyph(), Spell::EffectCastButtons(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectInebriate(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectStuck(), Spell::EffectSummonType(), Spell::EffectTaunt(), Spell::EffectTeleportUnits(), Spell::EffectTitanGrip(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), brann_bronzebeard::EndTribunalFight(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundEY::EventTeamCapturedPoint(), BattleExperienceEvent::Execute(), OrcDeathEvent::Execute(), CorruptTriggers::Execute(), CastArmageddon::Execute(), UtherBatteredHiltEvent::Execute(), ShockVortexExplodeEvent::Execute(), ResetEncounterEvent::Execute(), FrostBombExplosion::Execute(), IceTombSummonEvent::Execute(), VileSpiritActivateEvent::Execute(), LichKingMovieEvent::Execute(), DelayedCastEvent::Execute(), DelayedCastMincharEvent::Execute(), ChargeRifts::Execute(), CosmicSmashDamageEvent::Execute(), CastRunesEvent::Execute(), SACActivateEvent::Execute(), VerasEnvenom::Execute(), CastQuill::Execute(), lapseTeleport::Execute(), boss_kaelthas::ExecuteMiddleEvent(), boss_salramm::boss_salrammAI::ExplodeGhoul(), spell_festergut_blighted_spores_aura::ExtraEffect(), spell_rotface_mutated_infection_aura::ExtraRemoveEffect(), npc_dark_iron_attack_generator::FinishAttackDueToWin(), npc_pet_dk_ebon_gargoyle::FlyAway(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), go_soulwell::go_soulwellAI::GossipHello(), go_orb_of_domination::GossipHello(), boss_yoggsaron_constrictor_tentacle::GrabPlayer(), spell_cataclysm_breath::HandleAfterCast(), spell_dk_chains_of_ice::HandleAfterCast(), spell_mage_arcane_blast::HandleAfterCast(), spell_q13086_last_line_of_defence::HandleAfterCast(), spell_braziers_hit::HandleAfterEffectApply(), spell_infected_worgen_bite_aura::HandleAfterEffectApply(), spell_dk_blood_boil::HandleAfterHit(), spell_dk_scourge_strike::HandleAfterHit(), spell_rog_deadly_poison::HandleAfterHit(), spell_warlords_rage::HandleAfterRemove(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_felmyst_fog_of_corruption_charm_aura::HandleApply(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), spell_dru_enrage::HandleApply(), spell_rog_killing_spree_aura::HandleApply(), spell_warr_vigilance::HandleApply(), spell_azjol_nerub_pound::HandleApplyAura(), spell_pal_seal_of_vengeance_aura::HandleApplyDoT(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_dk_death_grip::HandleBaseDummy(), misc_commandscript::HandleBindSightCommand(), spell_sha_maelstrom_weapon::HandleBonus(), spell_mirkblood_dash_gash_return_to_tank_pre_spell::HandleCast(), spell_rotface_unstable_ooze_explosion_init::HandleCast(), spell_commander_sarannis_summon_reinforcements::HandleCast(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastDistCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), spell_gen_mounted_charge::HandleChargeEffect(), spell_dk_corpse_explosion::HandleCorpseExplosion(), OutdoorPvPSI::HandleCustomSpell(), WorldSession::HandleDuelCancelledOpcode(), spell_icc_shattered_bones::HandleDummy(), spell_player_mount_wyrm::HandleDummy(), spell_corrupted_totems::HandleDummy(), spell_moroes_vanish::HandleDummy(), spell_karazhan_blink::HandleDummy(), spell_karazhan_wrath_titans_stacker::HandleDummy(), spell_ooze_zap::HandleDummy(), spell_saviana_conflagration_init::HandleDummy(), spell_igb_burning_pitch_selector::HandleDummy(), spell_igb_burning_pitch::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_anti_air_rocket_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_illidan_found_target::HandleDummy(), spell_leotheras_chaos_blast::HandleDummy(), spell_morogrim_tidewalker_watery_grave::HandleDummy(), spell_q10935_the_exorcism_of_colonel_jules::HandleDummy(), spell_gen_focused_bursts::HandleDummy(), spell_shadowblink::HandleDummy(), spell_spawn_drakonid::HandleDummy(), spell_send_mug_target_picker::HandleDummy(), spell_hallows_end_candy::HandleDummy(), spell_hallows_end_bucket_lands::HandleDummy(), spell_midsummer_torch_catch::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_mana_burn_area::HandleDummy(), spell_voljin_war_drums::HandleDummy(), spell_voodoo::HandleDummy(), spell_gordunni_trap::HandleDummy(), spell_sartharion_lava_strike::HandleDummy(), spell_halion_meteor_strike_targeting::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_anubarak_shadow_strike::HandleDummy(), spell_faction_champion_death_grip::HandleDummy(), spell_valkyr_ball_passive::HandleDummy(), spell_drakkari_colossus_emerge::HandleDummy(), spell_drakkari_colossus_surge::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_mimiron_rocket_strike::HandleDummy(), spell_voa_flaming_cinder::HandleDummy(), spell_q11652_soldier_rescued::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_vehicle_warhead_fuse::HandleDummy(), spell_q11296_rivenwood_captives::HandleDummy(), spell_sorlofs_booty_big_gun_assault::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_fatal_strike::HandleDummy(), spell_illidan_agonizing_flames::HandleDummy(), spell_najentus_needle_spine::HandleDummy(), spell_ice_spear_target_picker::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_gen_cannibalize::HandleDummy(), spell_gen_gadgetzan_transporter_backfire::HandleDummy(), spell_gen_gnomish_transporter::HandleDummy(), spell_hun_masters_call::HandleDummy(), spell_hun_pet_carrion_feeder::HandleDummy(), spell_item_gnomish_universal_remote::HandleDummy(), spell_item_gnomish_shrink_ray::HandleDummy(), spell_item_trigger_spell::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_make_a_wish::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_item_net_o_matic::HandleDummy(), spell_item_noggenfogger_elixir::HandleDummy(), spell_item_savory_deviate_delight::HandleDummy(), spell_item_six_demon_bag::HandleDummy(), spell_item_underbelly_elixir::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), spell_item_purify_helboar_meat::HandleDummy(), spell_item_reindeer_transformation::HandleDummy(), spell_item_nigh_invulnerability::HandleDummy(), spell_item_poultryizer::HandleDummy(), spell_item_socrethars_stone::HandleDummy(), spell_item_demon_broiled_surprise::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_nitro_boots::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_item_greatmothers_soulcatcher::HandleDummy(), spell_item_lifegiving_gem::HandleDummy(), spell_item_mind_control_cap::HandleDummy(), spell_item_hourglass_sand::HandleDummy(), spell_item_ultrasafe_transporter::HandleDummy(), spell_mage_summon_water_elemental::HandleDummy(), spell_pal_blessing_of_faith::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pal_judgement_of_command::HandleDummy(), spell_pri_penance::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q5206_test_fetid_skull::HandleDummy(), spell_q11396_11399_scourging_crystal_controller::HandleDummy(), spell_q11587_arcane_prisoner_rescue::HandleDummy(), spell_q11730_ultrasonic_screwdriver::HandleDummy(), spell_q12634_despawn_fruit_tosser::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_q9452_cast_net::HandleDummy(), spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy::HandleDummy(), spell_q12308_escape_from_silverbrook::HandleDummy(), spell_q12641_death_comes_from_on_high::HandleDummy(), spell_q12211_container_of_rats::HandleDummy(), spell_rog_shiv::HandleDummy(), spell_sha_fire_nova::HandleDummy(), spell_warl_ritual_of_doom_effect::HandleDummy(), spell_warl_soulshatter::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_warriors_wrath::HandleDummy(), spell_magtheridon_shadow_grasp::HandleDummyApply(), spell_yogg_saron_destabilization_matrix::HandleDummyEffect(), spell_yogg_saron_insane_periodic_trigger::HandleDummyEffect(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_talon_king_ikiss_blink::HandleDummyHitTarget(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_item_rocket_chicken::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_shadowfang_keep_haunting_spirits_aura::HandleDummyTick(), spell_blood_council_shadow_prison_aura::HandleDummyTick(), spell_patchwerk_hateful_strike_primer::HandleEffect(), spell_mark_of_nature::HandleEffect(), spell_call_of_the_beast::HandleEffect(), spell_target_fissures::HandleEffect(), spell_rog_vanish::HandleEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_lich_king_vo_blocker::HandleEffectApply(), spell_midsummer_ribbon_pole::HandleEffectApply(), spell_tharon_ja_dummy_aura::HandleEffectApply(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_leotheras_insidious_whisper_aura::HandleEffectApply(), spell_pal_aura_mastery::HandleEffectApply(), spell_pal_improved_aura::HandleEffectApply(), spell_q12851_going_bearback::HandleEffectApply(), spell_bloodspore_haze::HandleEffectHit(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_gen_whisper_gulch_yogg_saron_whisper::HandleEffectPeriodic(), spell_rog_killing_spree_aura::HandleEffectPeriodic(), spell_sha_earthbind_totem::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_warr_retaliation::HandleEffectProc(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_trigger_aura::HandleEffectRemove(), spell_teron_gorefiend_shadow_of_death::HandleEffectRemove(), spell_black_temple_skeleton_shot_aura::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite_trigger_aura::HandleEffectRemove(), spell_q10930_big_bone_worm_aura::HandleEffectRemove(), spell_q10929_fumping_aura::HandleEffectRemove(), spell_flamewreath::HandleFinish(), spell_midsummer_fling_torch::HandleFinish(), spell_midsummer_juggling_torch::HandleFinish(), spell_wintergrasp_rp_gg::HandleFinish(), spell_valkyr_bullet_summon_trigger::HandleForceCast(), spell_dreamwalker_summoner::HandleForceCast(), spell_dreamwalker_summon_suppresser_effect::HandleForceCast(), spell_razorscale_fuse_armor::HandleFused(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), OPvPCapturePointZM_Graveyard::HandleGossipOption(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_magtheridon_quake::HandleHit(), spell_chapter5_return_to_capital::HandleHit(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundIC::HandleKillUnit(), learn_commandscript::HandleLearnAllMyTrainerSpellsCommand(), spell_darkfallen_blood_mirror::HandleMirror(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_ticking_time_bomb_aura::HandleOnEffectRemove(), spell_delusions_of_jindo::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_mark_of_frost_freeze::HandleOnHit(), spell_mutate_explode_bug::HandleOnHit(), spell_explode_trigger::HandleOnHit(), spell_blade_dance_targeting::HandleOnHit(), spell_auriaya_feral_rush::HandleOnHit(), aura_class_call_wild_magic::HandlePeriodic(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_halion_meteor_strike_spread_aura::HandlePeriodic(), spell_jormungars_paralytic_toxin_aura::HandlePeriodic(), spell_sladran_grip_of_sladran_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_close_rift_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_rancid_spore_cloud::HandlePeriodic(), spell_kaelthas_remote_toy::HandlePeriodic(), spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic(), spell_sha_totemic_mastery::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_kiljaeden_shadow_spike_aura::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_halion_twilight_cutter_periodic_aura::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_voa_overcharge_aura::HandlePeriodicDummy(), spell_item_dementia::HandlePeriodicDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_magtheridon_shadow_grasp::HandlePeriodicRemove(), spell_igb_periodic_trigger_with_power_cost_aura::HandlePeriodicTick(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceMoveByAI(), WorldState::HandlePlayerEnterZone(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), BattlegroundIC::HandlePlayerResurrect(), misc_commandscript::HandlePossessCommand(), spell_blood_queen_vampiric_bite::HandlePresence(), spell_mark_of_malice::HandleProc(), spell_item_lil_phylactery::HandleProc(), spell_item_fate_rune_of_unsurpassed_vigor::HandleProc(), spell_gyth_chromatic_protection::HandleProc(), spell_karazhan_wrath_titans_aura::HandleProc(), spell_ahune_spanky_hands::HandleProc(), spell_hun_glyph_of_mend_pet::HandleProc(), spell_item_trauma::HandleProc(), spell_item_shadows_fate::HandleProc(), spell_utgarde_pinnacle_beast_mark::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_dru_omen_of_clarity::HandleProc(), spell_dru_t4_2p_bonus::HandleProc(), spell_dru_maim_interrupt::HandleProc(), spell_hun_improved_mend_pet::HandleProc(), spell_hun_misdirection::HandleProc(), spell_item_aegis_of_preservation::HandleProc(), spell_item_desperate_defense::HandleProc(), spell_mage_focus_magic::HandleProc(), spell_mage_arcane_potency::HandleProc(), spell_mage_imp_mana_gems::HandleProc(), spell_pal_blessing_of_sanctuary::HandleProc(), spell_pal_judgements_of_the_wise::HandleProc(), spell_pal_sacred_shield_dummy::HandleProc(), spell_pri_mana_leech::HandleProc(), spell_pri_t5_heal_2p_bonus::HandleProc(), spell_rog_tricks_of_the_trade_aura::HandleProc(), spell_rog_honor_among_thieves::HandleProc(), spell_rog_turn_the_tables::HandleProc(), spell_warl_nightfall::HandleProc(), spell_warl_glyph_of_life_tap::HandleProc(), spell_warl_t4_2p_bonus_fire::HandleProc(), spell_warl_t4_2p_bonus_shadow::HandleProc(), spell_warr_vigilance::HandleProc(), spell_warr_second_wind::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_warr_glyph_of_blocking::HandleProc(), spell_karazhan_temptation::HandleProc(), spell_putricide_ooze_tank_protection::HandleProc(), spell_hodir_toasty_fire_aura::HandleProc(), spell_uk_second_wind::HandleProc(), spell_twisted_reflection::HandleProc(), spell_pet_guard_dog::HandleProc(), spell_pet_silverback::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dk_dancing_rune_weapon::HandleProc(), spell_dk_mark_of_blood::HandleProc(), spell_dk_sudden_doom::HandleProc(), spell_dk_threat_of_thassarian::HandleProc(), spell_dk_glyph_of_scourge_strike::HandleProc(), spell_dk_pvp_4p_bonus::HandleProc(), spell_dru_glyph_of_barkskin::HandleProc(), spell_dru_glyph_of_rake::HandleProc(), spell_dru_eclipse::HandleProc(), spell_dru_revitalize::HandleProc(), spell_dru_t3_2p_bonus::HandleProc(), spell_dru_t3_6p_bonus::HandleProc(), spell_dru_item_t6_trinket::HandleProc(), spell_dru_glyph_of_starfire_dummy::HandleProc(), spell_dru_t9_feral_relic::HandleProc(), spell_gen_moss_covered_feet::HandleProc(), spell_gen_retaliation_toc::HandleProc(), spell_hun_hunting_party::HandleProc(), spell_hun_t9_4p_bonus::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_item_shadowmourne::HandleProc(), spell_item_darkmoon_card_greatness::HandleProc(), spell_item_death_choice::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_soul_preserver::HandleProc(), spell_item_mana_drain::HandleProc(), spell_item_aura_of_madness::HandleProc(), spell_item_deathbringers_will_normal::HandleProc(), spell_item_deathbringers_will_heroic::HandleProc(), spell_item_discerning_eye_beast_dummy::HandleProc(), spell_item_healing_touch_refund::HandleProc(), spell_item_heartpierce::HandleProc(), spell_item_heartpierce_hero::HandleProc(), spell_item_mark_of_conquest::HandleProc(), spell_item_sunwell_exalted_caster_neck::HandleProc(), spell_item_sunwell_exalted_melee_neck::HandleProc(), spell_item_sunwell_exalted_tank_neck::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), spell_item_totem_of_flowing_water::HandleProc(), spell_item_purified_shard_of_the_scale::HandleProc(), spell_item_shiny_shard_of_the_scale::HandleProc(), spell_item_living_root_of_the_wildheart::HandleProc(), spell_mage_hot_streak::HandleProc(), spell_mage_imp_blizzard::HandleProc(), spell_pal_item_t6_trinket::HandleProc(), spell_pal_t3_6p_bonus::HandleProc(), spell_pal_heart_of_the_crusader::HandleProc(), spell_pal_improved_lay_of_hands::HandleProc(), spell_pri_item_t6_trinket::HandleProc(), spell_pri_t3_4p_bonus::HandleProc(), spell_rog_deadly_brew::HandleProc(), spell_sha_item_lightning_shield::HandleProc(), spell_sha_item_lightning_shield_trigger::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_sha_frozen_power::HandleProc(), spell_sha_imp_water_shield::HandleProc(), spell_sha_item_t6_trinket::HandleProc(), spell_sha_lightning_shield::HandleProc(), spell_sha_static_shock::HandleProc(), spell_sha_t3_6p_bonus::HandleProc(), spell_warl_glyph_of_shadowflame::HandleProc(), spell_warl_glyph_of_corruption_nightfall::HandleProc(), spell_warl_seed_of_corruption_generic::HandleProc(), spell_warl_soul_leech::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_mage_burning_determination::HandleProc(), spell_ignis_brittle_aura::HandleProc(), spell_gen_black_bow_of_the_betrayer::HandleProc(), spell_hun_lock_and_load::HandleProc(), spell_mage_gen_extra_effects::HandleProc(), spell_pri_body_and_soul::HandleProcDummy(), AuraEffect::HandleProcTriggerSpellAuraProc(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), AuraEffect::HandleRaidProcFromChargeAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_hun_rapid_recuperation_trigger::HandleRapidKillingProc(), spell_vael_burning_adrenaline::HandleRemove(), spell_kiljaeden_darkness_aura::HandleRemove(), spell_entropius_void_zone_visual_aura::HandleRemove(), spell_icehowl_massive_crash::HandleRemove(), spell_igb_rocket_pack_aura::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_warl_shadowflame::HandleSchoolDMG(), spell_gen_bandage::HandleScript(), spell_gen_translocate::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kormok_summon_bone_mages::HandleScript(), spell_kormok_summon_bone_minions::HandleScript(), spell_energize_aoe::HandleScript(), spell_saviana_conflagration_throwback::HandleScript(), spell_taldaram_glittering_sparks::HandleScript(), spell_blood_queen_bloodbolt::HandleScript(), spell_blood_queen_presence_of_the_darkfallen::HandleScript(), spell_igb_rocket_artillery::HandleScript(), spell_putricide_unstable_experiment::HandleScript(), spell_sindragosa_icy_grip::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_summon_spirit_bomb::HandleScript(), spell_dreamwalker_summon_portal::HandleScript(), spell_dreamwalker_twisted_nightmares::HandleScript(), spell_archavon_rock_shards::HandleScript(), spell_wintergrasp_portal::HandleScript(), spell_gen_create_lance::HandleScript(), spell_item_defibrillate::HandleScript(), spell_item_scroll_of_recall::HandleScript(), spell_shazzrah_gate_dummy::HandleScript(), spell_apothecary_lingering_fumes::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_apothecary_throw_cologne::HandleScript(), spell_apothecary_throw_perfume::HandleScript(), spell_hallows_end_trick::HandleScript(), spell_hallows_end_put_costume::HandleScript(), spell_hallows_end_trick_or_treat::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_moam_summon_mana_fiends::HandleScript(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), spell_mistress_kiss_area::HandleScript(), spell_novos_summon_minions::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_choking_gas_bomb::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_the_lich_king_cast_back_to_caster::HandleScript(), spell_frost_giant_death_plague::HandleScript(), spell_taunt_brann::HandleScript(), spell_vehicle_grab_pyrite::HandleScript(), spell_razorscale_summon_iron_dwarves::HandleScript(), spell_xt002_heart_overload_periodic::HandleScript(), spell_yogg_saron_target_selectors::HandleScript(), spell_skadi_poisoned_spear::HandleScript(), spell_freezing_cloud_area_right::HandleScript(), spell_freezing_cloud_area_left::HandleScript(), spell_the_cleansing_shrine_cast::HandleScript(), spell_the_cleansing_mirror_image_script_effect::HandleScript(), spell_low_health_trigger::HandleScript(), spell_the_black_stalker_levitate::HandleScript(), spell_the_black_stalker_levitation_pulse::HandleScript(), spell_the_black_stalker_someone_grab_me::HandleScript(), spell_the_black_stalker_magnetic_pull::HandleScript(), spell_the_flag_of_ownership::HandleScript(), spell_gen_elune_candle::HandleScript(), spell_gen_teleporting::HandleScript(), spell_gen_dalaran_disguise::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), spell_item_eggnog::HandleScript(), spell_item_drums_of_forgotten_kings::HandleScript(), spell_item_drums_of_the_wild::HandleScript(), spell_q12805_lifeblood_dummy::HandleScript(), spell_q12735_song_of_cleansing::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_q12619_emblazon_runeblade_effect::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_kalecgos_spectral_realm_dummy::HandleScriptEffect(), spell_marrowgar_coldflame_bonestorm::HandleScriptEffect(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_black_temple_bloodbolt::HandleScriptEffect(), spell_lady_vashj_summon_sporebat::HandleScriptEffect(), spell_kaelthas_summon_weapons::HandleScriptEffect(), spell_kaelthas_gravity_lapse::HandleScriptEffect(), spell_kaelthas_nether_beam::HandleScriptEffect(), spell_gen_clone::HandleScriptEffect(), spell_gen_clone_weapon::HandleScriptEffect(), spell_gen_break_shield::HandleScriptEffect(), spell_gen_mounted_charge::HandleScriptEffect(), spell_gen_throw_shield::HandleScriptEffect(), spell_item_sleepy_willy::HandleScriptEffect(), spell_item_lil_xt::HandleScriptEffect(), spell_q12698_the_gift_that_keeps_on_giving::HandleScriptEffect(), spell_death_knight_initiate_visual::HandleScriptEffect(), spell_summon_amanishi_sentries::HandleScriptEffect(), spell_brewfest_toss_mug::HandleScriptEffect(), spell_direbrew_summon_mole_machine_target_picker::HandleScriptEffect(), spell_request_second_mug::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), spell_azjol_drain_power::HandleScriptEffect(), spell_icehowl_arctic_breath::HandleScriptEffect(), spell_dtk_summon_random_drakkari::HandleScriptEffect(), spell_marrowgar_coldflame::HandleScriptEffect(), spell_gluth_decimate::HandleScriptEffect(), spell_arcane_chains_character_force_cast::HandleScriptEffect(), spell_q11652_rescue_injured_soldier::HandleScriptEffect(), spell_dragonblight_devour_ghoul::HandleScriptEffect(), spell_hawk_hunting::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), spell_black_temple_summon_shadowfiends::HandleScriptEffect(), spell_ice_bombardment_dest_picker::HandleScriptEffect(), spell_kaelthas_remove_enchanted_weapons::HandleScriptEffect(), spell_kaelthas_kael_explodes::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_hun_masters_call::HandleScriptEffect(), spell_item_mirrens_drinking_hat::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), spell_q1846_bending_shinbone::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), WorldSession::HandleSelfResOpcode(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpellClick(), spell_marrowgar_bone_spike_graveyard::HandleSpikes(), AuraEffect::HandleSpiritOfRedemption(), spell_gen_paralytic_poison::HandleStun(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_q13010_jokkum_summon::HandleSummon(), spell_item_draenic_pale_ale::HandleSummon(), spell_freya_tidal_wave::HandleSurge(), WorldSession::HandleTalentWipeConfirmOpcode(), spell_mother_shahraz_fatal_attraction::HandleTeleportUnits(), spell_warl_drain_soul::HandleTick(), spell_trigger_spell_from_caster::HandleTrigger(), spell_magic_eater_food::HandleTriggerSpell(), spell_alert_drums::HandleTriggerSpell(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_pal_righteous_defense::HandleTriggerSpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), spell_q10769_dissension_amongst_the_ranks_aura::if(), CharmInfo::InitCharmCreateSpells(), npc_jenny::Initialize(), boss_urok_doomhowl::InitializeAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::InitializeAI(), npc_ulduar_rocket_strike_trigger::InitializeAI(), npc_oathbound_warder::InitializeAI(), npc_pet_hunter_snake_trap::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), CharmInfo::InitPossessCreateSpells(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_faction_championsAI::IsCCed(), boss_yoggsaron_death_orb::IsSummonedBy(), TriggerAI::IsSummonedBy(), npc_vaelastrasz_the_red::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), boss_kologarn_eyebeam::IsSummonedBy(), boss_yoggsaron_constrictor_tentacle::IsSummonedBy(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_pet_gen_fetch_ball::IsSummonedBy(), npc_hallows_end_soh::JustDied(), boss_rajaxx::JustDied(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustDied(), boss_steelbreaker::JustDied(), boss_runemaster_molgeim::JustDied(), boss_stormcaller_brundir::JustDied(), boss_freya_summons::JustDied(), npc_ulduar_saronite_vapors::JustDied(), boss_skarvald_the_constructor::JustDied(), boss_dalronn_the_controller::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), npc_necropolis_health::JustDied(), npc_necrotic_shard::JustDied(), CombatAI::JustDied(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_sapphiron::boss_sapphironAI::JustDied(), boss_anomalus::JustDied(), npc_nerubar_victim::JustDied(), boss_shade_of_akama::JustDied(), CasterAI::JustEngagedWith(), boss_servant_quarters::JustEngagedWith(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_hallows_end_soh::JustEngagedWith(), boss_sartharion::JustEngagedWith(), boss_twin_valkyrAI::JustEngagedWith(), npc_stinky_icc::npc_stinky_iccAI::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), npc_rimefang::npc_rimefangAI::JustEngagedWith(), npc_nexus_lord::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_freya_summons::JustEngagedWith(), boss_vezax::JustEngagedWith(), boss_hodir::JustEngagedWith(), boss_thorim::JustEngagedWith(), boss_thorim_ancient_rune_giant::JustEngagedWith(), npc_ulduar_storm_tempered_keeper::JustEngagedWith(), boss_koralon::boss_koralonAI::JustEngagedWith(), boss_toravon::boss_toravonAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_watchkeeper_gargolmar::JustEngagedWith(), boss_gatewatcher_gyrokill::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), CombatAI::JustEngagedWith(), boss_yauj::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustEngagedWith(), boss_moorabi::boss_moorabiAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_sapphiron::boss_sapphironAI::JustEngagedWith(), boss_keristrasza::JustEngagedWith(), boss_steelbreaker::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_fathomguard_sharkkis::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustReachedHome(), npc_ulduar_iron_construct::JustReachedHome(), boss_yoggsaron_brain::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::JustSummoned(), boss_ragnaros::JustSummoned(), boss_vexallus::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_jindo::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_taldaram::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_gal_darah::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::JustSummoned(), boss_malygos::JustSummoned(), boss_algalon_the_observer::JustSummoned(), npc_ulduar_vx001::JustSummoned(), boss_svala::boss_svalaAI::JustSummoned(), boss_shirrak_the_dead_watcher::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), boss_grandmaster_vorpil::JustSummoned(), boss_gurtogg_bloodboil::JustSummoned(), boss_veras_darkshadow::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_supremus::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), npc_pallid_horror::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), boss_ayamiss::JustSummoned(), Kill(), boss_azuregos::boss_azuregosAI::KilledUnit(), boss_anubrekhan::KilledUnit(), boss_doomwalker::KilledUnit(), npc_dark_iron_guzzler::KilledUnit(), boss_steelbreaker::KilledUnit(), emerald_dragonAI::KilledUnit(), boss_emeriss::boss_emerissAI::KilledUnit(), boss_felblood_kaelthas::LapseAction(), spell_mandokir_charge::LaunchHit(), Player::learnQuestRewardedSpells(), spell_taldaram_summon_flame_ball::Load(), npc_dkc1_gothik::MoveInLineOfSight(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), boss_temporus::MoveInLineOfSight(), npc_medivh_bm::MoveInLineOfSight(), npc_jenny::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), boss_malygos::MovementInform(), npc_scarlet_ghoul::MovementInform(), boss_headless_horseman::MovementInform(), boss_stormcaller_brundir::MovementInform(), npc_ashtongue_sorcerer::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_kagani_nightstrike::MovementInform(), npc_dark_iron_guzzler::MovementInform(), npc_hor_lich_king::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::MovementInform(), boss_ymiron::boss_ymironAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), BattlegroundAB::NodeOccupied(), npc_alexstrasza::npc_alexstrasza(), npc_algalon_worm_hole::npc_algalon_worm_hole(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_collapsing_star::npc_collapsing_star(), npc_frost_tomb::npc_frost_tomb(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_pos_icicle_trigger::npc_pos_icicle_triggerAI::npc_pos_icicle_triggerAI(), npc_scion_of_eternity::npc_scion_of_eternity(), npc_ulduar_iron_construct::npc_ulduar_iron_construct(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fire(), spell_shadowfang_keep_forsaken_skills_aura::OnApply(), spell_direbrew_disarm::OnApply(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_halion_combustion_consumption_aura::OnApply(), spell_icc_empowered_blood::OnApply(), spell_icc_empowered_blood_3::OnApply(), spell_load_into_catapult_aura::OnApply(), spell_yogg_saron_constrictor_tentacle_aura::OnApply(), spell_gen_damage_reduction_aura::OnApply(), spell_item_power_circle::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_hun_ascpect_of_the_viper::OnApply(), spell_hun_viper_attack_speed::OnApply(), spell_item_with_mount_speed::OnApply(), spell_blood_queen_vampiric_bite::OnCast(), npc_chesspiece::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_item_mind_amplify_dish::OnDummyEffect(), spell_item_linken_boomerang::OnEffectLaunchTargetDisarm(), spell_item_linken_boomerang::OnEffectLaunchTargetStun(), go_razorscale_harpoon::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), go_manticron_cube::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_strange_pool::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_taxi::OnGossipSelect(), npc_locksmith::OnGossipSelect(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npcs_riverbreeze_and_silversky::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_wormhole::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), go_ancient_skull_pile::OnGossipSelect(), go_fel_crystalforge::OnGossipSelect(), go_bashir_crystalforge::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), Player::OnGossipSelect(), spell_summon_all_players_dummy::OnHit(), spell_apothecary_perfume_spill::OnPeriodic(), spell_apothecary_cologne_spill::OnPeriodic(), spell_muru_summon_blood_elves_periodic_aura::OnPeriodic(), spell_claw_rage_aura::OnPeriodic(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_anubisath_mortal_strike::OnPeriodic(), spell_the_lich_king_soul_reaper_aura::OnPeriodic(), spell_yogg_saron_brain_link_aura::OnPeriodic(), spell_illidan_tear_of_azzinoth_summon_channel_aura::OnPeriodic(), spell_illidan_demon_transform1_aura::OnPeriodic(), spell_illidan_cage_trap_stun_aura::OnPeriodic(), spell_npc22275_crystal_prison_aura::OnPeriodic(), spell_item_eye_of_grillok_aura::OnPeriodic(), spell_kalecgos_curse_of_boundless_agony_aura::OnPeriodic(), spell_muru_darkness_aura::OnPeriodic(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_web_wrap_damage::OnPeriodic(), spell_assembly_rune_of_summoning_aura::OnPeriodic(), spell_hookshot_aura::OnPeriodic(), spell_tar_blaze_aura::OnPeriodic(), spell_thorim_lightning_pillar_P2_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), spell_karathress_power_of_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_lurker_below_spout::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_gen_turkey_marker::OnPeriodic(), instance_eye_of_eternity::OnPlayerEnter(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnPlayerInWaterStateUpdate(), BattlefieldWG::OnPlayerJoinWar(), lfg::LFGPlayerScript::OnPlayerMapChanged(), MidsummerPlayerScript::OnPlayerUpdateZone(), spell_gen_proc_on_victim::OnProc(), spell_pal_judgements_of_the_just::OnProc(), npc_steward_of_time::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_thrall_bfu::OnQuestReward(), spell_kalecgos_spectral_realm_aura::OnRemove(), spell_azgalor_doom_aura::OnRemove(), spell_boss_salramm_steal_flesh_aura::OnRemove(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_halion_meteor_strike_marker_aura::OnRemove(), spell_putricide_mutation_init_aura::OnRemove(), spell_the_lich_king_shadow_trap_visual_aura::OnRemove(), spell_the_lich_king_harvest_soul_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_ioc_repair_turret_aura::OnRemove(), spell_systems_shutdown_aura::OnRemove(), spell_dragonblight_devour_ghoul_periodic::OnRemove(), spell_kaelthas_flame_strike::OnRemove(), spell_item_goblin_weather_machine_aura::OnRemove(), spell_q12937_relief_for_the_fallen::OnRemove(), spell_claw_swipe_check::OnRemove(), spell_mage_arcane_missiles::OnRemove(), spell_warl_curse_of_doom::OnRemove(), boss_yoggsaron_descend_portal::OnSpellClick(), spell_item_shadowmourne_soul_fragment::OnStackChange(), at_hor_battered_hilt_throw::OnTrigger(), at_frozen_throne_teleport::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), npc_wintergarde_gryphon::PassengerBoarded(), npc_ulduar_snow_mound::PassengerBoarded(), boss_flame_leviathan_seat::PassengerBoarded(), boss_xt002::PassengerBoarded(), npc_four_car_garage::npc_four_car_garageAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), boss_kologarn::PassengerBoarded(), npc_frosthound::PassengerBoarded(), spell_quest_test_flight_charging::PerformKick(), spell_send_mug_control_aura::PeriodicTick(), spell_barreled_control_aura::PeriodicTick(), spell_dreamwalker_summon_suppresser_aura::PeriodicTick(), spell_summon_ice_spear_delayer::PeriodicTick(), spell_summoning_rhyme_aura::PeriodicTick(), spell_pal_beacon_of_light::PeriodicTick(), spell_halion_twilight_phasing::Phase(), BattlegroundAV::PopulateNode(), spell_azjol_nerub_carrion_beetles::PrepareAuraScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11653_youre_not_so_big_now::PrepareSpellScript(), spell_q13369_fate_up_against_your_will::PrepareSpellScript(), SmartScript::ProcessAction(), ProcessCastaction(), Player::ProcessDelayedOperations(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), ProcessTerrainStatusUpdate(), ProcessUnlearnAction(), BattlefieldWG::PromotePlayer(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), spell_gen_defend::RefreshVisualShields(), Vehicle::RemovePassenger(), spell_igb_below_zero::RemovePassengers(), boss_keristrasza::RemovePrison(), Player::ReportedAfkBy(), npc_demonic_vapor::Reset(), npc_demonic_vapor_trail::Reset(), npc_batrider::Reset(), npc_dark_iron_guzzler::Reset(), boss_headless_horseman_pumpkin::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_medivh_bm::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_drakkari_elemental::boss_drakkari_elementalAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_anomalus::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_algalon_the_observer::Reset(), boss_flame_leviathan::Reset(), npc_thorims_hammer::Reset(), boss_freya_lifebinder::Reset(), boss_freya_healthy_spore::Reset(), boss_freya_nature_bomb::Reset(), boss_thorim_lightning_orb::Reset(), boss_thorim_sif_blizzard::Reset(), boss_thorim_arena_npcs::Reset(), boss_yoggsaron_cloud::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_frozen_orb::npc_frozen_orbAI::Reset(), npc_frozen_orb_stalker::npc_frozen_orb_stalkerAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::Reset(), npc_ashtongue_channeler::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_wrath_scryer_soccothrates::Reset(), Resurrect(), Player::ResurrectPlayer(), Player::RewardQuest(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), boss_drakkari_colossus::boss_drakkari_colossusAI::ScheduleTasks(), Map::ScriptsProcess(), spell_item_mad_alchemists_potion::SecondaryEffect(), spell_item_crazy_alchemists_potion::SecondaryEffect(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_thorim_arena_npcs::SelectT(), npc_sayge::SendAction(), go_skull_pile::SendActionMenu(), Player::SendInitialPacketsAfterAddToMap(), boss_sartharion::SendLavaWaves(), Player::SendQuestUpdate(), instance_halls_of_reflection::SetBossState(), instance_halls_of_reflection::SetData(), npc_eastvale_peasent::SetData(), boss_gormok::boss_gormokAI::SetGUID(), SetModelVisible(), BattlefieldWG::SetupBattlefield(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_gloomrel::sGossipSelect(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), npc_alexstraza_the_lifebinder::sGossipSelect(), npc_cairne_bloodhoof::npc_cairne_bloodhoofAI::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_cultist_engineer::sGossipSelect(), boss_hodir::SmallIcicles(), boss_malchezaar::SpawnInfernal(), boss_pyroguard_emberseer::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_ulduar_flames_spread::SpellHit(), npc_franklin::npc_franklinAI::SpellHit(), npc_necropolis_relay::SpellHit(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_headless_horseman::SpellHit(), npc_pool_of_tar::SpellHit(), boss_thorim_pillar::SpellHit(), npc_pet_gen_soul_trader_beacon::SpellHit(), npc_necropolis_proxy::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_living_constellation::SpellHit(), boss_ignis::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_necrotic_shard::SpellHit(), npc_soh_fire_trigger::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_magus_telestra::SpellHit(), boss_flame_leviathan::SpellHit(), boss_thorim::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), boss_felmyst::SpellHitTarget(), boss_rotface::boss_rotfaceAI::SpellHitTarget(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), boss_hodir::SpellHitTarget(), npc_ulduar_rocket_strike_trigger::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), boss_epoch::boss_epochAI::SpellHitTarget(), boss_sapphiron::boss_sapphironAI::SpellHitTarget(), npc_overlord_drakuru_betrayal::SpellHitTarget(), boss_shirrak_the_dead_watcher::SpellHitTarget(), Battleground::SpiritOfCompetitionEvent(), boss_heigan::StartFightPhase(), npc_finklestein::npc_finklesteinAI::StartNextTask(), spell_dk_ghoul_explode::Suicide(), spell_valkyr_bullet_controller::SummonBelowCap(), boss_anzu::SummonBroods(), boss_cthun::SummonedCreatureDies(), boss_anubrekhan::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_sartharion::SummonLavaWaves(), go_wind_stone::go_wind_stoneAI::SummonNPC(), npc_highlord_darion_mograine::SummonReplacement(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SummonSaurfangCampVendor(), Trainer::Trainer::TeachSpell(), Battlefield::TeamCastSpell(), spell_igb_check_for_players::TeleportPlayer(), BattlegroundSA::TeleportToEntrancePosition(), spell_midsummer_fling_torch::ThrowNextTorch(), TriggerBurningPitch(), npc_orb_carrier::npc_orb_carrierAI::TriggerCutter(), spell_koralon_meteor_fists_aura::TriggerFists(), spell_flame_warder_meteor_fists_aura::TriggerFists(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_mage_ice_block::TriggerHypothermia(), spell_item_brewfest_hops::Update(), spell_karazhan_brittle_bones_aura::Update(), spell_black_temple_curse_of_the_bleakheart_aura::Update(), spell_illidari_council_deadly_strike_aura::Update(), spell_mother_shahraz_random_periodic_aura::Update(), spell_mother_shahraz_beam_periodic_aura::Update(), spell_mother_shahraz_saber_lash_aura::Update(), spell_black_temple_charge_rage_aura::Update(), GameObject::Update(), TotemAI::UpdateAI(), boss_pyroguard_emberseer::UpdateAI(), npc_vaelastrasz_the_red::UpdateAI(), boss_nefarian::UpdateAI(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_image_of_medivh::npc_image_of_medivhAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_demonic_vapor::UpdateAI(), npc_demonic_vapor_trail::UpdateAI(), npc_kalecgos_kj::UpdateAI(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_scarlet_ghoul::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), npc_hallows_end_train_fire::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_headless_horseman_head::UpdateAI(), boss_headless_horseman_pumpkin::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), npc_time_rift::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_tharnarian::npc_tharnarianAI::UpdateAI(), npc_halion_controller::npc_halion_controllerAI::UpdateAI(), npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_power_spark::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), npc_crystal_spike::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_algalon_worm_hole::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_summons::UpdateAI(), boss_freya_nature_bomb::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_saronite_animus::UpdateAI(), boss_hodir::UpdateAI(), npc_ulduar_icicle::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), boss_kologarn_eyebeam::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), npc_ulduar_proximity_mine::UpdateAI(), npc_ulduar_mimiron_rocket::UpdateAI(), npc_ulduar_emergency_fire_bot::UpdateAI(), npc_ulduar_rocket_strike_trigger::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_thorim_trap::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron_cloud::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_yoggsaron_death_ray::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_queue::npc_wg_queueAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_invis_infernal_caster::npc_invis_infernal_casterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), trigger_periodic::trigger_periodicAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_maexxna_webwrap::boss_maexxna_webwrapAI::UpdateAI(), npc_living_poison::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), npc_q24545_vegard_dummy::npc_q24545_vegard_dummyAI::UpdateAI(), Player::UpdateAreaDependentAuras(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), boss_stormcaller_brundir::UpdatePhase(), Player::UpdateZoneDependentAuras(), GameObject::Use(), Player::VehicleSpellInitialize(), instance_eye_of_eternity::VortexHandling(), npc_dusk::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_engineer_helice::npc_engineer_heliceAI::WaypointReached().

◆ CastSpell() [6/9]

SpellCastResult Unit::CastSpell ( Unit *  victim,
SpellInfo const *  spellInfo,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1417{
1418 return CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1419}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [7/9]

SpellCastResult Unit::CastSpell ( Unit *  victim,
SpellInfo const *  spellInfo,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1422{
1423 SpellCastTargets targets;
1424 targets.SetUnitTarget(victim);
1425 return CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
1426}

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastSpell() [8/9]

SpellCastResult Unit::CastSpell ( Unit *  victim,
uint32  spellId,
bool  triggered,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1400{
1401 return CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1402}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [9/9]

SpellCastResult Unit::CastSpell ( Unit *  victim,
uint32  spellId,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item *  castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1405{
1406 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1407 if (!spellInfo)
1408 {
1409 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1411 }
1412
1413 return CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
1414}

References CastSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastStop()

◆ ChangeSeat()

void Unit::ChangeSeat ( int8  seatId,
bool  next = true 
)
15391{
15392 if (!m_vehicle)
15393 return;
15394
15395 if (seatId < 0)
15396 {
15397 seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
15398 if (seatId < 0)
15399 return;
15400 }
15401 else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
15402 return;
15403
15405 if (!m_vehicle->AddPassenger(this, seatId))
15406 ABORT();
15407}
int8 GetNextEmptySeat(int8 seatId, bool next) const
Definition Vehicle.cpp:284
bool HasEmptySeat(int8 seatId) const
Definition Vehicle.cpp:258

References ABORT, Vehicle::AddPassenger(), Vehicle::GetNextEmptySeat(), WorldObject::GetTransSeat(), Vehicle::HasEmptySeat(), m_vehicle, and Vehicle::RemovePassenger().

Referenced by _EnterVehicle(), and WorldSession::HandleChangeSeatsOnControlledVehicle().

◆ CheckAttackFitToAuraRequirement()

virtual bool Unit::CheckAttackFitToAuraRequirement ( WeaponAttackType  ,
AuraEffect const *   
) const
inlinevirtual

Reimplemented in Player.

1101{ return true; }

Referenced by UpdateDamageDoneMods(), UpdateDamagePctDoneMods(), and Player::UpdateWeaponDependentCritAuras().

◆ CleanupBeforeRemoveFromMap()

void Unit::CleanupBeforeRemoveFromMap ( bool  finalCleanup)
12292{
12294 return;
12295
12296 // This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
12298
12299 if (IsInWorld()) // not in world and not being removed atm
12301
12302 // Abort pending events here: left to ~EventProcessor they run after m_spellMods is already
12303 // destroyed, and cancelling a SpellEvent then hits freed memory in Player::RestoreSpellMods.
12304 m_Events.KillAllEvents(false);
12305
12306 ASSERT(GetGUID());
12307
12308 // A unit may be in removelist and not in world, but it is still in grid
12309 // and may have some references during delete
12312
12313 if (finalCleanup)
12314 m_cleanupDone = true;
12315
12316 CombatStop();
12319 GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
12320}
void KillAllEvents(bool force)
Definition EventProcessor.cpp:82
void Clear(bool reset=true)
Definition MotionMaster.h:194
void RemoveAllGameObjects()
Definition Unit.cpp:6493
void ClearComboPoints()
Definition Unit.cpp:12956
void ClearComboPointHolders()
Definition Unit.cpp:13011
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool keepPvPForOthers=false)
Definition Unit.cpp:7320
void RemoveFromWorld() override
Definition Unit.cpp:12240
void RemoveAllAuras()
Definition Unit.cpp:5410

References ASSERT, MotionMaster::Clear(), ClearComboPointHolders(), ClearComboPoints(), CombatStop(), Object::GetGUID(), GetMotionMaster(), InterruptNonMeleeSpells(), IsDuringRemoveFromWorld(), Object::IsInWorld(), EventProcessor::KillAllEvents(), m_cleanupDone, WorldObject::m_Events, RemoveAllAuras(), RemoveAllGameObjects(), and RemoveFromWorld().

Referenced by CleanupsBeforeDelete().

◆ CleanupsBeforeDelete()

void Unit::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

12323{
12324 if (GetTransport())
12325 {
12327 SetTransport(nullptr);
12330 }
12331
12332 CleanupBeforeRemoveFromMap(finalCleanup);
12333}
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void CleanupBeforeRemoveFromMap(bool finalCleanup)
Definition Unit.cpp:12291
void SetTransport(Transport *t)
Definition Object.h:709
void Reset()
Definition Object.h:306
void RemoveMovementFlag(uint32 flag)
Definition Object.h:352

References CleanupBeforeRemoveFromMap(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

Referenced by Player::CleanupsBeforeDelete(), npc_commandscript::HandleNpcAddCommand(), and Map::RemoveAllObjectsInRemoveList().

◆ ClearAllReactives()

void Unit::ClearAllReactives ( )
13020{
13021 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
13022 m_reactiveTimer[i] = 0;
13023
13030}
@ CLASS_HUNTER
Definition SharedDefines.h:128
@ CLASS_WARRIOR
Definition SharedDefines.h:126
@ AURA_STATE_DEFENSE
Definition SharedDefines.h:1280
@ AURA_STATE_HUNTER_PARRY
Definition SharedDefines.h:1286
@ CLASS_CONTEXT_ABILITY_REACTIVE
Definition UnitDefines.h:242
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:850
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition Unit.cpp:7481

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), Object::IsPlayer(), m_reactiveTimer, MAX_REACTIVE, and ModifyAuraState().

Referenced by Player::ActivateSpec(), and setDeathState().

◆ ClearComboPointHolders()

void Unit::ClearComboPointHolders ( )
13012{
13013 while (!m_ComboPointHolders.empty())
13014 {
13015 (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
13016 }
13017}

References ClearComboPoints(), and m_ComboPointHolders.

Referenced by CreatureAI::_EnterEvadeMode(), CleanupBeforeRemoveFromMap(), Player::RemoveFromWorld(), and setDeathState().

◆ ClearComboPoints()

void Unit::ClearComboPoints ( )
12957{
12958 if (!m_comboTarget)
12959 {
12960 return;
12961 }
12962
12963 // remove Premed-like effects
12964 // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
12966
12967 m_comboPoints = 0;
12970 m_comboTarget = nullptr;
12971}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition SpellAuraDefines.h:211

References m_comboPoints, m_comboTarget, RemoveAurasByType(), RemoveComboPointHolder(), SendComboPoints(), and SPELL_AURA_RETAIN_COMBO_POINTS.

Referenced by CleanupBeforeRemoveFromMap(), ClearAllReactives(), ClearComboPointHolders(), Player::DuelComplete(), Player::RemoveFromWorld(), and UpdateReactives().

◆ ClearDiminishings()

void Unit::ClearDiminishings ( )
inline
1883{ m_Diminishing.clear(); }

References m_Diminishing.

Referenced by setDeathState().

◆ ClearEmoteState()

◆ ClearInCombat()

void Unit::ClearInCombat ( bool  keepPvPForOthers = false)
10480{
10481 m_CombatTimer = 0;
10482 // Let CombatManager handle flag removal through UpdateOwnerCombatState
10483 // so that AtExitCombat/AtDisengage callbacks properly fire.
10484 if (keepPvPForOthers)
10485 {
10488 }
10489 else
10491 // If flag is still set (e.g. set by old code path without CombatReference),
10492 // remove it directly.
10493 if (IsInCombat())
10495
10496 // Player's state will be cleared in Player::UpdateContestedPvP
10497 if (Creature* creature = ToCreature())
10498 {
10499 if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
10500 SetImmuneToPC(true); // set immunity state to the one from db on evade
10501
10504 ReplaceAllDynamicFlags(creature->GetCreatureTemplate()->dynamicflags);
10505
10506 creature->SetAssistanceTimer(0);
10507
10508 // Xinef: will be recalculated at follow movement generator initialization
10509 if (!IsPet() && !IsCharmed())
10510 return;
10511 }
10512 else if (Player* player = ToPlayer())
10513 {
10514 player->UpdatePotionCooldown();
10515 if (player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
10516 for (uint8 i = 0; i < MAX_RUNES; ++i)
10517 player->SetGracePeriod(i, 0);
10518 }
10519
10520 if (Player* player = this->ToPlayer())
10521 {
10522 sScriptMgr->OnPlayerLeaveCombat(player);
10523 }
10524}
#define MAX_RUNES
Definition Player.h:385
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:131
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:241
@ UNIT_STATE_ATTACK_PLAYER
Definition UnitDefines.h:187
@ UNIT_FLAG_IN_COMBAT
Definition UnitDefines.h:276
@ UNIT_FLAG_IMMUNE_TO_PC
Definition UnitDefines.h:265
void EndAllCombat()
Definition CombatManager.h:155
void SuppressPvPCombat()
Definition CombatManager.cpp:329
void EndAllPvECombat()
Definition CombatManager.cpp:344
void ReplaceAllDynamicFlags(uint32 flag) override
Definition Unit.h:775
bool IsCharmed() const
Definition Unit.h:1327
bool IsPet() const
Definition Unit.h:803
CombatManager & GetCombatManager()
Definition Unit.h:967
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:10439
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:755

References CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, ClearUnitState(), CombatManager::EndAllCombat(), CombatManager::EndAllPvECombat(), GetCombatManager(), Object::HasDynamicFlag(), IsCharmed(), IsInCombat(), IsPet(), m_CombatTimer, MAX_RUNES, RemoveUnitFlag(), ReplaceAllDynamicFlags(), SetImmuneToPC(), sScriptMgr, CombatManager::SuppressPvPCombat(), Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_TAPPED, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IN_COMBAT, and UNIT_STATE_ATTACK_PLAYER.

Referenced by CombatStop(), Player::LoadFromDB(), and Update().

◆ ClearInPetCombat()

◆ ClearUnitState()

void Unit::ClearUnitState ( uint32  f)
inline
743{ m_state &= ~f; }

References m_state.

Referenced by Spell::_cast(), HomeMovementGenerator< Creature >::_setTargetLocation(), Creature::AtDisengage(), AtEngage(), Attack(), FollowerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), AttackStop(), ClearInCombat(), boss_thorim::DisableThorim(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), FormationMovementGenerator::DoFinalize(), HomeMovementGenerator< Creature >::DoFinalize(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectResurrectPet(), boss_yoggsaron_sara::EnableSara(), boss_ayamiss::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), brann_bronzebeard::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), boss_flame_leviathan_defense_turret::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::EnterEvadeMode(), TimedFleeingMovementGenerator::Finalize(), RotateMovementGenerator::Finalize(), DistractMovementGenerator::Finalize(), AssistanceDistractMovementGenerator::Finalize(), Spell::finish(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), npc_plague_cauldron_ghoul::IsSummonedBy(), npc_plague_cauldron_ghoul::Land(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), SmartAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MotionMaster::MoveTargetedHome(), boss_loken::OnAuraRemove(), boss_nightbane::PathEndReached(), WaypointMovementGenerator< Creature >::ProcessWaypointArrival(), Creature::ReleaseFocus(), RemoveCharmedBy(), MotionTransport::RemovePassenger(), boss_ayamiss::Reset(), boss_yoggsaron_sara::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_hungarfen::Reset(), Player::ResetContestedPvP(), boss_loken::ScheduleTasks(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharm(), Player::SetClientControl(), SmartAI::SetCombatMovement(), SetControlled(), Creature::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Player::SetIsSpectator(), SetRooted(), TestCreature::SetupForCombatTest(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), boss_lady_vashj::StartPhaseThree(), StopMoving(), StopMovingOnCurrentPos(), TEST_F(), boss_devourer_of_souls::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), and boss_algalon_the_observer::UpdateAI().

◆ CombatStop()

void Unit::CombatStop ( bool  includingCast = false,
bool  mutualPvP = true,
bool  keepPvPForOthers = false 
)
7321{
7322 if (includingCast && IsNonMeleeSpellCast(false))
7324
7325 AttackStop();
7327 if (IsPlayer())
7328 ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
7329 if (Creature* pCreature = ToCreature())
7330 pCreature->ClearLastLeashExtensionTimePtr();
7331
7332 if (mutualPvP)
7333 ClearInCombat(keepPvPForOthers);
7334 else
7335 {
7338 }
7339
7340 // xinef: just in case
7341 if (IsPetInCombat() && !IsPlayer())
7343}
void SendAttackSwingCancelAttack()
Definition PlayerMisc.cpp:142
bool IsPetInCombat() const
Definition Unit.h:952
void ClearInCombat(bool keepPvPForOthers=false)
Definition Unit.cpp:10479
void ClearInPetCombat()
Definition Unit.cpp:10526
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition Unit.cpp:7418
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7287

References AttackStop(), ClearInCombat(), ClearInPetCombat(), CombatManager::EndAllPvECombat(), GetCombatManager(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), IsPetInCombat(), Object::IsPlayer(), RemoveAllAttackers(), Player::SendAttackSwingCancelAttack(), CombatManager::SuppressPvPCombat(), Object::ToCreature(), and Object::ToPlayer().

Referenced by CreatureAI::_EnterEvadeMode(), PetAI::_stopAttack(), Player::ActivateTaxiPathTo(), CleanupBeforeRemoveFromMap(), CombatStopWithPets(), boss_grand_champion::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_ulduar_hodir_priest::DoAction(), npc_ulduar_hodir_druid::DoAction(), npc_ulduar_hodir_shaman::DoAction(), npc_ulduar_hodir_mage::DoAction(), npc_spark_of_ionar::DoAction(), npc_maiev_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), Spell::EffectSanctuary(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), boss_magtheridon::EnterEvadeMode(), GuardAI::EnterEvadeMode(), TotemAI::EnterEvadeMode(), boss_doomrel::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), npc_pet_dk_ebon_gargoyle::FlyAway(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleCombatStopCommand(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), spell_chapter2_persuasive_strike::HandleHit(), npc_commandscript::HandleNpcDeleteCommand(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), SmartScript::ProcessAction(), Player::RemovePet(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), setDeathState(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Submit(), Player::TeleportTo(), Totem::UnSummon(), npc_highlord_darion_mograine::UpdateAI(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ CombatStopWithPets()

void Unit::CombatStopWithPets ( bool  includingCast = false)
7346{
7347 CombatStop(includingCast);
7348
7349 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7350 (*itr)->CombatStop(includingCast);
7351}

References CombatStop(), and m_Controlled.

Referenced by DealDamage(), WorldSession::HandleDuelCancelledOpcode(), Player::SetGameMaster(), Player::SetGMVisible(), and Player::UpdateArea().

◆ CountPctFromCurHealth()

uint32 Unit::CountPctFromCurHealth ( int32  pct) const
inline
1136{ return CalculatePct(GetHealth(), pct); }
uint32 GetHealth() const
Definition Unit.h:1122

References CalculatePct(), and GetHealth().

Referenced by spell_gen_leeching_swarm_aura::HandleEffectPeriodic().

◆ CountPctFromMaxHealth()

uint32 Unit::CountPctFromMaxHealth ( int32  pct) const
inline
1135{ return CalculatePct(GetMaxHealth(), pct); }
uint32 GetMaxHealth() const
Definition Unit.h:1123

References CalculatePct(), and GetMaxHealth().

Referenced by spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_dk_anti_magic_shell_self::CalculateAmount(), spell_dk_vampiric_blood::CalculateAmount(), boss_ichoron::DoAction(), Spell::EffectHeal(), Spell::EffectHealPct(), Spell::EffectResurrect(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonType(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), spell_dk_death_strike::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_lady_vashj_magic_barrier::HandleEffectRemove(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_dk_vendetta::HandleProc(), spell_dru_leader_of_the_pack::HandleProc(), spell_item_swift_hand_justice_dummy::HandleProc(), spell_pal_judgement_of_light_heal::HandleProc(), spell_pri_glyph_of_dispel_magic::HandleProc(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), spell_pri_lightwell_renew::InitializeAmount(), boss_harbinger_skyriss::JustSummoned(), boss_hadronox::KilledUnit(), Pet::LoadPetFromDB(), spell_gluth_decimate_damage::PrepareSpellScript(), boss_vaelastrasz::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ CreateTamedPetFrom() [1/2]

Pet * Unit::CreateTamedPetFrom ( Creature *  creatureTarget,
uint32  spell_id = 0 
)
13456{
13457 if (!IsPlayer())
13458 return nullptr;
13459
13460 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
13461
13462 if (!pet->CreateBaseAtCreature(creatureTarget))
13463 {
13464 delete pet;
13465 return nullptr;
13466 }
13467
13468 uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
13469
13470 if (!InitTamedPet(pet, level, spell_id))
13471 {
13472 delete pet;
13473 return nullptr;
13474 }
13475
13476 return pet;
13477}
@ HUNTER_PET
Definition PetDefines.h:33
bool CreateBaseAtCreature(Creature *creature)
Definition Pet.cpp:992
bool InitTamedPet(Pet *pet, uint8 level, uint32 spell_id)
Definition Unit.cpp:13499

References Pet::CreateBaseAtCreature(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), and Object::ToPlayer().

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), and Spell::EffectTameCreature().

◆ CreateTamedPetFrom() [2/2]

Pet * Unit::CreateTamedPetFrom ( uint32  creatureEntry,
uint32  spell_id = 0 
)
13480{
13481 if (!IsPlayer())
13482 return nullptr;
13483
13484 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
13485 if (!creatureInfo)
13486 return nullptr;
13487
13488 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
13489
13490 if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
13491 {
13492 delete pet;
13493 return nullptr;
13494 }
13495
13496 return pet;
13497}
#define sObjectMgr
Definition ObjectMgr.h:1734
bool CreateBaseAtCreatureInfo(CreatureTemplate const *cinfo, Unit *owner)
Definition Pet.cpp:1027
Definition CreatureData.h:187

References Pet::CreateBaseAtCreatureInfo(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), sObjectMgr, and Object::ToPlayer().

◆ CreateVehicleKit()

bool Unit::CreateVehicleKit ( uint32  id,
uint32  creatureEntry 
)

Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)

14694{
14695 VehicleEntry const* vehInfo = sVehicleStore.LookupEntry(id);
14696 if (!vehInfo)
14697 return false;
14698
14699 m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
14702 return true;
14703}
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
@ UNIT_MASK_VEHICLE
Definition UnitDefines.h:164
@ UPDATEFLAG_VEHICLE
Definition UpdateData.h:46

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, sVehicleStore, UNIT_MASK_VEHICLE, and UPDATEFLAG_VEHICLE.

Referenced by Creature::CreateFromProto(), AuraEffect::HandleAuraSetVehicle(), Mount(), instance_trial_of_the_crusader::SetSnoboldCarrier(), and npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit().

◆ DealDamage()

uint32 Unit::DealDamage ( Unit *  attacker,
Unit *  victim,
uint32  damage,
CleanDamage const *  cleanDamage = nullptr,
DamageEffectType  damagetype = DIRECT_DAMAGE,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  spellProto = nullptr,
bool  durabilityLoss = true,
bool  allowGM = false,
Spell const *  spell = nullptr,
bool  skipCombat = false 
)
static
993{
994 damage = sScriptMgr->DealDamage(attacker, victim, damage, damagetype);
995 // Xinef: initialize damage done for rage calculations
996 // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
997 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
998
999 //if (attacker)
1000 {
1001 if (victim->IsAIEnabled)
1002 victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask);
1003
1004 if (attacker && attacker->IsAIEnabled)
1005 attacker->GetAI()->DamageDealt(victim, damage, damagetype, damageSchoolMask);
1006 }
1007
1008 // Hook for OnDamage Event
1009 sScriptMgr->OnDamage(attacker, victim, damage);
1010
1011 if ((damageSpell && damageSpell->IsFromPreDeathAura()) || (attacker && attacker->IsInPreDeathAuraTick()))
1012 skipCombat = true;
1013
1014 // Signal to pets that their owner was attacked - except when DOT.
1015 if (attacker != victim && damagetype != DOT && !skipCombat)
1016 {
1017 for (Unit* controlled : victim->m_Controlled)
1018 if (Creature* cControlled = controlled->ToCreature())
1019 if (CreatureAI* controlledAI = cControlled->AI())
1020 controlledAI->OwnerAttackedBy(attacker);
1021 }
1022
1023 //Dont deal damage to unit if .cheat god is enable.
1024 if (victim->IsPlayer())
1025 {
1026 if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
1027 {
1028 return 0;
1029 }
1030 }
1031
1032 // Signal the pet it was attacked so the AI can respond if needed
1033 if (victim->IsCreature() && attacker != victim && victim->IsPet() && victim->IsAlive() && !skipCombat)
1034 victim->ToPet()->AI()->AttackedBy(attacker);
1035
1036 if (damagetype != NODAMAGE)
1037 {
1038 // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
1039 if (spellProto)
1040 {
1041 if (attacker && damagetype != DOT && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MELEE && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_HOLY))
1042 attacker->DealDamageShieldDamage(victim);
1043
1044 if (!spellProto->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS))
1046 }
1047 else
1049
1050 // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
1051 if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
1052 {
1053 if (victim != attacker && victim->IsPlayer())
1054 {
1055 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1056 {
1057 if (spell->getState() == SPELL_STATE_PREPARING)
1058 {
1059 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1060 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1061 {
1062 victim->InterruptNonMeleeSpells(false);
1063 }
1064 }
1065 }
1066 }
1067 }
1068
1069 // We're going to call functions which can modify content of the list during iteration over it's elements
1070 // Let's copy the list so we can prevent iterator invalidation
1072 // copy damage to casters of this aura
1073 for (AuraEffectList::iterator i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
1074 {
1075 // Check if aura was removed during iteration - we don't need to work on such auras
1076 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
1077 continue;
1078 // check damage school mask
1079 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
1080 continue;
1081
1082 Unit* shareDamageTarget = (*i)->GetCaster();
1083 if (!shareDamageTarget)
1084 continue;
1085 SpellInfo const* spell = (*i)->GetSpellInfo();
1086
1087 uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount());
1088 bool const hasSharedDamage = shareDamage != 0;
1089
1090 uint32 shareAbsorb = 0;
1091
1092 // The copy is already mitigated on the victim, so it skips the recipient's absorbs and resists
1093 if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask))
1094 {
1095 shareAbsorb = shareDamage;
1096 shareDamage = 0;
1097 }
1098 else
1099 Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb);
1100
1101 if (attacker && shareDamageTarget->IsPlayer())
1102 {
1103 attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, 0, damagetype == DIRECT_DAMAGE, 0, false, true);
1104 }
1105
1106 // Shared damage is a hostile interaction for its recipient too.
1107 if (hasSharedDamage && attacker && !attacker->IsFriendlyTo(shareDamageTarget) && !skipCombat)
1108 attacker->AtTargetAttacked(shareDamageTarget, !spellProto || spellProto->HasInitialAggro());
1109
1110 Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask,
1111 spellProto, false, false, damageSpell, skipCombat);
1112 }
1113 }
1114
1115 // Rage from Damage made (only from direct weapon damage)
1116 if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->HasActivePowerType(POWER_RAGE))
1117 {
1118 uint32 weaponSpeedHitFactor;
1119
1120 switch (cleanDamage->attackType)
1121 {
1122 case BASE_ATTACK:
1123 case OFF_ATTACK:
1124 {
1125 weaponSpeedHitFactor = attacker->GetRageWeaponSpeedHitFactor(cleanDamage->attackType);
1126 if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
1127 weaponSpeedHitFactor *= 2;
1128
1129 attacker->RewardRage(rage_damage, weaponSpeedHitFactor, true);
1130 break;
1131 }
1132 default:
1133 break;
1134 }
1135 }
1136
1137 if (!damage)
1138 {
1139 // Rage from absorbed damage
1140 if (cleanDamage && cleanDamage->absorbed_damage)
1141 {
1142 if (victim->HasActivePowerType(POWER_RAGE))
1143 victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
1144
1145 if (attacker && attacker->HasActivePowerType(POWER_RAGE))
1146 attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
1147 }
1148
1149 return 0;
1150 }
1151
1152 LOG_DEBUG("entities.unit", "DealDamageStart");
1153
1154 uint32 health = victim->GetHealth();
1155 LOG_DEBUG("entities.unit", "deal dmg:{} to health:{} ", damage, health);
1156
1157 // duel ends when player has 1 or less hp
1158 bool duel_hasEnded = false;
1159 bool duel_wasMounted = false;
1160 if (victim->IsPlayer() && victim->ToPlayer()->duel && damage >= (health - 1))
1161 {
1162 // xinef: situation not possible earlier, just return silently.
1163 if (!attacker)
1164 return 0;
1165
1166 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
1167 if (victim->ToPlayer()->duel->Opponent == attacker || victim->ToPlayer()->duel->Opponent->GetGUID() == attacker->GetOwnerGUID())
1168 damage = health - 1;
1169
1170 duel_hasEnded = true;
1171 }
1172 else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->IsPlayer())
1173 {
1174 Player* victimRider = victim->GetCharmer()->ToPlayer();
1175
1176 if (victimRider && victimRider->duel && victimRider->duel->IsMounted)
1177 {
1178 // xinef: situation not possible earlier, just return silently.
1179 if (!attacker)
1180 return 0;
1181
1182 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
1183 if (victimRider->duel->Opponent == attacker || victimRider->duel->Opponent->GetGUID() == attacker->GetCharmerGUID())
1184 damage = health - 1;
1185
1186 duel_wasMounted = true;
1187 duel_hasEnded = true;
1188 }
1189 }
1190
1191 if (attacker && attacker != victim)
1192 if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself())
1193 {
1194 // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so
1195 //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR)
1196 // return 0;
1197
1198 if (Battleground* bg = killer->GetBattleground())
1199 {
1200 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
1201 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization
1202 }
1203 //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization
1204 }
1205
1206 if (victim->IsPlayer())
1207 ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization
1208 else if (!victim->IsControlledByPlayer() || victim->IsVehicle())
1209 {
1210 if (!victim->ToCreature()->hasLootRecipient())
1211 victim->ToCreature()->SetLootRecipient(attacker);
1212
1213 if (!attacker || attacker->IsControlledByPlayer() || attacker->IsCreatedByPlayer())
1214 {
1215 uint32 unDamage = health < damage ? health : damage;
1216 bool damagedByPlayer = unDamage && attacker && (attacker->IsPlayer() || attacker->m_movedByPlayer != nullptr
1217 || attacker->GetCharmerGUID().IsPlayer());
1218
1219 uint8 attackerLevel = 0;
1220 if (damagedByPlayer)
1221 {
1222 Player* attackerPlayer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself();
1223 if (!attackerPlayer && attacker->m_movedByPlayer)
1224 attackerPlayer = attacker->m_movedByPlayer->ToPlayer();
1225 if (attackerPlayer)
1226 attackerLevel = attackerPlayer->GetLevel();
1227 }
1228
1229 victim->ToCreature()->LowerPlayerDamageReq(unDamage, damagedByPlayer, attackerLevel);
1230 }
1231 }
1232
1233 // Sparring
1234 if (victim->CanSparringWith(attacker))
1235 {
1236 if (damage >= victim->GetHealth())
1237 damage = 0;
1238
1239 uint32 sparringHealth = victim->GetHealth() * (victim->ToCreature()->GetSparringPct() / 100);
1240 if (victim->GetHealth() - damage <= sparringHealth)
1241 damage = 0;
1242 }
1243
1244 if (health <= damage)
1245 {
1246 LOG_DEBUG("entities.unit", "DealDamage: victim just died");
1247
1248 //if (attacker && victim->IsPlayer() && victim != attacker)
1249 //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
1250 Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
1251 }
1252 else
1253 {
1254 LOG_DEBUG("entities.unit", "DealDamageAlive");
1255
1256 //if (victim->IsPlayer())
1257 // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization
1258
1259 victim->ModifyHealth(- (int32)damage);
1260
1261 if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
1262 victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
1263
1264 if (!victim->IsPlayer())
1265 {
1266 // DoT ticks and passive damage (e.g. Thorns) do not reset leash timer
1267 if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
1269
1270 if (attacker && attacker != victim && (!skipCombat || victim->IsEngagedBy(attacker)))
1271 {
1272 victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
1273 }
1274 }
1275 else // victim is a player
1276 {
1277 // random durability for items (HIT TAKEN)
1279 {
1282 }
1283 }
1284
1285 // Rage from damage received
1286 if (attacker != victim && victim->HasActivePowerType(POWER_RAGE))
1287 {
1288 uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
1289 victim->RewardRage(rageDamage, 0, false);
1290 }
1291
1292 if (attacker && attacker->IsPlayer())
1293 {
1294 // random durability for items (HIT DONE)
1296 {
1298 attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot);
1299 }
1300 }
1301
1302 if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK))))
1303 {
1304 if (victim != attacker && victim->IsPlayer()) // does not support creature push_back
1305 {
1306 if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel()))
1307 {
1308 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1309 {
1310 if (spell->getState() == SPELL_STATE_PREPARING)
1311 {
1312 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1313 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1314 {
1315 victim->InterruptNonMeleeSpells(false);
1316 }
1317 else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
1318 {
1319 spell->Delayed();
1320 }
1321 }
1322 }
1323
1324 if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
1325 if (spell->getState() == SPELL_STATE_CASTING)
1326 {
1327 if ((spell->m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_DELAY) != 0)
1328 {
1329 spell->DelayedChannel();
1330 }
1331 }
1332 }
1333 }
1334 }
1335
1336 // last damage from duel opponent
1337 if (duel_hasEnded)
1338 {
1339 Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer();
1340
1341 ASSERT_NODEBUGINFO(he && he->duel);
1342
1343 if (duel_wasMounted) // In this case victim==mount
1344 victim->SetHealth(1);
1345 else
1346 he->SetHealth(1);
1347
1348 he->duel->Opponent->CombatStopWithPets(true);
1349 he->CombatStopWithPets(true);
1350
1351 he->CastSpell(he, 7267, true); // beg
1353 }
1354 }
1355
1356 LOG_DEBUG("entities.unit", "DealDamageEnd returned {} damage", damage);
1357
1358 return damage;
1359}
@ SCORE_DAMAGE_DONE
Definition BattlegroundScore.h:32
@ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
Definition DBCEnums.h:130
#define ASSERT_NODEBUGINFO
Definition Errors.h:69
@ CHEAT_GOD
Definition Player.h:997
EquipmentSlots
Definition Player.h:660
@ EQUIPMENT_SLOT_END
Definition Player.h:681
bool roll_chance_f(float chance)
Definition Random.h:57
@ POWER_RAGE
Definition SharedDefines.h:258
@ SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK
Definition SharedDefines.h:635
@ SPELL_ATTR3_TREAT_AS_PERIODIC
Definition SharedDefines.h:506
@ DUEL_WON
Definition SharedDefines.h:3869
@ SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS
Definition SharedDefines.h:532
@ SPELL_AURA_DAMAGE_SHIELD
Definition SpellAuraDefines.h:78
@ SPELL_AURA_SHARE_DAMAGE_PCT
Definition SpellAuraDefines.h:363
@ CHANNEL_FLAG_DELAY
Definition SpellDefines.h:46
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:52
@ AURA_INTERRUPT_FLAG_DIRECT_DAMAGE
Definition SpellDefines.h:75
@ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG
Definition SpellDefines.h:38
@ SPELL_INTERRUPT_FLAG_PUSH_BACK
Definition SpellDefines.h:35
@ SPELL_STATE_PREPARING
Definition Spell.h:237
@ SPELL_STATE_CASTING
Definition Spell.h:238
@ NODAMAGE
Definition Unit.h:266
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:565
@ CURRENT_GENERIC_SPELL
Definition Unit.h:564
@ RATE_DURABILITY_LOSS_DAMAGE
Definition WorldConfig.h:496
virtual void AttackedBy(Unit *)
Definition CreatureAI.h:180
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true, uint8 attackerLevel=0)
Definition Creature.cpp:3936
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition Creature.cpp:1323
bool hasLootRecipient() const
Definition Creature.h:236
float GetSparringPct() const
Definition Creature.h:192
bool IsPlayer() const
Definition ObjectGuid.h:172
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2232
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition Player.cpp:4936
bool GetCommandStatus(uint32 command) const
Definition Player.h:1202
uint32 ChannelInterruptFlags
Definition SpellInfo.h:378
uint32 InterruptFlags
Definition SpellInfo.h:376
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage to any victim (before damage apply)
Definition UnitAI.h:369
virtual void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage from any attacker (before damage apply)
Definition UnitAI.h:376
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10800
Pet * ToPet()
Definition Unit.h:735
bool IsCreatedByPlayer() const
Definition Unit.h:1325
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:11284
Unit * GetCharmer() const
Definition Unit.cpp:7542
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:13667
uint32 GetRageWeaponSpeedHitFactor(WeaponAttackType att) const
Definition Unit.h:929
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition Unit.cpp:15777
void SetHealth(uint32 val)
Definition Unit.cpp:12036
bool IsEngagedBy(Unit const *who) const
Definition Unit.h:946
ObjectGuid GetCharmerGUID() const
Definition Unit.h:725
void DealDamageShieldDamage(Unit *victim)
Definition Unit.cpp:2141
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1146
void CombatStopWithPets(bool includingCast=false)
Definition Unit.cpp:7345

References CleanDamage::absorbed_damage, ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, AddThreat(), Creature::AI(), ASSERT_NODEBUGINFO, CreatureAI::AttackedBy(), CleanDamage::attackType, AtTargetAttacked(), AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, AURA_INTERRUPT_FLAG_TAKE_DAMAGE, BASE_ATTACK, CalculatePct(), CanSparringWith(), CastSpell(), CHANNEL_FLAG_DELAY, CHEAT_GOD, CombatStopWithPets(), CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, UnitAI::DamageDealt(), UnitAI::DamageTaken(), DealDamage(), DealDamageMods(), DealDamageShieldDamage(), DIRECT_DAMAGE, SpellInfo::DmgClass, DOT, Player::duel, DUEL_WON, Player::DuelComplete(), Player::DurabilityPointLossForEquipSlot(), EQUIPMENT_SLOT_END, GetAI(), GetAuraEffectsByType(), GetCharmer(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetCommandStatus(), Object::GetGUID(), GetHealth(), GetLevel(), GetOwnerGUID(), GetRageWeaponSpeedHitFactor(), SpellInfo::GetSchoolMask(), Creature::GetSparringPct(), HasActivePowerType(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellCastTargets::HasDstChannel(), SpellInfo::HasInitialAggro(), Creature::hasLootRecipient(), CleanDamage::hitOutCome, SpellInfo::Id, InterruptNonMeleeSpells(), IsAIEnabled, IsAlive(), IsControlledByPlayer(), IsCreatedByPlayer(), Object::IsCreature(), IsEngagedBy(), IsFriendlyTo(), Spell::IsFromPreDeathAura(), IsImmunedToDamageOrSchool(), IsInPreDeathAuraTick(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), IsVehicle(), Kill(), LOG_DEBUG, Creature::LowerPlayerDamageReq(), m_Controlled, m_currentSpells, m_movedByPlayer, Spell::m_targets, MELEE_HIT_CRIT, ModifyHealth(), NODAMAGE, OFF_ATTACK, POWER_RAGE, RATE_DURABILITY_LOSS_DAMAGE, RemoveAurasWithInterruptFlags(), RewardRage(), roll_chance_f(), SCORE_DAMAGE_DONE, SendSpellNonMeleeDamageLog(), SetHealth(), Creature::SetLootRecipient(), SPELL_ATTR3_TREAT_AS_PERIODIC, SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS, SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_SHARE_DAMAGE_PCT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DIRECT_DAMAGE, SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, SPELL_INTERRUPT_FLAG_PUSH_BACK, SPELL_SCHOOL_MASK_HOLY, SPELL_STATE_CASTING, SPELL_STATE_PREPARING, sScriptMgr, sWorld, Object::ToCreature(), ToPet(), Object::ToPlayer(), Player::UpdateAchievementCriteria(), Creature::UpdateLeashExtensionTime(), and urand().

Referenced by CalcAbsorbResist(), DealDamage(), DealDamageShieldDamage(), DealMeleeDamage(), DealSpellDamage(), Spell::DoAllEffectOnTarget(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectInstaKill(), Player::EnvironmentalDamage(), spell_mt_phoenix_burn::HandleAfterCast(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), spell_svala_ritual_strike::HandleDummyEffect(), spell_valkyr_touch_aura::HandleEffectPeriodic(), spell_lady_vashj_magic_barrier::HandleEffectRemove(), spell_algalon_collapse_aura::HandlePeriodic(), spell_kaelthas_burn::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_gluth_decimate::HandleScriptEffect(), npc_necrotic_shard::SpellHit(), npc_hor_lich_king::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ DealDamageMods()

void Unit::DealDamageMods ( Unit const *  victim,
uint32 &  damage,
uint32 *  absorb 
)
static

◆ DealDamageShieldDamage()

void Unit::DealDamageShieldDamage ( Unit *  victim)
Todo:
: Move this to a packet handler
2142{
2143 // We're going to call functions which can modify content of the list during iteration over it's elements
2144 // Let's copy the list so we can prevent iterator invalidation
2146 for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
2147 {
2148 SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
2149 // Damage shield can be resisted...
2150 if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
2151 {
2152 victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
2153 continue;
2154 }
2155
2156 // ...or immuned
2157 if (IsImmunedToDamage(victim, i_spellProto))
2158 {
2159 victim->SendSpellDamageImmune(this, i_spellProto->Id);
2160 continue;
2161 }
2162
2163 uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation
2164
2165 if (Unit* caster = (*dmgShieldItr)->GetCaster())
2166 {
2167 damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex());
2168 damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
2169 }
2170
2171 uint32 absorb = 0;
2172
2173 DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE);
2174 Unit::CalcAbsorbResist(dmgInfo);
2175 absorb = dmgInfo.GetAbsorb();
2176 damage = dmgInfo.GetDamage();
2177
2178 Unit::DealDamageMods(this, damage, &absorb);
2179
2181 WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4));
2182 data << victim->GetGUID();
2183 data << GetGUID();
2184 data << uint32(i_spellProto->Id);
2185 data << uint32(damage); // Damage
2186 int32 overkill = int32(damage) - int32(GetHealth());
2187 data << uint32(overkill > 0 ? overkill : 0); // Overkill
2188 data << uint32(i_spellProto->GetSchoolMask());
2189 victim->SendMessageToSet(&data, true);
2190
2191 Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
2192 }
2193}
SpellMissInfo
Definition SharedDefines.h:1522
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1935
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition Unit.cpp:6707
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:8728
bool IsImmunedToDamage(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9710
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2178
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Definition Object.cpp:3837
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
Definition Object.cpp:3689
@ SMSG_SPELLDAMAGESHIELD
Definition Opcodes.h:621

References CalcAbsorbResist(), DealDamage(), DealDamageMods(), DamageInfo::GetAbsorb(), GetAuraEffectsByType(), DamageInfo::GetDamage(), Object::GetGUID(), Object::GetGUID(), GetHealth(), SpellInfo::GetSchoolMask(), SpellInfo::Id, IsImmunedToDamage(), WorldObject::SendMessageToSet(), SendSpellDamageImmune(), WorldObject::SendSpellMiss(), SMSG_SPELLDAMAGESHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_DIRECT_DAMAGE, SpellDamageBonusTaken(), and WorldObject::SpellHitResult().

Referenced by DealDamage(), and DealMeleeDamage().

◆ DealHeal()

int32 Unit::DealHeal ( Unit *  healer,
Unit *  victim,
uint32  addhealth 
)
static
7892{
7893 int32 gain = 0;
7894
7895 if (healer)
7896 {
7897 if (victim->IsAIEnabled)
7898 victim->GetAI()->HealReceived(healer, addhealth);
7899
7900 if (healer->IsAIEnabled)
7901 healer->GetAI()->HealDone(victim, addhealth);
7902 }
7903
7904 if (addhealth)
7905 gain = victim->ModifyHealth(int32(addhealth));
7906
7907 // Hook for OnHeal Event
7908 sScriptMgr->OnHeal(healer, victim, (uint32&)gain);
7909
7910 Unit* unit = healer;
7911
7912 if (healer && healer->IsCreature() && healer->ToCreature()->IsTotem())
7913 unit = healer->GetOwner();
7914
7915 if (!unit)
7916 return gain;
7917
7918 if (Player* player = unit->ToPlayer())
7919 {
7920 if (Battleground* bg = player->GetBattleground())
7921 bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
7922
7923 // use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
7924 if (gain && player->InBattleground()) // pussywizard: InBattleground() optimization
7925 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
7926
7927 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth); // pussywizard: optimization
7928 }
7929
7930 /*if (Player* player = victim->ToPlayer())
7931 {
7932 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); // pussywizard: optimization
7933 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); // pussywizard: optimization
7934 }*/
7935
7936 return gain;
7937}
@ SCORE_HEALING_DONE
Definition BattlegroundScore.h:33
@ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE
Definition DBCEnums.h:169
virtual void HealReceived(Unit *, uint32 &)
Called when the creature receives heal.
Definition UnitAI.h:379
virtual void HealDone(Unit *, uint32 &)
Called when the unit heals.
Definition UnitAI.h:385

References ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, GetAI(), GetOwner(), UnitAI::HealDone(), UnitAI::HealReceived(), IsAIEnabled, Object::IsCreature(), IsTotem(), ModifyHealth(), SCORE_HEALING_DONE, sScriptMgr, Object::ToCreature(), and Object::ToPlayer().

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealAurasTick(), HealBySpell(), and npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI().

◆ DealMeleeDamage()

void Unit::DealMeleeDamage ( CalcDamageInfo *  damageInfo,
bool  durabilityLoss 
)
2018{
2019 Unit* victim = damageInfo->target;
2020
2021 auto canTakeMeleeDamage = [&]()
2022 {
2023 return victim->IsAlive() && !victim->IsInFlight() && (!victim->IsCreature() || !victim->ToCreature()->IsEvadingAttacks());
2024 };
2025
2026 if (!canTakeMeleeDamage())
2027 {
2028 return;
2029 }
2030
2031 // Hmmmm dont like this emotes client must by self do all animations
2032 if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
2034 if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
2036
2037 // Parry haste is enabled if it's not a creature or if the creature doesn't have the NO_PARRY_HASTEN flag.
2038 bool isParryHasteEnabled = !victim->IsCreature() ||
2040 if (damageInfo->TargetState == VICTIMSTATE_PARRY && isParryHasteEnabled)
2041 {
2042 // Get attack timers
2043 float offtime = float(victim->getAttackTimer(OFF_ATTACK));
2044 float basetime = float(victim->getAttackTimer(BASE_ATTACK));
2045 // Reduce attack time
2046 if (victim->HasOffhandWeaponForAttack() && offtime < basetime)
2047 {
2048 float percent20 = victim->GetAttackTime(OFF_ATTACK) * 0.20f;
2049 float percent60 = 3.0f * percent20;
2050 if (offtime > percent20 && offtime <= percent60)
2051 victim->setAttackTimer(OFF_ATTACK, uint32(percent20));
2052 else if (offtime > percent60)
2053 {
2054 offtime -= 2.0f * percent20;
2055 victim->setAttackTimer(OFF_ATTACK, uint32(offtime));
2056 }
2057 }
2058 else
2059 {
2060 float percent20 = victim->GetAttackTime(BASE_ATTACK) * 0.20f;
2061 float percent60 = 3.0f * percent20;
2062 if (basetime > percent20 && basetime <= percent60)
2063 victim->setAttackTimer(BASE_ATTACK, uint32(percent20));
2064 else if (basetime > percent60)
2065 {
2066 basetime -= 2.0f * percent20;
2067 victim->setAttackTimer(BASE_ATTACK, uint32(basetime));
2068 }
2069 }
2070 }
2071
2072 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2073 {
2074 if (!canTakeMeleeDamage() || (!damageInfo->damages[i].damage && !damageInfo->damages[i].absorb && !damageInfo->damages[i].resist))
2075 {
2076 continue;
2077 }
2078
2079 // Call default DealDamage
2080 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->damages[i].absorb, damageInfo->attackType, damageInfo->hitOutCome);
2081 Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
2082 }
2083
2084 // gain rage if attack is fully blocked, dodged or parried
2086 {
2087 switch (damageInfo->attackType)
2088 {
2089 case BASE_ATTACK:
2090 case OFF_ATTACK:
2091 {
2092 uint32 weaponSpeedHitFactor = GetRageWeaponSpeedHitFactor(damageInfo->attackType);
2093 RewardRage(damageInfo->cleanDamage, weaponSpeedHitFactor, true);
2094 break;
2095 }
2096 default:
2097 break;
2098 }
2099 }
2100
2101 // If this is a creature and it attacks from behind it has a probability to daze it's victim
2102 if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
2103 !IsPlayer() && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
2104 && (victim->IsPlayer() || (!victim->ToCreature()->isWorldBoss() && !victim->IsVehicle()))))
2105 {
2106 // -probability is between 0% and 40%
2107 // 20% base chance
2108 float Probability = 20.0f;
2109
2110 // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
2111 if (victim->GetLevel() < 30)
2112 Probability = 0.65f * victim->GetLevel() + 0.5f;
2113
2114 uint32 VictimDefense = victim->GetDefenseSkillValue();
2116 uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
2117
2118 // xinef: fix daze mechanics
2119 Probability -= ((float)VictimDefense + (float)VictimAuraDefense - AttackerMeleeSkill) * 0.1428f;
2120
2121 if (Probability > 40.0f)
2122 Probability = 40.0f;
2123
2124 // Daze application
2125 if (sWorld->getBoolConfig(CONFIG_ENABLE_DAZE))
2126 if (roll_chance_f(std::max(0.0f, Probability)))
2127 CastSpell(victim, 1604, true);
2128 }
2129
2130 if (IsPlayer())
2131 {
2132 DamageInfo dmgInfo(*damageInfo);
2133 ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, dmgInfo.GetHitMask());
2134 }
2135
2136 // Do effect if any damage done to target
2137 if (damageInfo->damages[0].damage + damageInfo->damages[1].damage)
2138 DealDamageShieldDamage(victim);
2139}
@ CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN
Definition CreatureData.h:49
@ EMOTE_ONESHOT_WOUND_CRITICAL
Definition SharedDefines.h:1928
@ EMOTE_ONESHOT_PARRY_SHIELD
Definition SharedDefines.h:1934
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE
Definition SpellAuraDefines.h:250
@ CONFIG_ENABLE_DAZE
Definition WorldConfig.h:150
bool isWorldBoss() const
Definition Creature.h:123
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition Player.cpp:7460
uint32 GetUnitMeleeSkill(Unit const *target=nullptr) const
Definition Unit.h:1205
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition Unit.cpp:3525
bool IsInFlight() const
Definition Unit.h:1725
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2195
bool HasFlagsExtra(uint32 flag) const
Definition CreatureData.h:278
bool HasInArc(float arcangle, Position const *pos, float targetRadius=0.0f) const
Definition Position.cpp:148

References CalcDamageInfo::absorb, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, Player::CastItemCombatSpell(), CastSpell(), CalcDamageInfo::cleanDamage, CONFIG_ENABLE_DAZE, CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DealDamage(), DealDamageShieldDamage(), DIRECT_DAMAGE, EMOTE_ONESHOT_PARRY_SHIELD, EMOTE_ONESHOT_WOUND_CRITICAL, GetAttackTime(), getAttackTimer(), Creature::GetCreatureTemplate(), GetDefenseSkillValue(), DamageInfo::GetHitMask(), GetLevel(), GetRageWeaponSpeedHitFactor(), GetTotalAuraModifier(), GetUnitMeleeSkill(), HandleEmoteCommand(), HasActivePowerType(), CreatureTemplate::HasFlagsExtra(), Position::HasInArc(), HasOffhandWeaponForAttack(), CalcDamageInfo::HitInfo, HITINFO_CRITICALHIT, CalcDamageInfo::hitOutCome, IsAlive(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsInFlight(), Object::IsPlayer(), IsVehicle(), Creature::isWorldBoss(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_GLANCING, MELEE_HIT_NORMAL, OFF_ATTACK, POWER_RAGE, CalcDamageInfo::procVictim, CalcDamageInfo::resist, RewardRage(), roll_chance_f(), setAttackTimer(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, sWorld, CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToCreature(), Object::ToPlayer(), VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ DealSpellDamage()

void Unit::DealSpellDamage ( SpellNonMeleeDamage *  damageInfo,
bool  durabilityLoss,
Spell const *  spell = nullptr 
)
1652{
1653 if (damageInfo == 0)
1654 return;
1655
1656 Unit* victim = damageInfo->target;
1657
1658 if (!victim)
1659 return;
1660
1661 if (!victim->IsAlive() || victim->IsInFlight() || (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks()))
1662 return;
1663
1664 SpellInfo const* spellProto = damageInfo->spellInfo;
1665 if (!spellProto)
1666 {
1667 LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo");
1668 return;
1669 }
1670
1671 // Call default DealDamage
1672 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
1673 Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
1674}
SpellInfo const * spellInfo
Definition Unit.h:523

References SpellNonMeleeDamage::absorb, BASE_ATTACK, SpellNonMeleeDamage::cleanDamage, SpellNonMeleeDamage::damage, DealDamage(), IsAlive(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsInFlight(), LOG_DEBUG, MELEE_HIT_NORMAL, SpellNonMeleeDamage::schoolMask, SPELL_DIRECT_DAMAGE, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, and Object::ToCreature().

Referenced by Spell::DoAllEffectOnTarget(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ DelayOwnedAuras()

void Unit::DelayOwnedAuras ( uint32  spellId,
ObjectGuid  caster,
int32  delaytime 
)
5557{
5558 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5559 for (; range.first != range.second; ++range.first)
5560 {
5561 Aura* aura = range.first->second;
5562 if (!caster || aura->GetCasterGUID() == caster)
5563 {
5564 if (aura->GetDuration() < delaytime)
5565 aura->SetDuration(0);
5566 else
5567 aura->SetDuration(aura->GetDuration() - delaytime);
5568
5569 // update for out of range group members (on 1 slot use)
5571 LOG_DEBUG("spells.aura", "Aura {} partially interrupted on unit {}, new duration: {} ms", aura->GetId(), GetGUID().ToString(), aura->GetDuration());
5572 }
5573 }
5574}
int32 GetDuration() const
Definition SpellAuras.h:135
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1332
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:919
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition Unit.h:677

References Aura::GetCasterGUID(), Aura::GetDuration(), Object::GetGUID(), Aura::GetId(), LOG_DEBUG, m_ownedAuras, Aura::SetDuration(), Aura::SetNeedClientUpdateForTargets(), and Position::ToString().

◆ DeleteCharmInfo()

void Unit::DeleteCharmInfo ( )
12371{
12372 if (!m_charmInfo)
12373 return;
12374
12376 delete m_charmInfo;
12377 m_charmInfo = nullptr;
12378}
void RestoreState()
Definition CharmInfo.cpp:46

References m_charmInfo, and CharmInfo::RestoreState().

Referenced by RemoveCharmedBy().

◆ DeMorph()

void Unit::DeMorph ( )
4322{
4324}
virtual void SetDisplayId(uint32 modelId, std::optional< float > displayScale={})
Definition Unit.cpp:12853
uint32 GetNativeDisplayId() const
Definition Unit.h:1998

References GetNativeDisplayId(), and SetDisplayId().

Referenced by modify_commandscript::HandleMorphResetCommand().

◆ DisableRotate()

void Unit::DisableRotate ( bool  apply)
14234{
14235 if (!IsCreature())
14236 return;
14237
14238 if (apply)
14242}
@ UNIT_STATE_POSSESSED
Definition UnitDefines.h:189
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:754

References HasUnitState(), Object::IsCreature(), RemoveUnitFlag(), SetUnitFlag(), UNIT_FLAG_POSSESSED, and UNIT_STATE_POSSESSED.

Referenced by boss_ingvar_the_plunderer::DamageTaken(), boss_thorim::DisableThorim(), npc_black_knight_skeletal_gryphon::DoAction(), boss_yoggsaron_sara::EnableSara(), boss_anub_arak::EnterEvadeMode(), boss_devourer_of_souls::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_devourer_of_souls::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::Reset(), boss_kologarn::Reset(), boss_ingvar_the_plunderer::Reset(), boss_devourer_of_souls::SpellHitTarget(), boss_anub_arak::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ignis::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), and npc_black_knight_skeletal_gryphon::WaypointReached().

◆ DisableSpline()

◆ Dismount()

void Unit::Dismount ( )
10380{
10381 if (!IsMounted())
10382 return;
10383
10386
10387 if (Player* player = ToPlayer())
10388 {
10389 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
10390 data << GetPackGUID();
10391 data << player->GetSession()->GetOrderCounter(); // movement counter
10392 data << player->GetCollisionHeight();
10393 player->SendDirectMessage(&data);
10394 player->GetSession()->IncrementOrderCounter();
10395 }
10396
10397 WorldPacket data(SMSG_DISMOUNT, 8);
10398 data << GetPackGUID();
10399 SendMessageToSet(&data, true);
10400
10401 // dismount as a vehicle
10402 if (IsPlayer() && GetVehicleKit())
10403 {
10404 // Send other players that we are no longer a vehicle
10405 data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4);
10406 data << GetPackGUID();
10407 data << uint32(0);
10408 ToPlayer()->SendMessageToSet(&data, true);
10409 // Remove vehicle from player
10411 }
10412
10414
10415 // only resummon old pet if the player is already added to a map
10416 // this prevents adding a pet to a not created map which would otherwise cause a crash
10417 // (it could probably happen when logging in after a previous crash)
10418 if (Player* player = ToPlayer())
10419 {
10420 sScriptMgr->AnticheatSetUnderACKmount(player);
10421
10422 if (Pet* pPet = player->GetPet())
10423 {
10424 if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
10425 pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
10426 }
10427 else
10428 player->ResummonPetTemporaryUnSummonedIfAny();
10429
10430 // xinef: if we have charmed npc, remove stun also
10431 if (Unit* charm = player->GetCharm())
10432 if (charm->IsCreature() && !charm->HasUnitState(UNIT_STATE_STUNNED))
10433 charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
10434 }
10435
10436 UpdateSpeed(MOVE_RUN, true);
10437}
@ AURA_INTERRUPT_FLAG_NOT_MOUNTED
Definition SpellDefines.h:57
@ MOVE_RUN
Definition UnitDefines.h:357
@ UNIT_FLAG_STUNNED
Definition UnitDefines.h:275
@ UNIT_FLAG_MOUNT
Definition UnitDefines.h:284
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.cpp:5873
void RemoveVehicleKit()
Definition Unit.cpp:14705
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:10950
@ SMSG_PLAYER_VEHICLE_DATA
Definition Opcodes.h:1221
@ SMSG_MOVE_SET_COLLISION_HGT
Definition Opcodes.h:1332
@ SMSG_DISMOUNT
Definition Opcodes.h:970

References AURA_INTERRUPT_FLAG_NOT_MOUNTED, GetCharm(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), IsMounted(), Object::IsPlayer(), MOVE_RUN, RemoveAurasWithInterruptFlags(), RemoveUnitFlag(), RemoveVehicleKit(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), SetUInt32Value(), SMSG_DISMOUNT, SMSG_MOVE_SET_COLLISION_HGT, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, UNIT_FLAG_STUNNED, UNIT_STATE_STUNNED, and UpdateSpeed().

Referenced by _EnterVehicle(), Creature::AtEngage(), Player::CleanupAfterTaxiFlight(), FlightPathMovementGenerator::DoFinalize(), BattlegroundWS::EventPlayerClickedOnFlag(), AuraEffect::HandleAuraMounted(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), npc_koltira_deathweaver::MovementInform(), boss_captain_skarloc::MovementInform(), MotionMaster::MoveTaxiFlight(), spell_chapter5_light_of_dawn_aura::OnApply(), Creature::setDeathState(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), and npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI().

◆ EnergizeBySpell()

void Unit::EnergizeBySpell ( Unit *  victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
8215{
8216 victim->ModifyPower(powerType, damage, false);
8217
8218 // Happiness is internal hunter pet state, not combat assistance — energizing it must not generate threat
8219 if (powerType != POWER_HAPPINESS)
8220 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID))
8221 victim->GetThreatMgr().ForwardThreatForAssistingMe(this, float(damage) / 2.0f, spellInfo, true);
8222
8223 SendEnergizeSpellLog(victim, spellID, damage, powerType);
8224}
@ POWER_HAPPINESS
Definition SharedDefines.h:261
void ForwardThreatForAssistingMe(Unit *assistant, float baseAmount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false)
== AFFECT OTHERS' THREAT LISTS ==
Definition ThreatManager.cpp:797
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:8203
ThreatManager & GetThreatMgr()
Definition Unit.h:965

References ThreatManager::ForwardThreatForAssistingMe(), GetThreatMgr(), ModifyPower(), POWER_HAPPINESS, SendEnergizeSpellLog(), and sSpellMgr.

Referenced by Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerDrain(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ EngageWithTarget()

◆ EnterVehicle()

void Unit::EnterVehicle ( Unit *  base,
int8  seatId = -1 
)
15314{
15316
15317 if (Player* player = ToPlayer())
15318 {
15319 sScriptMgr->AnticheatSetUnderACKmount(player);
15320 }
15321}
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition SpellDefines.h:154
@ VEHICLE_SPELL_RIDE_HARDCODED
Definition VehicleDefines.h:52

References CastCustomSpell(), SPELLVALUE_BASE_POINT0, sScriptMgr, Object::ToPlayer(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, and VEHICLE_SPELL_RIDE_HARDCODED.

Referenced by debug_commandscript::HandleDebugEnterVehicleCommand(), WorldSession::HandleEnterPlayerVehicle(), boss_mimiron::JustEngagedWith(), boss_gormok::boss_gormokAI::SetGUID(), npc_pilgrims_bounty_chair::UpdateAI(), and boss_mimiron::UpdateAI().

◆ EnterVehicleUnattackable()

void Unit::EnterVehicleUnattackable ( Unit *  base,
int8  seatId = -1 
)

◆ ExecuteDelayedUnitAINotifyEvent()

void Unit::ExecuteDelayedUnitAINotifyEvent ( )
16169{
16171 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
16172 return;
16173
16174 Acore::AIRelocationNotifier notifier(*this);
16175 float radius = 60.0f;
16176 Cell::VisitObjects(this, notifier, radius);
16177}
@ NOTIFY_AI_RELOCATION
Definition Object.h:71
void RemoveFromNotify(uint16 f)
Definition Object.h:677
Definition GridNotifiers.h:91
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References IsDuringRemoveFromWorld(), Object::IsInWorld(), NOTIFY_AI_RELOCATION, WorldObject::RemoveFromNotify(), and Cell::VisitObjects().

Referenced by Update().

◆ ExecuteDelayedUnitRelocationEvent()

void Unit::ExecuteDelayedUnitRelocationEvent ( )
16068{
16070 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
16071 return;
16072
16073 if (this->HasSharedVision())
16074 for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr)
16075 if (Player* player = (*itr))
16076 {
16077 if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation)
16078 continue;
16079 WorldObject* viewPoint = player;
16080 if (player->m_seer && player->m_seer->IsInWorld())
16081 viewPoint = player->m_seer;
16082 if (!viewPoint->IsPositionValid() || !player->IsPositionValid())
16083 continue;
16084
16085 if (Unit* active = viewPoint->ToUnit())
16086 {
16087 //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated
16088 // active = player;
16089
16090 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
16091 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
16092 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
16093 float distsq = dx * dx + dy * dy + dz * dz;
16094 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
16095 if (distsq < mindistsq)
16096 continue;
16097
16098 // this will be relocated below sharedvision!
16099 //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
16100 }
16101
16102 Acore::PlayerRelocationNotifier notifier(*player);
16103 Cell::VisitObjects(viewPoint, notifier, player->GetSightRange());
16105 notifier.SendToSelf();
16106 }
16107
16108 if (Player* player = this->ToPlayer())
16109 {
16110 WorldObject* viewPoint = player;
16111 if (player->m_seer && player->m_seer->IsInWorld())
16112 viewPoint = player->m_seer;
16113
16114 if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid())
16115 return;
16116
16117 if (Unit* active = viewPoint->ToUnit())
16118 {
16119 if (active->IsVehicle())
16120 active = player;
16121
16122 if (!player->GetFarSightDistance())
16123 {
16124 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
16125 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
16126 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
16127 float distsq = dx * dx + dy * dy + dz * dz;
16128
16129 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
16130 if (distsq < mindistsq)
16131 return;
16132
16133 active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
16134 }
16135 }
16136
16138
16139 Acore::PlayerRelocationNotifier notifier(*player);
16140 Cell::VisitObjects(player->GetSightPosition().GetPositionX(), player->GetSightPosition().GetPositionY(), player->GetMap(), notifier, player->GetSightRange());
16141 Cell::VisitFarVisibleObjects(player->GetSightPosition().GetPositionX(), player->GetSightPosition().GetPositionY(), player->GetMap(), notifier, VISIBILITY_DISTANCE_GIGANTIC);
16142 notifier.SendToSelf();
16143
16145 }
16146 else if (Creature* unit = this->ToCreature())
16147 {
16148 if (!unit->IsPositionValid())
16149 return;
16150
16151 float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX();
16152 float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY();
16153 float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ();
16154 float distsq = dx * dx + dy * dy + dz * dz;
16155 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type);
16156 if (distsq < mindistsq)
16157 return;
16158
16159 unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
16160
16161 Acore::CreatureRelocationNotifier relocate(*unit);
16162 Cell::VisitObjects(unit, relocate, unit->GetVisibilityRange());
16163
16165 }
16166}
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
#define VISIBILITY_DISTANCE_GIGANTIC
Definition ObjectDefines.h:34
@ NOTIFY_VISIBILITY_CHANGED
Definition Object.h:72
static float GetReqMoveDistSq(uint32 map_type)
Definition DynamicVisibility.h:53
void LoadGridsInRange(Position const &center, float radius)
Definition Map.cpp:228
Unit * ToUnit()
Definition Object.h:216
SharedVisionList const & GetSharedVisionList()
Definition Unit.h:1898
bool HasSharedVision() const
Definition Unit.h:1901
uint32 GetMapId() const
Definition Position.h:281
Definition Object.h:482
void AddToNotify(uint16 f)
Definition Object.cpp:3086
Definition GridNotifiers.h:83
Definition GridNotifiers.h:74
static void VisitFarVisibleObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:181
bool IsPositionValid() const
Definition Position.cpp:183

References WorldObject::AddToNotify(), WorldObject::GetMap(), WorldLocation::GetMapId(), Position::GetPositionX(), DynamicVisibilityMgr::GetReqMoveDistSq(), GetSharedVisionList(), HasSharedVision(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Position::IsPositionValid(), Map::LoadGridsInRange(), MAX_VISIBILITY_DISTANCE, NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, WorldObject::RemoveFromNotify(), Acore::VisibleNotifier::SendToSelf(), Object::ToCreature(), Object::ToPlayer(), Object::ToUnit(), VISIBILITY_DISTANCE_GIGANTIC, Cell::VisitFarVisibleObjects(), and Cell::VisitObjects().

◆ ExitVehicle()

void Unit::ExitVehicle ( Position const *  exitPosition = nullptr)

This function can be called at upper level code to initialize an exit from the passenger's side.

The following call would not even be executed successfully as the SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without specifying an exitposition. The subsequent call below would return on if (!m_vehicle).

To do: We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts to specify exit coordinates and either store those per passenger, or we need to init spline movement based on those coordinates in unapply handlers, and relocate exiting passengers based on Unit::moveSpline data. Either way, Coming Soon(TM)

15410{
15412 if (!m_vehicle)
15413 return;
15414
15416 if (Player* player = ToPlayer())
15417 {
15418 player->SetCanTeleport(true);
15419 }
15423 /*_ExitVehicle(exitPosition);*/
15430
15431 if (Player* player = ToPlayer())
15432 {
15433 sScriptMgr->AnticheatSetUnderACKmount(player);
15434 }
15435}
Unit * GetVehicleBase() const
Definition Unit.cpp:14720

References Object::GetGUID(), GetVehicleBase(), m_vehicle, RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, sScriptMgr, and Object::ToPlayer().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), MotionTransport::DelayedTeleportTransport(), boss_mimiron::EnterEvadeMode(), npc_ulduar_leviathan_mkii::EnterEvadeMode(), npc_ulduar_vx001::EnterEvadeMode(), npc_ulduar_aerial_command_unit::EnterEvadeMode(), boss_yoggsaron_sara::EnterEvadeMode(), WorldSession::HandleDismissControlledVehicle(), spell_warhead_detonate::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_ulduar_squeezed_lifeless::HandleInstaKill(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleRequestVehicleExit(), spell_vehicle_throw_passenger::HandleScript(), spell_vehicle_grab_pyrite::HandleScript(), npc_snobold_vassal::npc_snobold_vassalAI::JustDied(), boss_kologarn_arms::JustDied(), Player::KillPlayer(), spell_dragonblight_devour_ghoul_periodic::OnRemove(), Player::ProcessDelayedOperations(), RemoveFromWorld(), Player::StopCastingCharm(), and Player::TeleportTo().

◆ FindCurrentSpellBySpellId()

◆ FinishSpell()

void Unit::FinishSpell ( CurrentSpellTypes  spellType,
bool  ok = true 
)
4031{
4032 Spell* spell = m_currentSpells[spellType];
4033 if (!spell)
4034 return;
4035
4036 if (spellType == CURRENT_CHANNELED_SPELL)
4037 spell->SendChannelUpdate(0);
4038
4039 spell->finish(ok);
4040}
void SendChannelUpdate(uint32 time)
Definition Spell.cpp:5395

References CURRENT_CHANNELED_SPELL, Spell::finish(), m_currentSpells, and Spell::SendChannelUpdate().

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), boss_lord_marrowgar::UpdateAI(), and GameObject::Use().

◆ FollowerAdded()

void Unit::FollowerAdded ( AbstractFollower *  f)
inline
1915{ m_followingMe.insert(f); }
std::unordered_set< AbstractFollower * > m_followingMe
Definition Unit.h:2263

References m_followingMe.

Referenced by AbstractFollower::SetTarget().

◆ FollowerRemoved()

void Unit::FollowerRemoved ( AbstractFollower *  f)
inline
1916{ m_followingMe.erase(f); }

References m_followingMe.

Referenced by AbstractFollower::SetTarget().

◆ GetAffectingPlayer()

Player * Unit::GetAffectingPlayer ( ) const
7560{
7561 if (!GetCharmerOrOwnerGUID())
7562 return const_cast<Unit*>(this)->ToPlayer();
7563
7564 if (Unit* owner = GetCharmerOrOwner())
7566
7567 return nullptr;
7568}
ObjectGuid GetCharmerOrOwnerGUID() const override
Definition Unit.h:1312

References GetCharmerOrOwner(), GetCharmerOrOwnerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), and Object::ToPlayer().

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), SpellInfo::CheckTarget(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), and AuraEffect::HandleRaidProcFromChargeWithValueAuraProc().

◆ GetAI()

UnitAI * Unit::GetAI ( )
inline
699{ return i_AI; }

References i_AI.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), spell_algalon_big_bang::CheckTargets(), DealDamage(), DealHeal(), CombatReference::EndCombat(), spell_send_mug_target_picker::FilterTargets(), spell_blood_queen_bloodbolt::FilterTargets(), spell_kologarn_focused_eyebeam::FilterTargetsInitial(), npc_dream_fog::npc_dream_fogAI::GetRandomUnitFromDragonThreatList(), WorldState::HandleActiveZone(), BattlegroundIC::HandleCapturedNodes(), spell_send_mug_target_picker::HandleDummy(), spell_fatal_strike::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyApply(), spell_mount_check_aura::HandleEffectPeriodic(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), spell_random_aggro::HandleOnHit(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_grip::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_pursue::HandleScript(), spell_the_lich_king_quake::HandleSendEvent(), spell_black_knight_ghoul_claw::HandleSpellHit(), npc_risen_guardian::npc_risen_guardianAI::IsSummonedBy(), npc_risen_guardian::npc_risen_guardianAI::KilledUnit(), ModifyPower(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), CombatManager::NotifyAICombat(), spell_claw_swipe_check::OnApply(), achievement_respect_your_elders::OnCheck(), achievement_hadronox_denied::OnCheck(), achievement_watch_him_die::OnCheck(), achievement_better_off_dred::OnCheck(), achievement_oh_novos::OnCheck(), achievement_share_the_love::OnCheck(), achievement_snakes_whyd_it_have_to_be_snakes::OnCheck(), achievement_im_on_a_boat::OnCheck(), achievement_all_you_can_eat::OnCheck(), achievement_been_waiting_long_time::OnCheck(), achievement_neck_deep_in_vile::OnCheck(), achievement_portal_jockey::OnCheck(), achievement_chaos_theory::OnCheck(), achievement_split_personality::OnCheck(), achievement_algalon_he_feeds_on_your_tears::OnCheck(), achievement_algalon_herald_of_the_titans::OnCheck(), achievement_flame_leviathan_towers::OnCheck(), achievement_flame_leviathan_shutout::OnCheck(), achievement_freya_getting_back_to_nature::OnCheck(), achievement_freya_knock_on_wood::OnCheck(), achievement_iron_dwarf_medium_rare::OnCheck(), achievement_nerf_engineering::OnCheck(), achievement_heartbreaker::OnCheck(), achievement_nerf_gravity_bombs::OnCheck(), achievement_yogg_saron_drive_me_crazy::OnCheck(), achievement_yogg_saron_kiss_and_make_up::OnCheck(), achievement_intense_cold::OnCheck(), achievement_once_bitten_twice_shy::OnCheck(), spell_xt002_gravity_bomb_aura::OnPeriodic(), spell_grip::OnRemove(), spell_claw_swipe_check::OnRemove(), RemoveFromWorld(), npc_dark_fiend::Reset(), spell_marrowgar_coldflame::SelectTarget(), boss_yoggsaron_immortal_guardian::SpellHit(), CombatReference::SuppressFor(), CombatManager::SuppressPvPCombat(), and CombatManager::Update().

◆ GetAllMinionsByEntry()

void Unit::GetAllMinionsByEntry ( std::list< Creature * > &  Minions,
uint32  entry 
)
7786{
7787 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
7788 {
7789 Unit* unit = *itr;
7790 ++itr;
7791 if (unit->GetEntry() == entry && unit->IsCreature()
7792 && unit->ToCreature()->IsSummon()) // minion, actually
7793 Minions.push_back(unit->ToCreature());
7794 }
7795}
bool IsSummon() const
Definition Unit.h:800

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, and Object::ToCreature().

Referenced by spell_item_gift_of_the_harvester::CheckRequirement(), spell_dk_dancing_rune_weapon::HandleApply(), and spell_gen_ethereal_pet_aura::HandleProc().

◆ GetAPMultiplier()

float Unit::GetAPMultiplier ( WeaponAttackType  attType,
bool  normalized 
)
13323{
13324 if (!normalized || !IsPlayer())
13325 return float(GetAttackTime(attType)) / 1000.0f;
13326
13327 Item* Weapon = ToPlayer()->GetWeaponForAttack(attType, true);
13328 if (!Weapon)
13329 return 2.4f; // fist attack
13330
13331 switch (Weapon->GetTemplate()->InventoryType)
13332 {
13333 case INVTYPE_2HWEAPON:
13334 return 3.3f;
13335 case INVTYPE_RANGED:
13337 case INVTYPE_THROWN:
13338 return 2.8f;
13339 case INVTYPE_WEAPON:
13342 default:
13343 return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
13344 }
13345}
@ ITEM_SUBCLASS_WEAPON_DAGGER
Definition ItemTemplate.h:359
@ INVTYPE_RANGED
Definition ItemTemplate.h:271
@ INVTYPE_THROWN
Definition ItemTemplate.h:281
@ INVTYPE_RANGEDRIGHT
Definition ItemTemplate.h:282
@ INVTYPE_WEAPON
Definition ItemTemplate.h:269
@ INVTYPE_WEAPONMAINHAND
Definition ItemTemplate.h:277
@ INVTYPE_WEAPONOFFHAND
Definition ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
Weapon
Definition boss_arlokk.cpp:67
Definition Item.h:220
ItemTemplate const * GetTemplate() const
Definition Item.cpp:538
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:492
uint32 SubClass
Definition ItemTemplate.h:622

References GetAttackTime(), Item::GetTemplate(), Player::GetWeaponForAttack(), INVTYPE_2HWEAPON, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_THROWN, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, Object::IsPlayer(), ITEM_SUBCLASS_WEAPON_DAGGER, ItemTemplate::SubClass, and Object::ToPlayer().

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and MeleeDamageBonusDone().

◆ GetAppliedAuras() [1/2]

◆ GetAppliedAuras() [2/2]

AuraApplicationMap const & Unit::GetAppliedAuras ( ) const
inline
1401{ return m_appliedAuras; }

References m_appliedAuras.

◆ GetArmor()

◆ getAttackerForHelper()

Unit * Unit::getAttackerForHelper ( ) const

◆ getAttackers()

◆ GetAttackTime()

◆ getAttackTimer()

int32 Unit::getAttackTimer ( WeaponAttackType  type) const
inline
894{ return m_attackTimer[type]; }

References m_attackTimer.

Referenced by _UpdateAutoRepeatSpell(), Attack(), DealMeleeDamage(), TEST_F(), and Update().

◆ GetAura()

Aura * Unit::GetAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5676{
5677 AuraApplication* aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
5678 return aurApp ? aurApp->GetBase() : nullptr;
5679}
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5656

References GetAuraApplication(), and AuraApplication::GetBase().

Referenced by Player::_addSpell(), Pet::addSpell(), Player::ApplyEquipCooldown(), spell_freezing_cloud_damage::CanBeAppliedOn(), spell_mage_burning_determination::CheckProc(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_freya::DoAction(), Spell::DoTriggersOnSpellHit(), Spell::EffectScriptEffect(), Spell::EffectTitanGrip(), Spell::EffectWeaponDmg(), spell_yogg_saron_sanity_reduce::FilterTargets(), getOrphanGUID(), spell_rog_mutilate::HandleAfterCast(), spell_dk_scourge_strike::HandleAfterHit(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleAuraStacksCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_karazhan_wrath_titans_stacker::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_yogg_saron_sanity_well_aura::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_sindragosa_frost_breath::HandleInfusion(), spell_mage_glyph_of_polymorph::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_unstable_experiment::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_freya_attuned_to_nature_dose_reduction::HandleScript(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), npc_gunship::npc_gunshipAI::JustDied(), npc_nerubar_victim::JustDied(), boss_high_nethermancer_zerevor::JustEngagedWith(), npc_brew_bubble::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), spell_summoning_rhyme_aura::PeriodicTick(), Player::ProcessDelayedOperations(), BattlefieldWG::PromotePlayer(), RemoveAurasDueToSpellBySteal(), spell_halion_twilight_cutter::RemoveNotBetween(), Player::ResurrectPlayer(), SetAuraStack(), boss_anomalus::SetData(), npc_ulduar_iron_construct::SpellHit(), npc_pilgrims_bounty_chair::SpellHit(), boss_jaraxxus::SpellHit(), boss_sindragosa::boss_sindragosaAI::SpellHitTarget(), npc_ulduar_hodir_shaman::SpellHitTarget(), npc_twilight_summon::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ GetAuraApplication()

AuraApplication * Unit::GetAuraApplication ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication *  except = nullptr 
) const
5657{
5658 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5659 for (; range.first != range.second; ++range.first)
5660 {
5661 AuraApplication* app = range.first->second;
5662 Aura const* aura = app->GetBase();
5663
5664 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5665 && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5666 && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
5667 && (!except || except != app))
5668 {
5669 return app;
5670 }
5671 }
5672 return nullptr;
5673}
uint8 GetEffectMask() const
Definition SpellAuras.h:179
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:104
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition Unit.h:680

References AuraApplication::GetBase(), Aura::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetEffectMask(), and m_appliedAuras.

Referenced by AuraApplication::_Remove(), GetAura(), GetAuraApplicationOfRankedSpell(), HasAura(), and Spell::UpdateChanneledTargetList().

◆ GetAuraApplicationOfRankedSpell()

AuraApplication * Unit::GetAuraApplicationOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication *  except = nullptr 
) const
5682{
5683 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5684 while (rankSpell)
5685 {
5686 if (AuraApplication* aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
5687 return aurApp;
5688 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5689 }
5690 return nullptr;
5691}

References GetAuraApplication(), and sSpellMgr.

Referenced by spell_warl_drain_soul::CheckProc(), spell_warl_improved_drain_soul::CheckProc(), and GetAuraOfRankedSpell().

◆ GetAuraCount()

uint32 Unit::GetAuraCount ( uint32  spellId) const
5777{
5778 uint32 count = 0;
5779 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5780
5781 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5782 {
5783 if (itr->second->GetBase()->GetStackAmount() == 0)
5784 ++count;
5785 else
5786 count += (uint32)itr->second->GetBase()->GetStackAmount();
5787 }
5788
5789 return count;
5790}

References m_appliedAuras.

Referenced by spell_ruby_sanctum_rallying_shout::CountAllies(), npc_brew_bubble::MoveInLineOfSight(), spell_valithria_suppression_aura::OnApply(), achievement_consumption_junction::OnCheck(), achievement_assembly_of_iron::OnCheck(), achievement_cant_do_that_while_stunned::OnCheck(), spell_valithria_suppression_aura::OnRemove(), SmartScript::ProcessEvent(), boss_pyroguard_emberseer::SpellHit(), spell_black_temple_spell_absorption_aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ GetAuraEffect() [1/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5629{
5630 AuraEffectList const& auras = GetAuraEffectsByType(type);
5631 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5632 {
5633 SpellInfo const* spell = (*i)->GetSpellInfo();
5634 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5635 {
5636 if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
5637 continue;
5638 return (*i);
5639 }
5640 }
5641 return nullptr;
5642}
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
uint32 SpellFamilyName
Definition SpellInfo.h:411
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:459

References GetAuraEffectsByType(), flag96::HasFlag(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

◆ GetAuraEffect() [2/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  name,
uint32  iconId,
uint8  effIndex 
) const
5615{
5616 AuraEffectList const& auras = GetAuraEffectsByType(type);
5617 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5618 {
5619 if (effIndex != (*itr)->GetEffIndex())
5620 continue;
5621 SpellInfo const* spell = (*itr)->GetSpellInfo();
5622 if (spell->SpellIconID == iconId && spell->SpellFamilyName == name)
5623 return *itr;
5624 }
5625 return nullptr;
5626}
uint32 SpellIconID
Definition SpellInfo.h:404

References GetAuraEffectsByType(), SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

◆ GetAuraEffect() [3/3]

AuraEffect * Unit::GetAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5589{
5590 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5591 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5592 {
5593 if (itr->second->HasEffect(effIndex)
5594 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5595 {
5596 return itr->second->GetBase()->GetEffect(effIndex);
5597 }
5598 }
5599 return nullptr;
5600}

References AuraEffect::GetBase(), Aura::GetEffect(), and m_appliedAuras.

Referenced by CalculateSpellAmount(), spell_mage_ice_barrier::CheckCast(), spell_pri_power_word_shield::CheckCast(), spell_mage_molten_armor::CheckProc(), spell_mage_gen_extra_effects::CheckProc(), spell_mage_missile_barrage_proc::CheckProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), GetAuraEffectOfRankedSpell(), GetDummyAuraEffect(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_sha_maelstrom_weapon::HandleBonus(), spell_dk_raise_ally::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_execute::HandleEffect(), spell_dru_nourish::HandleHeal(), AuraEffect::HandlePeriodicHealAurasTick(), spell_rog_cut_to_the_chase::HandleProc(), spell_pal_sacred_shield_dummy::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_dk_unholy_blight::HandleProc(), spell_dru_glyph_of_shred::HandleProc(), spell_hun_thrill_of_the_hunt::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_persistent_shield::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_rog_glyph_of_backstab::HandleProc(), spell_sha_glyph_of_earth_shield::HandleProc(), spell_sha_imp_water_shield::HandleProc(), spell_sha_static_shock::HandleProc(), spell_sha_t10_elemental_4p_bonus::HandleProc(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_sha_stoneclaw_totem::HandleScriptEffect(), spell_pal_seal_of_vengeance_aura::HandleSeal(), AuraEffect::HandleShapeshiftBoosts(), spell_warl_drain_soul::HandleTick(), HasJudgementsOfTheJust(), npc_pet_dk_ebon_gargoyle::InitializeAI(), Guardian::InitStatsForLevel(), npc_anzu_spirit::IsSummonedBy(), WorldObject::ModSpellDuration(), spell_dk_death_and_decay::RecalculateDamage(), RemoveAurasDueToSpellByDispel(), SpellDamageBonusDone(), SpellHealingBonusTaken(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), and npc_hallows_end_train_fire::UpdateAI().

◆ GetAuraEffectDummy()

AuraEffect * Unit::GetAuraEffectDummy ( uint32  spellid) const
5645{
5647 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5648 {
5649 if ((*itr)->GetId() == spellid)
5650 return *itr;
5651 }
5652
5653 return nullptr;
5654}
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67

References GetAuraEffectsByType(), and SPELL_AURA_DUMMY.

Referenced by Spell::EffectWeaponDmg(), Aura::HandleAuraSpecificMods(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), Kill(), and spell_dk_death_and_decay::RecalculateDamage().

◆ GetAuraEffectOfRankedSpell()

AuraEffect * Unit::GetAuraEffectOfRankedSpell ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5603{
5604 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5605 while (rankSpell)
5606 {
5607 if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
5608 return aurEff;
5609 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5610 }
5611 return nullptr;
5612}
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5588

References GetAuraEffect(), and sSpellMgr.

Referenced by spell_mage_fire_frost_ward::Absorb(), spell_sha_earthbind_totem::Apply(), spell_sha_earthliving_weapon::CheckProc(), GetDiseasesByCaster(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), Aura::HandleAuraSpecificMods(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_mage_imp_blizzard::HandleProc(), spell_warl_soul_leech::HandleProc(), SpellPctDamageModsDone(), and spell_mage_incanters_absorbtion_base_AuraScript::Trigger().

◆ GetAuraEffectsByType()

AuraEffectList const & Unit::GetAuraEffectsByType ( AuraType  type) const
inline
1445{ return m_modAuras[type]; }

References m_modAuras.

Referenced by Spell::_cast(), Player::ActivateSpec(), CalcAbsorbResist(), CalcArmorReducedDamage(), CalcHealAbsorb(), AuraEffect::CalculateAmount(), Spell::CanAutoCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), DealDamage(), DealDamageShieldDamage(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), RedirectSpellEvent::Execute(), spell_dk_wandering_plague::FilterTargets(), GetAuraEffect(), GetAuraEffect(), GetAuraEffectDummy(), GetDoTsByCaster(), GetHighestExclusiveSameEffectSpellGroupValue(), GetMagicHitRedirectTarget(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetMeleeHitRedirectTarget(), GetPhaseByAuras(), Player::GetResurrectionSpellId(), Player::GetRuneBaseCooldown(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), AuraEffect::HandleDetectAmore(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dru_nourish::HandleHeal(), Spell::HandleLaunchPhase(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), spell_warr_heroic_strike::HandleOnHit(), spell_illidari_council_judgement::HandleScriptEffect(), spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HasAuraState(), HasAuraTypeWithAffectMask(), HasAuraTypeWithCaster(), HasAuraTypeWithFamilyFlags(), HasAuraTypeWithMiscvalue(), HasAuraTypeWithTriggerSpell(), HasAuraTypeWithValue(), HasBreakableByDamageAuraType(), HasVisibleAuraType(), IsHighestExclusiveAuraEffect(), IsImmunedToSpellEffect(), IsScriptOverriden(), Player::isTotalImmune(), list_commandscript::ListAurasCommand(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Spell::PrepareTriggersExecutedOnHit(), processDummyAuras(), spell_dru_enrage::RecalculateBaseArmor(), Player::RegenerateAll(), Creature::Respawn(), RestoreDisplayId(), PetAI::SelectNextTarget(), Creature::SelectVictim(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetEntryPoint(), Player::SetSkill(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusTaken(), SpellDoneCritChance(), SpellHealingBonusDone(), SpellHealingBonusTaken(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), Player::SummonPet(), ThreatManager::TauntUpdate(), SimpleCharmedAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), Player::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCharmedAI(), Player::UpdateManaRegen(), ThreatManager::UpdateMyTempModifiers(), Player::UpdateRating(), Player::UpdateResistances(), UpdateSpeed(), and Player::UpdateStats().

◆ GetAuraOfRankedSpell()

Aura * Unit::GetAuraOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5694{
5695 AuraApplication* aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
5696 return aurApp ? aurApp->GetBase() : nullptr;
5697}
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5681

References GetAuraApplicationOfRankedSpell(), and AuraApplication::GetBase().

Referenced by spell_sha_clearcasting::CalculateAmount(), spell_pal_improved_aura_effect::CheckAreaTarget(), spell_pal_sanctified_retribution_effect::CheckAreaTarget(), spell_rog_mutilate::HandleAfterCast(), Aura::HandleAuraSpecificMods(), spell_warr_execute::HandleEffect(), spell_dk_pestilence::HandleScriptEffect(), and spell_mage_missile_barrage_proc::OnRemove().

◆ GetBoundaryRadius()

float Unit::GetBoundaryRadius ( ) const
inline

◆ GetCastingTimeForBonus()

uint32 Unit::GetCastingTimeForBonus ( SpellInfo const *  spellProto,
DamageEffectType  damagetype,
uint32  CastingTime 
) const
13183{
13184 // Not apply this to creature casted spells with casttime == 0
13185 if (CastingTime == 0 && IsCreature() && !IsPet())
13186 return 3500;
13187
13188 if (CastingTime > 7000) CastingTime = 7000;
13189 if (CastingTime < 1500) CastingTime = 1500;
13190
13191 if (damagetype == DOT && !spellProto->IsChanneled())
13192 CastingTime = 3500;
13193
13194 int32 overTime = 0;
13195 uint8 effects = 0;
13196 bool DirectDamage = false;
13197 bool AreaEffect = false;
13198
13199 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
13200 {
13201 switch (spellProto->Effects[i].Effect)
13202 {
13208 case SPELL_EFFECT_HEAL:
13209 DirectDamage = true;
13210 break;
13212 switch (spellProto->Effects[i].ApplyAuraName)
13213 {
13217 if (spellProto->GetDuration())
13218 overTime = spellProto->GetDuration();
13219 break;
13220 default:
13221 // -5% per additional effect
13222 ++effects;
13223 break;
13224 }
13225 default:
13226 break;
13227 }
13228
13229 if (spellProto->Effects[i].IsTargetingArea())
13230 AreaEffect = true;
13231 }
13232
13233 // Combined Spells with Both Over Time and Direct Damage
13234 if (overTime > 0 && DirectDamage)
13235 {
13236 // mainly for DoTs which are 3500 here otherwise
13237 uint32 OriginalCastTime = spellProto->CalcCastTime();
13238 if (OriginalCastTime > 7000) OriginalCastTime = 7000;
13239 if (OriginalCastTime < 1500) OriginalCastTime = 1500;
13240 // Portion to Over Time
13241 float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
13242
13243 if (damagetype == DOT)
13244 CastingTime = uint32(CastingTime * PtOT);
13245 else if (PtOT < 1.0f)
13246 CastingTime = uint32(CastingTime * (1 - PtOT));
13247 else
13248 CastingTime = 0;
13249 }
13250
13251 // Area Effect Spells receive only half of bonus
13252 if (AreaEffect)
13253 CastingTime /= 2;
13254
13255 // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
13256 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
13257 {
13258 if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
13259 (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
13260 {
13261 CastingTime /= 2;
13262 break;
13263 }
13264 }
13265
13266 // -5% of total per any additional effect
13267 for (uint8 i = 0; i < effects; ++i)
13268 CastingTime *= 0.95f;
13269
13270 return CastingTime;
13271}
@ SPELL_EFFECT_POWER_BURN
Definition SharedDefines.h:828
@ SPELL_EFFECT_HEALTH_LEECH
Definition SharedDefines.h:775
@ SPELL_EFFECT_HEAL
Definition SharedDefines.h:776
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition SharedDefines.h:773
@ SPELL_EFFECT_POWER_DRAIN
Definition SharedDefines.h:774
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:768
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:772
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116

References SpellInfo::CalcCastTime(), DOT, SpellInfo::Effects, SpellInfo::GetDuration(), SpellInfo::IsChanneled(), Object::IsCreature(), IsPet(), MAX_SPELL_EFFECTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, and SPELL_EFFECT_SCHOOL_DAMAGE.

Referenced by CalculateDefaultCoefficient().

◆ GetCharm()

Unit * Unit::GetCharm ( ) const
7606{
7607 if (ObjectGuid charm_guid = GetCharmGUID())
7608 {
7609 if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
7610 return pet;
7611
7612 LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature {} not exist.", charm_guid.ToString());
7614 }
7615
7616 return nullptr;
7617}
@ UNIT_FIELD_CHARM
Definition UpdateFields.h:86
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:721
ObjectGuid GetCharmGUID() const
Definition Unit.h:727
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223

References ObjectGuid::Empty, GetCharmGUID(), ObjectAccessor::GetUnit(), LOG_ERROR, Object::SetGuidValue(), and UNIT_FIELD_CHARM.

Referenced by Spell::_cast(), AddPetAura(), spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Dismount(), Spell::finish(), GetFirstControlled(), spell_warl_eye_of_kilrogg::HandleAuraApply(), spell_warl_eye_of_kilrogg::HandleAuraRemove(), WorldSession::HandleBattleFieldPortOpcode(), spell_dk_raise_ally::HandleDummy(), spell_riding_jokkum::HandleEffectRemove(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandleRequestPetInfo(), isPossessing(), Mount(), Player::PossessSpellInitialize(), RemovePetAura(), SetSpeed(), npc_pilgrims_bounty_chair::SpellHitTarget(), Player::StopCastingCharm(), and lfg::LFGMgr::TeleportPlayer().

◆ GetCharmer()

◆ GetCharmerGUID()

◆ GetCharmerOrOwner()

◆ GetCharmerOrOwnerGUID()

◆ GetCharmerOrOwnerOrOwnGUID()

ObjectGuid Unit::GetCharmerOrOwnerOrOwnGUID ( ) const
inline

◆ GetCharmerOrOwnerOrSelf()

Unit * Unit::GetCharmerOrOwnerOrSelf ( ) const
inline
1305 {
1306 if (Unit* u = GetCharmerOrOwner())
1307 return u;
1308
1309 return (Unit*)this;
1310 }

References GetCharmerOrOwner().

Referenced by GetPartyMembers(), GetReactionTo(), IsInPartyWith(), IsInRaidWith(), and TotemAI::UpdateAI().

◆ GetCharmerOrOwnerPlayerOrPlayerItself()

Player * Unit::GetCharmerOrOwnerPlayerOrPlayerItself ( ) const
7551{
7553 if (guid.IsPlayer())
7554 return ObjectAccessor::GetPlayer(*this, guid);
7555
7556 return const_cast<Unit*>(this)->ToPlayer();
7557}
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:244

References GetCharmerOrOwnerGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), Creature::AddSpellCooldown(), spell_sha_earthbind_totem::Apply(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), AtTargetAttacked(), BuildValuesUpdate(), CombatManager::CanBeginCombat(), spell_q12237_rescue_villager::CheckCast(), spell_q12237_drop_off_villager::CheckCast(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), DealDamage(), Spell::EffectGameObjectSetDestructionState(), Spell::EffectKillCredit(), Spell::EffectKillCreditPersonal(), Spell::EffectSummonPet(), WorldObject::GetAffectingPlayer(), GetAffectingPlayer(), Object::GetUpdateFieldData(), AuraEffect::HandleAuraDummy(), spell_gen_charmed_unit_spell_cooldown::HandleCast(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_q12726_song_of_wind_and_water::HandleHealPct(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_q10769_dissension_amongst_the_ranks::HandleScriptEffect(), npc_pet_gen_valkyr_guardian::InitializeAI(), isTargetableForAttack(), GuardAI::JustDied(), boss_kurinnaxx::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_four_car_garage::npc_four_car_garageAI::JustDied(), npc_scion_of_eternity::JustDied(), npc_nerubar_victim::JustDied(), boss_skeram::JustEngagedWith(), Kill(), Condition::Meets(), GameObject::ModifyHealth(), npc_amanishi_lookout::MoveInLineOfSight(), npc_eagle_trash_aggro_trigger::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), Creature::RemoveSpellCooldown(), Spell::SendSpellCooldown(), SetCharm(), SetContestedPvP(), Creature::SetLootRecipient(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), npc_salvaged_chopper::SwapActionButton(), npc_scarlet_ghoul::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), and npc_pet_shaman_fire_elemental::UpdateAI().

◆ GetCharmGUID()

◆ GetCharmInfo()

◆ getClass()

uint8 Unit::getClass ( ) const
inline
849{ return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
@ UNIT_FIELD_BYTES_0
Definition UpdateFields.h:95
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:321

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), ArenaTeam::AddMember(), lfg::BuildRBInternalInfo(), SpellEffectInfo::CalcValue(), spell_dk_advantage_t10_4p::CheckProc(), spell_dk_death_rune::CheckProc(), Player::CheckSkillLearnedBySpell(), spell_class_call_handler::FilterTargets(), getClassMask(), GetDebugInfo(), Player::GetDodgeFromAgility(), SocialMgr::GetFriendInfo(), Player::GetMeleeCritFromAgility(), Player::GetMissPercentageFromDefence(), Player::GetPlayerName(), Player::GetRatingMultiplier(), Player::GetSpec(), Player::GetSpellCritFromIntellect(), Player::GetStartPosition(), Player::GiveLevel(), spell_item_flask_of_the_north::HandleDummy(), learn_commandscript::HandleLearnAllMyTrainerSpellsCommand(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_item_soul_preserver::HandleProc(), spell_item_aura_of_madness::HandleProc(), spell_item_deathbringers_will_normal::HandleProc(), spell_item_deathbringers_will_heroic::HandleProc(), spell_item_sunwell_exalted_caster_neck::HandleProc(), spell_pal_t3_6p_bonus::HandleProc(), spell_sha_t3_6p_bonus::HandleProc(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDataForForm(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsClass(), IsClass(), Player::IsSpellFitByClassAndRace(), Trainer::Trainer::IsTrainerValidForPlayer(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), spell_dk_death_rune::Load(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), ClassCallSelector::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Guild::Member::SetStats(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Player::StoreNewItemInBestSlots(), Player::UpdateDodgePercentage(), Player::UpdateParryPercentage(), and Player::UpdateSkillsForLevel().

◆ getClassMask()

◆ GetClientControlling()

Player const * Unit::GetClientControlling ( ) const
17159{
17160 // Serverside reverse "mover" deduction logic at controlled unit
17161
17162 // Applies only to player controlled units
17164 {
17165 // Charm always removes control from original client...
17166 if (GetCharmerGUID())
17167 {
17168 // ... but if it is a possessing charm, some other client may have control
17170 {
17171 Unit const* charmer = GetCharmer();
17172 if (charmer && charmer->IsPlayer())
17173 return static_cast<Player const*>(charmer);
17174 }
17175 }
17176 else if (IsPlayer())
17177 {
17178 // Check if anything prevents original client from controlling
17179 if (IsClientControlled(static_cast<Player const*>(this)))
17180 return static_cast<Player const*>(this);
17181 }
17182 }
17183 return nullptr;
17184}
bool IsClientControlled(Player const *exactClient=nullptr) const
Definition Unit.cpp:17131

References GetCharmer(), GetCharmerGUID(), Object::HasFlag(), IsClientControlled(), Object::IsPlayer(), UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_FLAG_POSSESSED.

Referenced by Player::ResyncCanFlyToClient(), SendMoveRoot(), SetCanFly(), SetDisableGravity(), SetFeatherFall(), SetHover(), SetSpeed(), and SetWaterWalking().

◆ GetCollisionHeight()

float Unit::GetCollisionHeight ( ) const
overridevirtual

Return collision height sent to client.

Reimplemented from WorldObject.

16891{
16892 float scaleMod = GetObjectScale(); // 99% sure about this
16893 float defaultHeight = DEFAULT_COLLISION_HEIGHT * scaleMod;
16894
16895 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
16896 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
16897 float collisionHeight = 0.0f;
16898
16899 if (IsMounted())
16900 {
16902 {
16903 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
16904 {
16905 collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f);
16906 }
16907 }
16908 }
16909 else
16910 collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale;
16911
16912 return collisionHeight == 0.0f ? defaultHeight : collisionHeight;
16913}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
#define DEFAULT_COLLISION_HEIGHT
Definition ObjectDefines.h:49
float GetObjectScale() const
Definition Object.h:126
Definition DBCStructure.h:748
uint32 ModelId
Definition DBCStructure.h:750
float scale
Definition DBCStructure.h:753
Definition DBCStructure.h:802
float Scale
Definition DBCStructure.h:806
float CollisionHeight
Definition DBCStructure.h:817

References CreatureModelDataEntry::CollisionHeight, DEFAULT_COLLISION_HEIGHT, GetNativeDisplayId(), Object::GetObjectScale(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by DynObjAura::FillTargetMap(), GetRandomContactPoint(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), WorldSession::ProcessMovementInfo(), ProcessTerrainStatusUpdate(), Spell::SelectImplicitCasterDestTargets(), spell_spawn_blood_pool::SetDest(), and Creature::UpdateMovementFlags().

◆ GetCollisionRadius()

float Unit::GetCollisionRadius ( ) const
overridevirtual

this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the radius also takes in consideration the mount size

Returns
float The radius of a unit

Reimplemented from WorldObject.

16885{
16886 return GetCollisionWidth() / 2;
16887}
float GetCollisionWidth() const override
this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by...
Definition Unit.cpp:16847

References GetCollisionWidth().

Referenced by GetMeleeAttackPoint(), and Creature::Update().

◆ GetCollisionWidth()

float Unit::GetCollisionWidth ( ) const
overridevirtual

this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the diameter also takes in consideration the mount size

Returns
float The diameter of a unit

Dismounting case - use basic default model data

Reimplemented from WorldObject.

16848{
16849 if (IsPlayer())
16850 return GetObjectSize();
16851
16852 float scaleMod = GetObjectScale(); // 99% sure about this
16853 float objectSize = GetObjectSize();
16854 float defaultSize = DEFAULT_WORLD_OBJECT_SIZE * scaleMod;
16855
16857 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
16858 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
16859
16860 if (IsMounted())
16861 {
16863 {
16864 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
16865 {
16866 if (G3D::fuzzyGt(mountModelData->CollisionWidth, modelData->CollisionWidth))
16867 modelData = mountModelData;
16868 }
16869 }
16870 }
16871
16872 float collisionWidth = scaleMod * modelData->CollisionWidth * modelData->Scale * displayInfo->scale * 2;
16873 // if the objectSize is the default value or the creature is mounted and we have a DBC value, then we can retrieve DBC value instead
16874 return G3D::fuzzyGt(collisionWidth, 0.0f) && (G3D::fuzzyEq(objectSize,defaultSize) || IsMounted()) ? collisionWidth : objectSize;
16875}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition ObjectDefines.h:44
float GetObjectSize() const
Definition Object.cpp:2904
float CollisionWidth
Definition DBCStructure.h:816

References CreatureModelDataEntry::CollisionWidth, DEFAULT_WORLD_OBJECT_SIZE, GetNativeDisplayId(), Object::GetObjectScale(), WorldObject::GetObjectSize(), Object::GetUInt32Value(), IsMounted(), Object::IsPlayer(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by GetCollisionRadius().

◆ GetCombatManager() [1/2]

◆ GetCombatManager() [2/2]

CombatManager const & Unit::GetCombatManager ( ) const
inline
968{ return m_combatManager; }

References m_combatManager.

◆ GetCombatRatingDamageReduction()

uint32 Unit::GetCombatRatingDamageReduction ( CombatRating  cr,
float  rate,
float  cap,
uint32  damage 
) const
private
15141{
15142 float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
15143 return CalculatePct(damage, percent);
15144}
float GetCombatRatingReduction(CombatRating cr) const
Definition Unit.cpp:15128

References CalculatePct(), and GetCombatRatingReduction().

Referenced by GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritDamageReduction(), and GetSpellDamageReduction().

◆ GetCombatRatingReduction()

float Unit::GetCombatRatingReduction ( CombatRating  cr) const
private
15129{
15130 if (Player const* player = ToPlayer())
15131 return player->GetRatingBonusValue(cr);
15132 // Player's pet get resilience from owner
15133 else if (IsPet() && GetOwner())
15134 if (Player* owner = GetOwner()->ToPlayer())
15135 return owner->GetRatingBonusValue(cr);
15136
15137 return 0.0f;
15138}

References GetOwner(), IsPet(), and Object::ToPlayer().

Referenced by GetCombatRatingDamageReduction(), GetMeleeCritChanceReduction(), GetRangedCritChanceReduction(), and GetSpellCritChanceReduction().

◆ GetCombatReach()

◆ GetCombatTimer()

uint32 Unit::GetCombatTimer ( ) const
inline
956{ return m_CombatTimer; }

References m_CombatTimer.

◆ GetComboPoints() [1/2]

uint8 Unit::GetComboPoints ( ObjectGuid const &  guid) const
inline
1029{ return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }

References Object::GetGUID(), m_comboPoints, and m_comboTarget.

◆ GetComboPoints() [2/2]

uint8 Unit::GetComboPoints ( Unit const *  who = nullptr) const
inline

◆ GetComboTarget()

Unit * Unit::GetComboTarget ( ) const
inline
1030{ return m_comboTarget; }

References m_comboTarget.

Referenced by Player::DuelComplete().

◆ GetComboTargetGUID()

ObjectGuid const Unit::GetComboTargetGUID ( ) const
inline

◆ GetCompanionPet()

Creature * Unit::GetCompanionPet ( ) const
7601{
7603}
@ SUMMON_SLOT_MINIPET
Definition SharedDefines.h:3549
Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:234

References ObjectAccessor::GetCreature(), m_SummonSlot, and SUMMON_SLOT_MINIPET.

◆ GetCreateHealth()

◆ GetCreateMana()

◆ GetCreatePowers()

uint32 Unit::GetCreatePowers ( Powers  power) const
12205{
12206 // Only hunter pets have POWER_FOCUS and POWER_HAPPINESS
12207 switch (power)
12208 {
12209 case POWER_MANA:
12210 return GetCreateMana();
12211 case POWER_RAGE:
12212 return 1000;
12213 case POWER_FOCUS:
12214 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
12215 case POWER_ENERGY:
12216 return 100;
12217 case POWER_HAPPINESS:
12218 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
12219 case POWER_RUNIC_POWER:
12220 return 1000;
12221 case POWER_RUNE:
12222 return 0;
12223 case POWER_HEALTH:
12224 return 0;
12225 default:
12226 break;
12227 }
12228
12229 return 0;
12230}
@ POWER_HEALTH
Definition SharedDefines.h:266
@ POWER_RUNIC_POWER
Definition SharedDefines.h:263
@ POWER_ENERGY
Definition SharedDefines.h:260
@ POWER_RUNE
Definition SharedDefines.h:262
@ POWER_FOCUS
Definition SharedDefines.h:259
uint32 GetCreateMana() const
Definition Unit.h:1162

References GetCreateMana(), HUNTER_PET, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, and POWER_RUNIC_POWER.

Referenced by Pet::CreateBaseAtTamed(), spell_dru_glyph_of_innervate::HandleProc(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), setPowerType(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ GetCreateStat()

float Unit::GetCreateStat ( Stats  stat) const
inline

◆ GetCreatorGUID()

ObjectGuid Unit::GetCreatorGUID ( ) const
inline
@ UNIT_FIELD_CREATEDBY
Definition UpdateFields.h:91

References Object::GetGuidValue(), and UNIT_FIELD_CREATEDBY.

Referenced by Condition::Meets().

◆ GetCreatureType()

uint32 Unit::GetCreatureType ( ) const
11616{
11617 if (IsPlayer())
11618 {
11620 SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
11621 if (ssEntry && ssEntry->creatureType > 0)
11622 return ssEntry->creatureType;
11623 else
11625 }
11626 else
11627 return ToCreature()->GetCreatureTemplate()->type;
11628}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
@ CREATURE_TYPE_HUMANOID
Definition SharedDefines.h:2628
ShapeshiftForm
Definition UnitDefines.h:71
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1979
uint32 type
Definition CreatureData.h:218
Definition DBCStructure.h:1853
int32 creatureType
Definition DBCStructure.h:1859

References CREATURE_TYPE_HUMANOID, SpellShapeshiftFormEntry::creatureType, Creature::GetCreatureTemplate(), GetShapeshiftForm(), Object::IsPlayer(), sSpellShapeshiftFormStore, Object::ToCreature(), and CreatureTemplate::type.

Referenced by Creature::CanStartAttack(), spell_utgarde_pinnacle_beast_mark::CheckProc(), Spell::EffectKnockBack(), GetCreatureTypeMask(), GetUnitParryChance(), AuraEffect::HandleAuraEmpathy(), spell_dru_starfall_dummy::HandleDummy(), IsCritter(), CreatureAI::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), and Creature::UpdateMoveInLineOfSightState().

◆ GetCreatureTypeMask()

uint32 Unit::GetCreatureTypeMask ( ) const
inline
835 {
836 uint32 creatureType = GetCreatureType();
837 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
838 }
uint32 GetCreatureType() const
Definition Unit.cpp:11615

References GetCreatureType().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), SpellInfo::CheckTargetCreatureType(), MeleeDamageBonusDone(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ GetCritChanceFromSkillDiff()

float Unit::GetCritChanceFromSkillDiff ( Unit const *  victim) const
3687{
3688 int32 const skillDiff = int32(victim->GetDefenseSkillValue(this)) - int32(GetMaxSkillValueForLevel(victim));
3689 if (victim->IsPlayer() || skillDiff <= 0)
3690 return -skillDiff * 0.04f;
3691
3692 // crit suppression vs higher level creatures, 4.8% against a +3 boss
3693 float suppression = skillDiff * 0.12f;
3694 if (skillDiff >= 15)
3695 suppression += 3.0f;
3696
3697 return -suppression;
3698}
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition Unit.h:1219

References GetDefenseSkillValue(), GetMaxSkillValueForLevel(), and Object::IsPlayer().

Referenced by GetUnitCriticalChance(), and SpellTakenCritChance().

◆ GetCritterGUID()

ObjectGuid Unit::GetCritterGUID ( ) const
inline

◆ GetCurrentSpell() [1/2]

◆ GetCurrentSpell() [2/2]

Spell * Unit::GetCurrentSpell ( uint32  spellType) const
inline
1594{ return m_currentSpells[spellType]; }

References m_currentSpells.

◆ GetCurrentSpellCastTime()

int32 Unit::GetCurrentSpellCastTime ( uint32  spell_id) const
4105{
4106 if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
4107 return spell->GetCastTime();
4108 return 0;
4109}
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4096

References FindCurrentSpellBySpellId(), and Spell::GetCastTime().

Referenced by CasterAI::JustEngagedWith(), CasterAI::UpdateAI(), and boss_mandokir::boss_mandokirAI::UpdateAI().

◆ GetDamageImmunityMask()

uint32 Unit::GetDamageImmunityMask ( ) const
9663{
9664 uint32 mask = 0;
9666 for (auto const& [immunitySchoolMask, _] : damageList)
9667 mask |= immunitySchoolMask;
9668 return mask;
9669}
@ IMMUNITY_DAMAGE
Definition SharedDefines.h:1401
std::unordered_multimap< uint32, uint32 > SpellImmuneContainer
Definition Unit.h:2109

References IMMUNITY_DAMAGE, and m_spellImmune.

◆ getDeathState()

◆ GetDebugInfo()

std::string Unit::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

17121{
17122 std::stringstream sstr;
17123 sstr << WorldObject::GetDebugInfo() << "\n"
17124 << std::boolalpha
17125 << "AliveState: " << IsAlive()
17126 << " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
17127 << " Class: " << std::to_string(getClass());
17128 return sstr.str();
17129}
std::string GetDebugInfo() const override
Definition Object.cpp:2603

References getClass(), WorldObject::GetDebugInfo(), GetExtraUnitMovementFlags(), GetUnitMovementFlags(), and IsAlive().

Referenced by UnitAI::GetDebugInfo(), Creature::GetDebugInfo(), and Player::GetDebugInfo().

◆ GetDefaultMovementType()

MovementGeneratorType Unit::GetDefaultMovementType ( ) const
virtual

-------—End of Pet responses methods-------—

Reimplemented in Creature.

12721{
12722 return IDLE_MOTION_TYPE;
12723}
@ IDLE_MOTION_TYPE
Definition MotionMaster.h:39

References IDLE_MOTION_TYPE.

◆ GetDefenseSkillValue()

uint32 Unit::GetDefenseSkillValue ( Unit const *  target = nullptr) const
3526{
3527 if (IsPlayer())
3528 {
3529 // in PvP use full skill instead current skill value
3530 uint32 value = (target && target->IsPlayer())
3533 value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
3534 return value;
3535 }
3536 else
3537 return GetUnitMeleeSkill(target);
3538}
@ SKILL_DEFENSE
Definition SharedDefines.h:3114
@ CR_DEFENSE_SKILL
Definition Unit.h:232
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5654
uint16 GetMaxSkillValue(uint32 skill) const
Definition Player.cpp:5671

References CR_DEFENSE_SKILL, Player::GetMaxSkillValue(), Player::GetSkillValue(), GetUnitMeleeSkill(), Object::IsPlayer(), SKILL_DEFENSE, and Object::ToPlayer().

Referenced by spell_pal_ardent_defender::Absorb(), DealMeleeDamage(), GetCritChanceFromSkillDiff(), RollMeleeOutcomeAgainst(), and Player::UpdateBlockPercentage().

◆ GetDiminishing()

DiminishingLevels Unit::GetDiminishing ( DiminishingGroup  group)
11436{
11437 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
11438 {
11439 if (i->DRGroup != group)
11440 continue;
11441
11442 if (!i->hitCount)
11443 return DIMINISHING_LEVEL_1;
11444
11445 if (!i->hitTime)
11446 return DIMINISHING_LEVEL_1;
11447
11448 // If last spell was casted more than 15 seconds ago - reset the count.
11449 if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS().count()) > 15000)
11450 {
11451 i->hitCount = DIMINISHING_LEVEL_1;
11452 return DIMINISHING_LEVEL_1;
11453 }
11454 // or else increase the count.
11455 else
11456 return DiminishingLevels(i->hitCount);
11457 }
11458 return DIMINISHING_LEVEL_1;
11459}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition Timer.h:110

References DIMINISHING_LEVEL_1, GameTime::GetGameTimeMS(), getMSTimeDiff(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ GetDirectTransport()

TransportBase * Unit::GetDirectTransport ( ) const
14746{
14747 if (Vehicle* veh = GetVehicle())
14748 return veh;
14749 return GetTransport();
14750}
Vehicle * GetVehicle() const
Definition Unit.h:1948

References WorldObject::GetTransport(), and GetVehicle().

Referenced by Movement::TransportPathTransform::operator()(), SmartScript::ProcessAction(), CharmInfo::SaveStayPosition(), and UpdateSplinePosition().

◆ GetDiseasesByCaster()

uint32 Unit::GetDiseasesByCaster ( ObjectGuid  casterGUID,
uint8  mode = 0 
)
5939{
5940 static const AuraType diseaseAuraTypes[] =
5941 {
5942 SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague
5943 SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague
5945 };
5946
5947 ObjectGuid drwGUID;
5948
5949 if (Player* playerCaster = ObjectAccessor::GetPlayer(*this, casterGUID))
5950 drwGUID = playerCaster->getRuneWeaponGUID();
5951
5952 uint32 diseases = 0;
5953 for (uint8 index = 0; diseaseAuraTypes[index] != SPELL_AURA_NONE; ++index)
5954 {
5955 for (AuraEffectList::iterator i = m_modAuras[diseaseAuraTypes[index]].begin(); i != m_modAuras[diseaseAuraTypes[index]].end();)
5956 {
5957 // Get auras with disease dispel type by caster
5958 if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
5959 && ((*i)->GetCasterGUID() == casterGUID || (*i)->GetCasterGUID() == drwGUID)) // if its caster or his dancing rune weapon
5960 {
5961 ++diseases;
5962
5963 if (mode == 1)
5964 {
5965 RemoveAura((*i)->GetId(), (*i)->GetCasterGUID());
5966 i = m_modAuras[diseaseAuraTypes[index]].begin();
5967 continue;
5968 }
5969 // used for glyph of scourge strike
5970 else if (mode == 2)
5971 {
5972 Aura* aura = (*i)->GetBase();
5973 uint32 countMin = aura->GetMaxDuration();
5974 uint32 countMax = aura->GetSpellInfo()->GetMaxDuration() + 9000;
5975
5976 if (AuraEffect const* epidemic = (*i)->GetCaster()->GetAuraEffectOfRankedSpell(49036, EFFECT_0))
5977 countMax += epidemic->GetAmount();
5978
5979 if (countMin < countMax)
5980 {
5981 aura->SetDuration(uint32(aura->GetDuration() + 3000));
5982 aura->SetMaxDuration(countMin + 3000);
5983 }
5984 }
5985 }
5986 ++i;
5987 }
5988 }
5989 return diseases;
5990}
@ EFFECT_0
Definition SharedDefines.h:31
@ DISPEL_DISEASE
Definition SharedDefines.h:1378
AuraType
Definition SpellAuraDefines.h:62
@ SPELL_AURA_LINKED
Definition SpellAuraDefines.h:347
@ SPELL_AURA_NONE
Definition SpellAuraDefines.h:63
int32 GetMaxDuration() const
Definition SpellAuras.h:131
void SetMaxDuration(int32 duration)
Definition SpellAuras.h:132
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2788
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4823
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5602

References DISPEL_DISEASE, EFFECT_0, GetAuraEffectOfRankedSpell(), AuraEffect::GetCaster(), Aura::GetDuration(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), ObjectAccessor::GetPlayer(), Aura::GetSpellInfo(), m_modAuras, RemoveAura(), Aura::SetDuration(), Aura::SetMaxDuration(), SPELL_AURA_LINKED, SPELL_AURA_NONE, and SPELL_AURA_PERIODIC_DAMAGE.

Referenced by Spell::EffectWeaponDmg(), and SpellPctDamageModsDone().

◆ GetDispellableAuraList()

void Unit::GetDispellableAuraList ( Unit *  caster,
uint32  dispelMask,
DispelChargesList &  dispelList,
SpellInfo const *  dispelSpell 
)
5700{
5701 // we should not be able to dispel diseases if the target is affected by unholy blight
5702 if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
5703 dispelMask &= ~(1 << DISPEL_DISEASE);
5704
5705 ReputationRank rank = GetReactionTo(caster, IsCharmed());
5706 bool positive = rank >= REP_FRIENDLY;
5707
5708 // Neutral unit not at war with caster should be treated as a friendly unit
5709 if (rank == REP_NEUTRAL)
5710 {
5711 if (Player* casterPlayer = caster->GetAffectingPlayer())
5712 {
5713 if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
5714 {
5715 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
5716 {
5717 if (factionEntry->CanBeSetAtWar())
5718 {
5719 positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
5720 }
5721 }
5722 }
5723 }
5724 }
5725
5726 Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
5727 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
5728 {
5729 Aura* aura = itr->second->GetBase();
5730
5731 // don't try to remove passive auras
5732 if (aura->IsPassive())
5733 continue;
5734
5735 if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
5736 {
5737 if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
5738 {
5739 // do not remove positive auras if friendly target
5740 // negative auras if non-friendly target
5741 if (itr->second->IsPositive() == positive)
5742 continue;
5743 }
5744
5745 // Banish should only be dispelled by Mass Dispel
5746 if (aura->GetSpellInfo()->Mechanic == MECHANIC_BANISH && !dispelSpell->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
5747 {
5748 continue;
5749 }
5750
5751 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
5752 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
5753 // Polymorph instead of 1 / (5 + 1) -> 16%.
5754 bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
5755 uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
5756 if (charges > 0)
5757 dispelList.push_back(std::make_pair(aura, charges));
5758 }
5759 }
5760}
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
Definition SharedDefines.h:639
@ MECHANIC_BANISH
Definition SharedDefines.h:1331
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:399
@ REP_FRIENDLY
Definition SharedDefines.h:161
@ DISPEL_MAGIC
Definition SharedDefines.h:1376
uint8 GetStackAmount() const
Definition SpellAuras.h:150
uint8 GetCharges() const
Definition SpellAuras.h:143
bool IsPassive() const
Definition SpellAuras.cpp:1148
uint32 Mechanic
Definition SpellInfo.h:347
uint32 GetDispelMask() const
Definition SpellInfo.cpp:1989
uint32 Dispel
Definition SpellInfo.h:346
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5815
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition Unit.h:693
VisibleAuraMap const * GetVisibleAuras()
Definition Unit.h:1556

References SpellInfo::Dispel, DISPEL_DISEASE, DISPEL_MAGIC, GetAffectingPlayer(), Aura::GetCharges(), SpellInfo::GetDispelMask(), GetFactionTemplateEntry(), GetReactionTo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetVisibleAuras(), SpellInfo::HasAttribute(), HasAura(), IsCharmed(), Aura::IsPassive(), SpellInfo::Mechanic, MECHANIC_BANISH, REP_FRIENDLY, REP_NEUTRAL, sFactionStore, SPELL_ATTR0_NO_IMMUNITIES, and SPELL_ATTR7_DISPEL_REMOVES_CHARGES.

Referenced by Spell::CheckCast(), and Spell::EffectDispel().

◆ GetDisplayId()

uint32 Unit::GetDisplayId ( ) const
inline

◆ GetDisplayRace()

DisplayRace Unit::GetDisplayRace ( ) const
inline
DisplayRace GetDisplayRaceFromModelId(uint32 modelId) const
Definition Unit.cpp:16815
uint32 GetDisplayId() const
Definition Unit.h:1996

References GetDisplayId(), and GetDisplayRaceFromModelId().

Referenced by AuraEffect::HandleAuraTransform().

◆ GetDisplayRaceFromModelId()

DisplayRace Unit::GetDisplayRaceFromModelId ( uint32  modelId) const
16816{
16817 if (CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(modelId))
16818 {
16819 if (CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID))
16820 {
16821 return DisplayRace(displayExtra->DisplayRaceID);
16822 }
16823 }
16824 return DisplayRace::None;
16825}
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
DisplayRace
Definition SharedDefines.h:96
Definition DBCStructure.h:766

References None, sCreatureDisplayInfoExtraStore, and sCreatureDisplayInfoStore.

Referenced by GetDisplayRace().

◆ GetDoTsByCaster()

uint32 Unit::GetDoTsByCaster ( ObjectGuid  casterGUID) const
5993{
5994 static const AuraType diseaseAuraTypes[] =
5995 {
5999 };
6000
6001 uint32 dots = 0;
6002 for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
6003 {
6004 Unit::AuraEffectList const& auras = GetAuraEffectsByType(*itr);
6005 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
6006 {
6007 // Get auras by caster
6008 if ((*i)->GetCasterGUID() == casterGUID)
6009 ++dots;
6010 }
6011 }
6012 return dots;
6013}
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition SpellAuraDefines.h:152

References GetAuraEffectsByType(), SPELL_AURA_NONE, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PERIODIC_DAMAGE_PERCENT.

Referenced by SpellPctDamageModsDone().

◆ GetDummyAuraEffect()

◆ GetDynamicFlags()

◆ GetDynObject()

DynamicObject * Unit::GetDynObject ( uint32  spellId)
6333{
6334 if (m_dynObj.empty())
6335 return nullptr;
6336 for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end(); ++i)
6337 {
6338 DynamicObject* dynObj = *i;
6339 if (dynObj->GetSpellId() == spellId)
6340 return dynObj;
6341 }
6342 return nullptr;
6343}
Definition DynamicObject.h:35
uint32 GetSpellId() const
Definition DynamicObject.h:59

References DynamicObject::GetSpellId(), and m_dynObj.

Referenced by Spell::DelayedChannel(), WorldSession::HandleFarSightOpcode(), and boss_akilzon::JustEngagedWith().

◆ GetEffectiveResistChance()

float Unit::GetEffectiveResistChance ( Unit const *  owner,
SpellSchoolMask  schoolMask,
Unit const *  victim,
SpellInfo const *  spellInfo = nullptr,
uint8  casterLevel = 0 
)
static
2300{
2301 float victimResistance = static_cast<float>(victim->GetResistance(schoolMask));
2302 if (owner)
2303 {
2304 // Xinef: pets inherit 100% of masters penetration
2305 // Xinef: excluding traps
2306 Player const* player = owner->GetSpellModOwner();
2307 if (player && owner->GetEntry() != WORLD_TRIGGER)
2308 {
2309 victimResistance += static_cast<float>(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2310 victimResistance -= static_cast<float>(player->GetSpellPenetrationItemMod());
2311 }
2312 else
2313 victimResistance += static_cast<float>(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2314 }
2315
2316 victimResistance = std::max(victimResistance, 0.0f);
2317 uint8 effectiveCasterLevel = owner ? owner->GetLevel() : casterLevel;
2318
2319 if (effectiveCasterLevel && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL)))
2320 victimResistance += std::max(static_cast<float>(victim->GetLevel() - effectiveCasterLevel) * 5.0f, 0.0f);
2321
2322 // Per EJ research, the resistance constant is based on the caster's level. It should be equal
2323 // to 400 for a level 80 caster and 506.5 for a level 83 caster (boss).
2324 float level = static_cast<float>(effectiveCasterLevel ? effectiveCasterLevel : victim->GetLevel());
2325 float resistanceConstant = 0.0f;
2326
2327 if (level > 60.0f)
2328 resistanceConstant = 150.0f + (level - 60.0f) * (level - 67.5f);
2329 else if (level > 20.0f)
2330 resistanceConstant = 50.0f + (level - 20.0f) * 2.5f;
2331 else
2332 resistanceConstant = 50.0f;
2333
2334 return std::min(victimResistance / (victimResistance + resistanceConstant), 0.75f);
2335}
int32 GetSpellPenetrationItemMod() const
Definition Player.h:2005

References Object::GetEntry(), GetLevel(), GetResistance(), GetSpellModOwner(), Player::GetSpellPenetrationItemMod(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_AURA_MOD_TARGET_RESISTANCE, and WORLD_TRIGGER.

Referenced by CalcAbsorbResist(), and WorldObject::MagicSpellHitResult().

◆ GetExtraUnitMovementFlags()

uint16 Unit::GetExtraUnitMovementFlags ( ) const
inline

◆ GetFaction()

uint32 Unit::GetFaction ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

References Object::GetUInt32Value(), and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::AttackStart(), npc_ulduar_arachnopod_destroyer::AttackStart(), Creature::CanAssistTo(), spell_q10985_light_of_the_naaru::CheckProc(), boss_eadric::DamageTaken(), boss_paletress::DamageTaken(), ScriptedAI::DoRewardPlayersInArea(), Spell::EffectDuel(), Spell::EffectSummonType(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::EnterEvadeMode(), boss_mimiron::EnterEvadeMode(), npc_ulduar_arachnopod_destroyer::EnterEvadeMode(), npc_chesspiece::GetDefaultOrientationForTeam(), DynamicObject::GetFaction(), GetFactionTemplateEntry(), GetReactionTo(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleGossipHelloOpcode(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommandShowCreature(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandlePlayerLoginFromDB(), TempSummon::InitStats(), InitTamedPet(), IsFriendly(), IsInPartyWith(), IsInRaidWith(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), boss_volkhan::JustSummoned(), Pet::LoadPetFromDB(), npc_chesspiece::npc_chesspiece(), npc_plucky::npc_pluckyAI::npc_pluckyAI(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::npc_taskmaster_fizzuleAI(), npc_eris_hevenfire::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::PassengerBoarded(), npc_frosthound::PassengerBoarded(), PatchValuesUpdate(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::Reset(), npc_future_you::npc_future_youAI::Reset(), WorldSession::SendAuctionHello(), SetCharmedBy(), Player::SetGameMaster(), npc_chesspiece::sGossipHello(), boss_malchezaar::SpawnInfernal(), Spell::SummonGuardian(), Player::SummonPet(), npc_phalanx::UpdateAI(), npc_chesspiece::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_malygos::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), and Creature::UpdateMoveInLineOfSightState().

◆ GetFactionReactionTo() [1/2]

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
FactionTemplateEntry const *  targetFactionTemplateEntry 
)
static
7074{
7075 if (!factionTemplateEntry || !targetFactionTemplateEntry)
7076 return REP_NEUTRAL;
7077 // common faction based check
7078 if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
7079 return REP_HOSTILE;
7080 if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
7081 return REP_FRIENDLY;
7082 if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
7083 return REP_FRIENDLY;
7084 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
7085 return REP_HOSTILE;
7086
7087 // neutral by default
7088 return REP_NEUTRAL;
7089}
@ FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS
Definition DBCEnums.h:332

References FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS, FactionTemplateEntry::factionFlags, FactionTemplateEntry::IsFriendlyTo(), FactionTemplateEntry::IsHostileTo(), REP_FRIENDLY, REP_HOSTILE, and REP_NEUTRAL.

◆ GetFactionReactionTo() [2/2]

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
Unit const *  target 
) const
7032{
7033 // always neutral when no template entry found
7034 if (!factionTemplateEntry)
7035 return REP_NEUTRAL;
7036
7037 FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry();
7038 if (!targetFactionTemplateEntry)
7039 return REP_NEUTRAL;
7040
7041 // xinef: check forced reputation for self also
7042 if (Player const* selfPlayerOwner = GetAffectingPlayer())
7043 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(target->GetFactionTemplateEntry()))
7044 return *repRank;
7045
7046 if (Player const* targetPlayerOwner = target->GetAffectingPlayer())
7047 {
7048 // check contested flags
7049 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
7050 && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
7051 return REP_HOSTILE;
7052 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
7053 return *repRank;
7054 if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
7055 {
7056 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
7057 {
7058 if (factionEntry->CanHaveReputation())
7059 {
7060 // CvP case - check reputation, don't allow state higher than neutral when at war
7061 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
7062 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
7063 repRank = std::min(REP_NEUTRAL, repRank);
7064 return repRank;
7065 }
7066 }
7067 }
7068 }
7069
7070 return GetFactionReactionTo(factionTemplateEntry, targetFactionTemplateEntry);
7071}
@ UNIT_FLAG2_IGNORE_REPUTATION
Definition UnitDefines.h:298
ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
Definition Unit.cpp:7031

References FactionTemplateEntry::faction, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, FactionTemplateEntry::factionFlags, GetAffectingPlayer(), GetFactionReactionTo(), GetFactionTemplateEntry(), HasUnitFlag2(), PLAYER_FLAGS_CONTESTED_PVP, REP_HOSTILE, REP_NEUTRAL, sFactionStore, and UNIT_FLAG2_IGNORE_REPUTATION.

Referenced by GetFactionReactionTo(), GetReactionTo(), and npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight().

◆ GetFactionTemplateEntry()

FactionTemplateEntry const * Unit::GetFactionTemplateEntry ( ) const
6882{
6883 FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
6884 if (!entry)
6885 {
6886 static ObjectGuid guid; // prevent repeating spam same faction problem
6887
6888 if (GetGUID() != guid)
6889 {
6890 if (Player const* player = ToPlayer())
6891 LOG_ERROR("entities.unit", "Player {} has invalid faction (faction template id) #{}", player->GetName(), GetFaction());
6892 else if (Creature const* creature = ToCreature())
6893 LOG_ERROR("entities.unit", "Creature (template id: {}) has invalid faction (faction template id) #{}", creature->GetCreatureTemplate()->Entry, GetFaction());
6894 else
6895 LOG_ERROR("entities.unit", "Unit (name={}, type={}) has invalid faction (faction template id) #{}", GetName(), uint32(GetTypeId()), GetFaction());
6896
6897 guid = GetGUID();
6898 }
6899 }
6900 return entry;
6901}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
TypeID GetTypeId() const
Definition Object.h:135
uint32 GetFaction() const override
Definition Unit.h:857
std::string const & GetName() const
Definition Object.h:535

References GetFaction(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), LOG_ERROR, sFactionTemplateStore, Object::ToCreature(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), GameObject::ActivateToQuest(), Player::CanUseBattlegroundObject(), npc_necrotic_shard::DamageTaken(), Spell::EffectGameObjectDamage(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), Player::GetReputationPriceDiscount(), IsContestedGuard(), IsHostileToPlayers(), IsNeutralToAll(), npc_chesspiece::OnCharmed(), PatchValuesUpdate(), and RespondsToCallForHelp().

◆ GetFirstControlled()

Unit * Unit::GetFirstControlled ( ) const
8015{
8016 // Sequence: charmed, pet, other guardians
8017 Unit* unit = GetCharm();
8018 if (!unit)
8019 if (ObjectGuid guid = GetMinionGUID())
8020 unit = ObjectAccessor::GetUnit(*this, guid);
8021
8022 return unit;
8023}
ObjectGuid GetMinionGUID() const
Definition Unit.h:723

References GetCharm(), GetMinionGUID(), and ObjectAccessor::GetUnit().

Referenced by Player::CharmSpellInitialize(), WorldSession::HandlePetSetAction(), and RemoveCharmedBy().

◆ GetFirstCurrentCastingSpell()

Spell * Unit::GetFirstCurrentCastingSpell ( ) const
4088{
4089 for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
4090 if (m_currentSpells[i] && m_currentSpells[i]->GetCastTimeRemaining() > 0)
4091 return m_currentSpells[i];
4092
4093 return nullptr;
4094}

References CURRENT_MAX_SPELL, and m_currentSpells.

◆ GetFirstMinion()

Minion * Unit::GetFirstMinion ( ) const
7571{
7572 if (ObjectGuid pet_guid = GetMinionGUID())
7573 {
7574 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
7575 if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
7576 return (Minion*)pet;
7577
7578 LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion {} not exist.", pet_guid.ToString());
7579 const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
7580 }
7581
7582 return nullptr;
7583}
void SetMinionGUID(ObjectGuid guid)
Definition Unit.h:724
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
Definition ObjectAccessor.cpp:258

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetMinionGUID(), LOG_ERROR, SetMinionGUID(), and UNIT_MASK_MINION.

◆ GetFlatModifierValue()

float Unit::GetFlatModifierValue ( UnitMods  unitMod,
UnitModifierFlatType  modifierType 
) const

◆ GetFollowAngle()

◆ GetGameObject()

GameObject * Unit::GetGameObject ( uint32  spellId) const
6374{
6375 for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr)
6376 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6377 if (go->GetSpellId() == spellId)
6378 return go;
6379
6380 return nullptr;
6381}

References ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Spell::cancel(), Player::GetGameObjectIfCanInteractWith(), and Player::TeleportTo().

◆ getGender()

◆ GetGuardianPet()

Guardian * Unit::GetGuardianPet ( ) const
7586{
7587 if (ObjectGuid pet_guid = GetPetGUID())
7588 {
7589 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
7590 if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
7591 return (Guardian*)pet;
7592
7593 LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian {} not exist.", pet_guid.ToString());
7594 const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
7595 }
7596
7597 return nullptr;
7598}
#define LOG_FATAL(filterType__,...)
Definition Log.h:141
@ UNIT_MASK_GUARDIAN
Definition UnitDefines.h:161
Definition TemporarySummon.h:106
void SetPetGUID(ObjectGuid guid)
Definition Unit.h:728
ObjectGuid GetPetGUID() const
Definition Unit.h:729

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetPetGUID(), LOG_FATAL, SetPetGUID(), and UNIT_MASK_GUARDIAN.

Referenced by spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Spell::EffectSummonPet(), GetNextRandomRaidMemberOrPet(), AuraEffect::HandleAuraDummy(), HandleAuraRaidProcFromChargeWithValue(), AuraEffect::HandleModDamageDone(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), and SetMinion().

◆ GetHealth()

uint32 Unit::GetHealth ( ) const
inline
@ UNIT_FIELD_HEALTH
Definition UpdateFields.h:96

References Object::GetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_SaveCharacter(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckPower(), CountPctFromCurHealth(), ScriptedAI::DamageTaken(), boss_eregos::boss_eregosAI::DamageTaken(), boss_razorgore::DamageTaken(), boss_majordomo::DamageTaken(), boss_ragnaros::DamageTaken(), npc_mc_core_hound::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_julianne::DamageTaken(), boss_romulo::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), npc_dark_fiend::DamageTaken(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_eadric::DamageTaken(), npc_argent_soldier::DamageTaken(), boss_black_knight::DamageTaken(), boss_grand_champion::DamageTaken(), npc_announcer_toc5::DamageTaken(), npc_frost_sphere::DamageTaken(), boss_ick::boss_ickAI::DamageTaken(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_collapsing_star::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_boombot::DamageTaken(), boss_yoggsaron_guardian_of_ys::DamageTaken(), boss_yoggsaron::DamageTaken(), boss_yoggsaron_immortal_guardian::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_wild_wyrm::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_akama_illidan::DamageTaken(), npc_maiev_illidan::DamageTaken(), boss_illidari_council::DamageTaken(), boss_illidari_council_memberAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_akama_shade::DamageTaken(), boss_the_lurker_below::DamageTaken(), npc_shattered_hand_scout::DamageTaken(), boss_alar::DamageTaken(), advisor_baseAI::DamageTaken(), npc_hor_leader_second::npc_hor_leader_secondAI::DamageTaken(), npc_ice_tomb::npc_ice_tombAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_nightbane::DamageTaken(), boss_thekal::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_anub_arak::DamageTaken(), boss_paletress::DamageTaken(), boss_illidan_stormrage::DamageTaken(), npc_garr_firesworn::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_yoggsaron_sara::DamageTaken(), SmartAI::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), boss_kiljaeden::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kologarn::DamageTaken(), boss_kologarn_arms::DamageTaken(), boss_thorim::DamageTaken(), DealDamage(), DealDamageShieldDamage(), boss_ichoron::DoAction(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectHealMaxHealth(), Spell::EffectInstaKill(), Pet::FillPetInfo(), boss_supremus::FindHatefulStrikeTarget(), GetHealthGain(), GetHealthPct(), spell_illidari_council_empyreal_balance::HandleAfterCast(), spell_illidari_council_empyreal_equivalency::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_rajaxx_thundercrash::HandleDamageCalc(), misc_commandscript::HandleDieCommand(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_valkyr_touch_aura::HandleEffectPeriodic(), Player::HandleFall(), spell_razorscale_flame_breath::HandleHit(), npc_commandscript::HandleNpcInfoCommandShowCreature(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), IsFullHealth(), SmartAI::IsMainSpellPrevented(), npc_dirt_mound::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), Kill(), ModifyHealth(), spell_xt002_gravity_bomb_aura::OnPeriodic(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthOrderPred::operator()(), spell_gluth_decimate_damage::PrepareSpellScript(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::ResetPlayerDamageReq(), Pet::SavePetToDB(), Creature::SaveToDB(), SendAttackStateUpdate(), SendSpellNonMeleeDamageLog(), WorldObject::SendSpellNonMeleeDamageLog(), SendSpellNonMeleeReflectLog(), boss_xt002::SetData(), SetMaxHealth(), boss_eadric::SpellHit(), boss_headless_horseman_head::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), boss_ouro::Submerge(), Aura::Update(), boss_headless_horseman::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Player::UpdateCharmedAI(), and Creature::UpdateEntry().

◆ GetHealthGain()

int32 Unit::GetHealthGain ( int32  dVal)
10833{
10834 int32 gain = 0;
10835
10836 if (dVal == 0)
10837 return 0;
10838
10839 int32 curHealth = (int32)GetHealth();
10840
10841 int32 val = dVal + curHealth;
10842 if (val <= 0)
10843 {
10844 return -curHealth;
10845 }
10846
10847 int32 maxHealth = (int32)GetMaxHealth();
10848
10849 if (val < maxHealth)
10850 gain = dVal;
10851 else if (curHealth != maxHealth)
10852 gain = maxHealth - curHealth;
10853
10854 return gain;
10855}

References GetHealth(), and GetMaxHealth().

Referenced by Spell::DoAllEffectOnTarget().

◆ GetHealthPct()

◆ GetHighestExclusiveSameEffectSpellGroupValue()

int32 Unit::GetHighestExclusiveSameEffectSpellGroupValue ( AuraEffect const *  aurEff,
AuraType  auraType,
bool  checkMiscValue = false,
int32  miscValue = 0 
) const
4327{
4328 int32 val = 0;
4329 SpellSpellGroupMapBounds spellGroup = sSpellMgr->GetSpellSpellGroupMapBounds(aurEff->GetSpellInfo()->GetFirstRankSpell()->Id);
4330 for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
4331 {
4332 if (sSpellMgr->GetSpellGroupStackRule(itr->second) == SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT)
4333 {
4334 AuraEffectList const& auraEffList = GetAuraEffectsByType(auraType);
4335 for (AuraEffectList::const_iterator auraItr = auraEffList.begin(); auraItr != auraEffList.end(); ++auraItr)
4336 {
4337 if (aurEff != (*auraItr) && (!checkMiscValue || (*auraItr)->GetMiscValue() == miscValue) &&
4338 sSpellMgr->IsSpellMemberOfSpellGroup((*auraItr)->GetSpellInfo()->Id, itr->second))
4339 {
4340 // absolute value only
4341 if (abs(val) < abs((*auraItr)->GetAmount()))
4342 val = (*auraItr)->GetAmount();
4343 }
4344 }
4345 }
4346 }
4347 return val;
4348}
std::pair< SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator > SpellSpellGroupMapBounds
Definition SpellMgr.h:354
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT
Definition SpellMgr.h:365

References GetAuraEffectsByType(), SpellInfo::GetFirstRankSpell(), AuraEffect::GetSpellInfo(), SpellInfo::Id, SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT, and sSpellMgr.

Referenced by AuraEffect::HandleAuraModStat(), AuraEffect::HandleModCastingSpeed(), AuraEffect::HandleModCombatSpeedPct(), and AuraEffect::HandleModMeleeSpeedPct().

◆ GetHoverHeight()

float Unit::GetHoverHeight ( ) const
inline

◆ GetInterruptMask()

uint32 Unit::GetInterruptMask ( ) const
inline
1620{ return m_interruptMask; }

References m_interruptMask.

◆ GetLastDamagedTargetGuid()

ObjectGuid const & Unit::GetLastDamagedTargetGuid ( ) const
inline
986{ return _lastDamagedTargetGuid; }

References _lastDamagedTargetGuid.

◆ GetLastDeathTime()

Milliseconds Unit::GetLastDeathTime ( ) const
inline
1808{ return m_lastDeathTime; }
Milliseconds m_lastDeathTime
Definition Unit.h:2175

References m_lastDeathTime.

Referenced by Aura::HasCasterDiedSinceApply().

◆ GetLastExtraAttackSpell()

uint32 Unit::GetLastExtraAttackSpell ( ) const
inline

◆ GetLevel()

uint8 Unit::GetLevel ( ) const
inline
@ UNIT_FIELD_LEVEL
Definition UpdateFields.h:114

References Object::GetUInt32Value(), and UNIT_FIELD_LEVEL.

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDamage(), KillRewarder::_GetPlayerLevel(), KillRewarder::_InitGroupData(), Pet::_LoadAuras(), KillRewarder::_RewardXP(), Player::_SaveCharacter(), Player::_SaveStats(), spell_pal_ardent_defender::Absorb(), Pet::addSpell(), Spell::AddUnitTarget(), Player::ApplyEnchantment(), AuraEffect::AuraEffect(), BattlegroundMgr::BuildBattlegroundListPacket(), WorldSession::BuildPartyMemberStatsChangedPacket(), lfg::BuildRBInternalInfo(), CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), spell_gen_disabled_above_63::CalculateAmount(), spell_item_arcane_shroud::CalculateAmount(), spell_item_the_eye_of_diminution::CalculateAmount(), AuraEffect::CalculateAmount(), CalculateLevelPenalty(), CalculateMeleeDamage(), Player::CalculateMinMaxDamage(), Player::CalculateQuestRewardXP(), Player::CalculateReputationGain(), Player::CalculateTalentsPoints(), SpellEffectInfo::CalcValue(), Player::CanEquipItem(), Group::CanJoinBattlegroundQueue(), Creature::CanResetTalents(), Player::CanSeeStartQuest(), Player::CanUseItem(), Player::CheckAreaExploreAndOutdoor(), spell_hun_tame_beast::CheckCast(), Spell::CheckCast(), ServerMailCondition::CheckCondition(), Spell::CheckEffectTarget(), spell_gen_proc_above_75::CheckLevel(), spell_gen_proc_reduced_above_60::CheckProc(), spell_gen_ethereal_pet_aura::CheckProc(), spell_item_green_whelp_armor::CheckProc(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), CreateTamedPetFrom(), CreateTamedPetFrom(), DealDamage(), DealMeleeDamage(), DoLowUnlearnCost(), DoMedUnlearnCost(), Spell::DoSpellHitOnUnit(), Spell::EffectAddHonor(), Spell::EffectApplyGlyph(), Spell::EffectDuel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectSkinning(), Spell::EffectTameCreature(), Pet::FillPetInfo(), spell_gen_filter_party_level_80::FilterTargets(), lfg::LFGMgr::FinishDungeon(), Acore::XP::Gain(), Player::GetAverageItemLevel(), Player::GetAverageItemLevelForDF(), Player::GetBarberShopCost(), Player::GetBGAccessByLevel(), Pet::GetCurrentFoodBenefitLevel(), Trainer::Trainer::GetDefaultSpellState(), npc_wg_quest_giver::GetDialogStatus(), Player::GetDodgeFromAgility(), spell_warl_life_tap::GetDownrankFactor(), GetEffectiveResistChance(), SocialMgr::GetFriendInfo(), getLevelForTarget(), Creature::getLevelForTarget(), GetMaxSkillValueForLevel(), Player::GetMeleeCritFromAgility(), Player::GetQuestDialogStatus(), Player::GetQuestLevel(), Player::GetRatingMultiplier(), Creature::GetShieldBlockValue(), Player::GetSpellCritFromIntellect(), Player::GetsRecruitAFriendBonus(), Player::GetTotalItemLevel(), GetUnitMeleeSkill(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), WorldSession::HandleAcceptGrantLevel(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), WorldSession::HandleAuctionListItems(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), Player::HandleDrowning(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupAcceptOpcode(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WorldSession::HandleMessagechatOpcode(), npc_commandscript::HandleNpcInfoCommandShowCreature(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_pri_divine_aegis::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), reset_commandscript::HandleResetLevelCommand(), spell_wintergrasp_portal::HandleScript(), spell_item_scroll_of_recall::HandleScript(), WorldSession::HandleSendMail(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), Player::InitGlyphsForLevel(), npc_pet_hunter_snake_trap::InitializeAI(), lfg::LFGMgr::InitializeLockedDungeons(), Pet::InitLevelupSpellsForLevel(), Puppet::InitStats(), TempSummon::InitStats(), Player::InitStatsForLevel(), Pet::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Battlefield::InvitePlayerToWar(), Player::isHonorOrXPTarget(), Player::IsMaxLevel(), Player::LearnDefaultSkill(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), AchievementCriteriaData::Meets(), MeleeSpellHitResult(), npc_eagle_trash_aggro_trigger::MoveInLineOfSight(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), spell_item_with_mount_speed::OnApply(), item_generic_limit_chance_above_60::OnCastItemCombatSpell(), spell_item_mind_amplify_dish::OnDummyEffect(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), Player::OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), Player::PrepareGossipMenu(), Player::Regenerate(), Player::RegenerateHealth(), Player::RemovedInsignia(), Pet::removeSpell(), Pet::resetTalents(), Player::ResurrectPlayer(), Player::RewardHonor(), Player::RewardQuest(), RewardRage(), Player::RewardReputation(), RollMeleeOutcomeAgainst(), ArenaTeam::Roster(), Player::Satisfy(), Player::SatisfyQuestLevel(), Pet::SavePetToDB(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), WorldSession::SendLfgPlayerReward(), WorldSession::SendLfgRoleCheckUpdate(), Player::SendLoot(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), Player::SendQuestReward(), Player::SetRestBonus(), Guild::Member::SetStats(), SpellPctDamageModsDone(), SpellTakenCritChance(), Spell::SummonGuardian(), Player::SummonPet(), Pet::SynchronizeLevelWithOwner(), Aura::Update(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCombatSkills(), Creature::UpdateEntry(), and GameObject::Use().

◆ getLevelForTarget()

◆ GetMagicHitRedirectTarget()

Unit * Unit::GetMagicHitRedirectTarget ( Unit *  victim,
SpellInfo const *  spellInfo 
)
7960{
7961 if (!spellInfo->CanBeRedirectedBySpellMagnet())
7962 return victim;
7963
7965 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
7966 {
7967 if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
7968 if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
7969 //&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
7970 && _IsValidAttackTarget(magnet, spellInfo)
7971 /*&& IsWithinLOSInMap(magnet)*/)
7972 {
7973 // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number
7974 magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100));
7975
7976 if (magnet->IsTotem())
7977 {
7978 uint64 queueTime = magnet->m_Events.CalculateQueueTime(100);
7979 if (spellInfo->Speed > 0.0f)
7980 {
7981 float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
7982 if (dist < 5.0f)
7983 dist = 5.0f;
7984 queueTime = magnet->m_Events.CalculateTime((uint64)std::floor(dist / spellInfo->Speed * 1000.0f));
7985 }
7986
7987 magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
7988 }
7989
7990 return magnet;
7991 }
7992 }
7993 return victim;
7994}
@ SPELL_AURA_SPELL_MAGNET
Definition SpellAuraDefines.h:159
Definition TotemAI.h:47
Definition Unit.h:2368
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition Unit.cpp:10571
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1304

References _IsValidAttackTarget(), SpellInfo::CanBeRedirectedBySpellMagnet(), SpellInfo::CheckExplicitTarget(), GetAuraEffectsByType(), WorldObject::GetDistance(), Object::GetGUID(), SpellInfo::Speed, SPELL_AURA_SPELL_MAGNET, and SPELL_CAST_OK.

Referenced by WorldObject::GetMagicHitRedirectTarget().

◆ GetMaxHealth()

uint32 Unit::GetMaxHealth ( ) const
inline
@ UNIT_FIELD_MAXHEALTH
Definition UpdateFields.h:104

References Object::GetUInt32Value(), and UNIT_FIELD_MAXHEALTH.

Referenced by Player::_SaveStats(), Battleground::AddPlayer(), boss_viscidus::boss_viscidus(), WorldSession::BuildPartyMemberStatsChangedPacket(), lfg::BuildRBInternalInfo(), spell_item_skull_of_impeding_doom::CalculateDamageAmount(), CountPctFromMaxHealth(), boss_eregos::boss_eregosAI::DamageTaken(), npc_dark_fiend::DamageTaken(), boss_black_knight::DamageTaken(), npc_boombot::DamageTaken(), boss_yoggsaron::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::DamageTaken(), boss_viscidus::DamageTaken(), boss_twinemperorsAI::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_thorim::DamageTaken(), boss_grand_champion::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::DoAction(), Spell::EffectHealMaxHealth(), Spell::EffectSummonPet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), Acore::XP::Gain(), GetHealthGain(), GetHealthPct(), npc_echo_of_medivh::GetPiece(), spell_illidari_council_empyreal_balance::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), spell_pal_lay_on_hands::HandleMaxHealthHeal(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcInfoCommandShowCreature(), spell_dru_frenzied_regeneration::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceJustDied(), spell_pal_light_s_beacon::HandleProc(), spell_sha_nature_guardian::HandleProc(), spell_warr_item_t10_prot_4p_bonus::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_stinky_precious_decimate::HandleScript(), IsFullHealth(), boss_twin_valkyrAI::JustDied(), boss_twin_valkyrAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_ingvar_the_plunderer::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), ModifyHealth(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), Player::outDebugValues(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), npc_target_dummy::Reset(), Player::ResetAllPowers(), boss_prince_valanar_icc::boss_prince_valanarAI::ResetPrince(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), boss_yoggsaron::SetData(), SetFullHealth(), SetHealth(), boss_headless_horseman::SpellHit(), npc_necrotic_shard::SpellHit(), boss_black_knight::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_viscidus::SummonedCreatureDies(), boss_headless_horseman::UpdateAI(), npc_hor_lich_king::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), and Creature::UpdateEntry().

◆ GetMaxNegativeAuraModifier() [1/2]

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auratype) const

◆ GetMaxNegativeAuraModifier() [2/2]

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6088{
6089 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6090 if (mTotalAuraList.empty())
6091 return 0;
6092
6093 int32 modifier = 0;
6094 for (AuraEffect const* aurEff : mTotalAuraList)
6095 {
6096 if (predicate(aurEff))
6097 modifier = std::min(modifier, aurEff->GetAmount());
6098 }
6099
6100 return modifier;
6101}

References GetAuraEffectsByType().

◆ GetMaxNegativeAuraModifierByAffectMask()

int32 Unit::GetMaxNegativeAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6234{
6235 return GetMaxNegativeAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6236 {
6237 if (aurEff->IsAffectedOnSpell(affectedSpell))
6238 return true;
6239 return false;
6240 });
6241}

References GetMaxNegativeAuraModifier(), and AuraEffect::IsAffectedOnSpell().

◆ GetMaxNegativeAuraModifierByMiscMask()

int32 Unit::GetMaxNegativeAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
6154{
6155 return GetMaxNegativeAuraModifier(auraType, [miscMask](AuraEffect const* aurEff) -> bool
6156 {
6157 if ((aurEff->GetMiscValue() & miscMask) != 0)
6158 return true;
6159 return false;
6160 });
6161}

References GetMaxNegativeAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by SpellTakenCritChance().

◆ GetMaxNegativeAuraModifierByMiscValue()

int32 Unit::GetMaxNegativeAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6194{
6195 return GetMaxNegativeAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6196 {
6197 if (aurEff->GetMiscValue() == miscValue)
6198 return true;
6199 return false;
6200 });
6201}

References GetMaxNegativeAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by WorldObject::MagicSpellHitResult(), and WorldObject::ModSpellDuration().

◆ GetMaxPositiveAuraModifier() [1/2]

◆ GetMaxPositiveAuraModifier() [2/2]

int32 Unit::GetMaxPositiveAuraModifier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6072{
6073 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6074 if (mTotalAuraList.empty())
6075 return 0;
6076
6077 int32 modifier = 0;
6078 for (AuraEffect const* aurEff : mTotalAuraList)
6079 {
6080 if (predicate(aurEff))
6081 modifier = std::max(modifier, aurEff->GetAmount());
6082 }
6083
6084 return modifier;
6085}

References GetAuraEffectsByType().

◆ GetMaxPositiveAuraModifierByAffectMask()

int32 Unit::GetMaxPositiveAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6224{
6225 return GetMaxPositiveAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6226 {
6227 if (aurEff->IsAffectedOnSpell(affectedSpell))
6228 return true;
6229 return false;
6230 });
6231}

References GetMaxPositiveAuraModifier(), and AuraEffect::IsAffectedOnSpell().

◆ GetMaxPositiveAuraModifierByMiscMask()

int32 Unit::GetMaxPositiveAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask,
AuraEffect const *  except = nullptr 
) const
6144{
6145 return GetMaxPositiveAuraModifier(auraType, [miscMask, except](AuraEffect const* aurEff) -> bool
6146 {
6147 if (except != aurEff && (aurEff->GetMiscValue() & miscMask) != 0)
6148 return true;
6149 return false;
6150 });
6151}

References GetMaxPositiveAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by CalcAbsorbResist(), AuraEffect::HandleAuraModResistanceExclusive(), SpellTakenCritChance(), and UpdateResistanceBuffModsMod().

◆ GetMaxPositiveAuraModifierByMiscValue()

int32 Unit::GetMaxPositiveAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6184{
6185 return GetMaxPositiveAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6186 {
6187 if (aurEff->GetMiscValue() == miscValue)
6188 return true;
6189 return false;
6190 });
6191}

References GetMaxPositiveAuraModifier(), and AuraEffect::GetMiscValue().

Referenced by WorldObject::MagicSpellHitResult().

◆ GetMaxPower()

uint32 Unit::GetMaxPower ( Powers  power) const
inline
1150{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
@ UNIT_FIELD_MAXPOWER1
Definition UpdateFields.h:105

References Object::GetUInt32Value(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::_SaveStats(), WorldSession::BuildPartyMemberStatsChangedPacket(), lfg::BuildRBInternalInfo(), SpellInfo::CalcPowerCost(), spell_gen_replenishment_aura::CalculateAmount(), spell_item_skull_of_impeding_doom::CalculateManaLeechAmount(), Spell::CheckItems(), Player::Create(), boss_shade_of_aran::DamageTaken(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), GetPowerPct(), Player::GiveLevel(), Aura::HandleAuraSpecificMods(), modify_commandscript::HandleModifyEnergyCommand(), AuraEffect::HandleObsModPowerAuraTick(), spell_hun_rapid_recuperation::HandlePeriodic(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_dru_leader_of_the_pack::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_mage_magic_absorption::HandleProc(), spell_warl_improved_drain_soul::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_kelthuzad_detonate_mana_aura::HandleScript(), spell_hun_chimera_shot::HandleScriptEffect(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Vehicle::Install(), boss_curator::JustEngagedWith(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), boss_selin_fireheart::OnPowerUpdate(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), Player::outDebugValues(), spell_item_oracle_ablutions::PrepareSpellScript(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), spell_bronjahm_magic_bane::RecalculateDamage(), Creature::Regenerate(), Player::Regenerate(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetPower(), setPowerType(), Player::SummonPet(), boss_moam::UpdateAI(), boss_faction_championsAI::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetMaxSkillValueForLevel()

uint16 Unit::GetMaxSkillValueForLevel ( Unit const *  target = nullptr) const
inline

◆ GetMechanicResistChance()

int32 Unit::GetMechanicResistChance ( SpellInfo const *  spell)
3332{
3333 if (!spell)
3334 return 0;
3335 int32 resist_mech = 0;
3336 for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
3337 {
3338 if (!spell->Effects[eff].IsEffect())
3339 break;
3340 int32 effect_mech = spell->GetEffectMechanic(eff);
3341 if (effect_mech)
3342 {
3344 if (resist_mech < temp)
3345 resist_mech = temp;
3346 }
3347 }
3348 return resist_mech;
3349}
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition SpellAuraDefines.h:180
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6163

References SpellInfo::Effects, SpellInfo::GetEffectMechanic(), GetTotalAuraModifierByMiscValue(), MAX_SPELL_EFFECTS, and SPELL_AURA_MOD_MECHANIC_RESISTANCE.

Referenced by WorldObject::MagicSpellHitResult(), and MeleeSpellHitResult().

◆ GetMeleeAttackPoint()

bool Unit::GetMeleeAttackPoint ( Unit *  attacker,
Position &  pos 
)
2870{
2871 if (!attacker)
2872 {
2873 return false;
2874 }
2875
2876 AttackerSet attackers = getAttackers();
2877
2878 if (attackers.size() <= 1) // if the attackers are not more than one
2879 {
2880 return false;
2881 }
2882
2883 float meleeReach = GetExactDist2d(attacker);
2884 if (meleeReach <= 0)
2885 {
2886 return false;
2887 }
2888
2889 float minAngle = 0;
2890 Unit *refUnit = nullptr;
2891 uint32 validAttackers = 0;
2892
2893 double attackerSize = attacker->GetCollisionRadius();
2894
2895 for (auto const& otherAttacker: attackers)
2896 {
2897 // if the otherAttacker is not valid, skip
2898 if (!otherAttacker || otherAttacker->GetGUID() == attacker->GetGUID() ||
2899 !otherAttacker->IsWithinMeleeRange(this) || otherAttacker->isMoving())
2900 {
2901 continue;
2902 }
2903
2904 float curretAngle = atan(attacker->GetExactDist2d(otherAttacker) / meleeReach);
2905 if (minAngle == 0 || curretAngle < minAngle)
2906 {
2907 minAngle = curretAngle;
2908 refUnit = otherAttacker;
2909 }
2910
2911 validAttackers++;
2912 }
2913
2914 if (!validAttackers || !refUnit)
2915 {
2916 return false;
2917 }
2918
2919 float contactDist = attackerSize + refUnit->GetCollisionRadius();
2920 float requiredAngle = atan(contactDist / meleeReach);
2921 float attackersAngle = atan(attacker->GetExactDist2d(refUnit) / meleeReach);
2922
2923 // in instance: the more attacker there are, the higher will be the tollerance
2924 // outside: creatures should not intersecate
2925 float angleTollerance = attacker->GetMap()->IsDungeon() ? requiredAngle - requiredAngle * tanh(validAttackers / 5.0f) : requiredAngle;
2926
2927 if (attackersAngle > angleTollerance)
2928 {
2929 return false;
2930 }
2931
2932 double angle = atan(contactDist / meleeReach);
2933
2934 float angularRadius = frand(0.1f, 0.3f) + angle;
2935 int8 direction = (urand(0, 1) ? -1 : 1);
2936 float currentAngle = GetAngle(refUnit);
2937 float absAngle = currentAngle + angularRadius * direction;
2938
2939 float x, y, z;
2940 float distance = meleeReach - GetObjectSize();
2941 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle);
2942
2943 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2944 {
2945 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle * -1); // try the other side
2946
2947 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2948 {
2949 return false;
2950 }
2951 }
2952
2953 pos.Relocate(x, y, z);
2954
2955 return true;
2956}
std::int8_t int8
Definition Define.h:105
float frand(float min, float max)
Definition Random.cpp:57
bool IsDungeon() const
Definition Map.h:299
float GetCollisionRadius() const override
this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by t...
Definition Unit.cpp:16884
std::unordered_set< Unit * > AttackerSet
Definition Unit.h:672
AttackerSet const & getAttackers() const
Definition Unit.h:907
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition Object.cpp:2759
float GetExactDist2d(const float x, const float y) const
Definition Position.h:170

References frand(), Position::GetAngle(), getAttackers(), GetCollisionRadius(), Position::GetExactDist2d(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetNearPoint(), WorldObject::GetObjectSize(), Map::IsDungeon(), Position::Relocate(), and urand().

Referenced by MotionMaster::MoveCircleTarget().

◆ GetMeleeCritChanceReduction()

float Unit::GetMeleeCritChanceReduction ( ) const
inline

◆ GetMeleeCritDamageReduction()

uint32 Unit::GetMeleeCritDamageReduction ( uint32  damage) const
inline
1291{ return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
Definition Unit.cpp:15140

References CR_CRIT_TAKEN_MELEE, and GetCombatRatingDamageReduction().

Referenced by ApplyResilience(), and processDummyAuras().

◆ GetMeleeDamageReduction()

uint32 Unit::GetMeleeDamageReduction ( uint32  damage) const
inline

◆ GetMeleeDamageSchoolMask()

virtual SpellSchoolMask Unit::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
pure virtual

Implemented in Player, and Creature.

Referenced by CalculateMeleeDamage().

◆ GetMeleeHitRedirectTarget()

Unit * Unit::GetMeleeHitRedirectTarget ( Unit *  victim,
SpellInfo const *  spellInfo = nullptr 
)
7997{
7999 for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
8000 {
8001 if (Unit* magnet = (*i)->GetBase()->GetCaster())
8002 if (_IsValidAttackTarget(magnet, spellInfo) && magnet->IsWithinLOSInMap(this)
8003 && (!spellInfo || (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
8004 && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
8005 if (roll_chance_i((*i)->GetAmount()))
8006 {
8007 (*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
8008 return magnet;
8009 }
8010 }
8011 return victim;
8012}
bool roll_chance_i(int chance)
Definition Random.h:63
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition SpellAuraDefines.h:174

References _IsValidAttackTarget(), AURA_REMOVE_BY_EXPIRE, SpellInfo::CheckExplicitTarget(), SpellInfo::CheckTarget(), GetAuraEffectsByType(), roll_chance_i(), SPELL_AURA_ADD_CASTER_HIT_TRIGGER, and SPELL_CAST_OK.

Referenced by AttackerStateUpdate(), WorldObject::GetMeleeHitRedirectTarget(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ GetMeleeRange()

float Unit::GetMeleeRange ( Unit const *  target) const
808{
809 float range = GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
810 return std::max(range, NOMINAL_MELEE_RANGE);
811}
#define NOMINAL_MELEE_RANGE
Definition ObjectDefines.h:47
float GetCombatReach() const override
Definition Unit.h:884

References GetCombatReach(), and NOMINAL_MELEE_RANGE.

Referenced by Spell::CheckRange(), SmartAI::DistanceYourself(), GetRandomContactPoint(), IsWithinMeleeRange(), CreatureAI::MoveBackwardsChecks(), and SmartScript::ProcessAction().

◆ GetMeleeReach()

float Unit::GetMeleeReach ( ) const
inline
885{ float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; }
#define MIN_MELEE_REACH
Definition ObjectDefines.h:46

References Object::m_floatValues, MIN_MELEE_REACH, and UNIT_FIELD_COMBATREACH.

Referenced by boss_veknilash::JustEngagedWith(), and npc_rookery_hatcher::UpdateAI().

◆ GetMinionGUID()

ObjectGuid Unit::GetMinionGUID ( ) const
inline
@ UNIT_FIELD_SUMMON
Definition UpdateFields.h:87

References Object::GetGuidValue(), and UNIT_FIELD_SUMMON.

Referenced by GetFirstControlled(), GetFirstMinion(), and OutDebugInfo().

◆ GetModelForForm()

uint32 Unit::GetModelForForm ( ShapeshiftForm  form,
uint32  spellId 
)
15147{
15148 // Hardcoded cases
15149 switch (spellId)
15150 {
15151 case 7090: // Bear form
15152 return 29414;
15153 case 35200: // Roc form
15154 return 4877;
15155 default:
15156 break;
15157 }
15158
15159 if (IsPlayer())
15160 {
15161 if (uint32 ModelId = sObjectMgr->GetModelForShapeshift(form, ToPlayer()))
15162 return ModelId;
15163 }
15164
15165 uint32 modelid = 0;
15166 SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(form);
15167 if (formEntry && formEntry->modelID_A)
15168 {
15169 // Take the alliance modelid as default
15170 if (!IsPlayer())
15171 return formEntry->modelID_A;
15172 else
15173 {
15175 modelid = formEntry->modelID_A;
15176 else
15177 modelid = formEntry->modelID_H;
15178
15179 // If the player is horde but there are no values for the horde modelid - take the alliance modelid
15180 if (!modelid && Player::TeamIdForRace(getRace()) == TEAM_HORDE)
15181 modelid = formEntry->modelID_A;
15182 }
15183 }
15184
15185 return modelid;
15186}
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
static TeamId TeamIdForRace(uint8 race)
Definition Player.cpp:6033
uint8 getRace(bool original=false) const
Definition Unit.cpp:16796
uint32 modelID_H
Definition DBCStructure.h:1863
uint32 modelID_A
Definition DBCStructure.h:1862

References getRace(), Object::IsPlayer(), SpellShapeshiftFormEntry::modelID_A, SpellShapeshiftFormEntry::modelID_H, sObjectMgr, sSpellShapeshiftFormStore, TEAM_ALLIANCE, TEAM_HORDE, Player::TeamIdForRace(), and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), and RestoreDisplayId().

◆ GetMotionMaster() [1/2]

MotionMaster * Unit::GetMotionMaster ( )
inline
1774{ return i_motionMaster; }

References i_motionMaster.

Referenced by _ExitVehicle(), HomeMovementGenerator< Creature >::_setTargetLocation(), PetAI::_stopAttack(), npc_rocknot::AbortLovePotionEvent(), BattlegroundAV::AddAVCreature(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::ArmHiddenState(), AtEngage(), Creature::AtEngage(), UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::AttackStart(), npc_nexus_lord::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_lady_malande::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), UnitAI::AttackStartCaster(), Creature::CanCreatureAttack(), Pet::CastPendingSpell(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), npc_highlord_darion_mograine::ChargeToOutroPoint(), CleanupBeforeRemoveFromMap(), boss_alar::ConstructWaypointsAndMove(), boss_isalien::DamageTaken(), boss_julianne::DamageTaken(), boss_grand_champion::DamageTaken(), npc_frost_sphere::DamageTaken(), boss_bronjahm::DamageTaken(), npc_power_spark::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_wild_wyrm::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::DamageTaken(), SmartAI::DistanceYourself(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_rocknot::DoAction(), boss_nightbane::DoAction(), npc_apothecary_genericAI::DoAction(), npc_harrison_jones::DoAction(), npc_amanishi_lookout::DoAction(), npc_chained_spirit::DoAction(), boss_anetheron::DoAction(), boss_azgalor::DoAction(), boss_kazrogal::DoAction(), boss_rage_winterchill::DoAction(), npc_hyjal_ground_trash::DoAction(), npc_hyjal_gargoyle::DoAction(), npc_hyjal_frost_wyrm::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_hadronox_crusherPackAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_argent_captainAI::DoAction(), npc_icc_spire_frostwyrm::DoAction(), brann_bronzebeard::DoAction(), boss_algalon_the_observer::DoAction(), npc_brann_bronzebeard_algalon::DoAction(), npc_ulduar_hodir_priest::DoAction(), npc_ulduar_hodir_druid::DoAction(), npc_ulduar_hodir_shaman::DoAction(), npc_ulduar_hodir_mage::DoAction(), boss_razorscale::DoAction(), npc_expedition_defender::DoAction(), npc_expedition_trapper::DoAction(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::DoAction(), npc_ahune_bunny::DoAction(), npc_kalecgos_kj::DoAction(), npc_anubarak_spike::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_power_spark::DoAction(), npc_hover_disk::DoAction(), npc_spark_of_ionar::DoAction(), npc_ulduar_aerial_command_unit::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_maiev_illidan::DoAction(), npc_akama_shade::DoAction(), boss_nazan::DoAction(), boss_ghazan::DoAction(), PetAI::DoAttack(), Creature::DoFleeToGetAssistance(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), brann_bronzebeard::DoMarnakDarkMatter(), ScriptedAI::DoStartMovement(), ScriptedAI::DoStartNoMovement(), go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), spell_halion_twilight_phasing_aura::DropCombat(), Spell::EffectCharge(), Spell::EffectChargeDest(), Spell::EffectDistract(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectPullTowards(), Spell::EffectSummonType(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::EndBattle(), brann_bronzebeard::EndTribunalFight(), boss_jindo::EnterEvadeMode(), npc_black_morass_summoned_add::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), brann_bronzebeard::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), npc_burning_spirit::EnterEvadeMode(), boss_doomrel::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_halazzi::EnterPhase(), boss_zuljin::EnterPhase(), VehicleDespawnEvent::Execute(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), NpcRunToHome::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), FrostwyrmLandEvent::Execute(), SACActivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), AssistanceMovementGenerator::Finalize(), npc_singularity::FindAndFollowTarget(), npc_dark_iron_guzzler::FindNextKeg(), npc_hallows_end_soh::FinishEvent(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_nightbane::FlyToClosestPreFlyWayPoint(), Creature::FocusTarget(), CreatureGroup::FormationReset(), boss_volkhan::GoToAnvil(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), npc_mistress_nagmara::GreetRocknot(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleAppearCommand(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_icc_geist_alarm::HandleEvent(), boss_sartharion_dragonAI::HandleExtraEvent(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), WorldSession::HandleGossipHelloOpcode(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), spell_chapter2_persuasive_strike::HandleHit(), boss_malygos::HandleIntroSpeech(), spell_item_toxic_wasteling::HandleJump(), spell_icehowl_jump_back::HandleLeapBack(), AuraEffect::HandleModPossessPet(), misc_commandscript::HandleMovegensCommand(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcUnFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), spell_entropius_black_hole_effect::HandlePull(), spell_boss_magus_telestra_gravity_well::HandlePull(), WorldSession::HandleQuestgiverHelloOpcode(), PetAI::HandleReturnMovement(), spell_vehicle_throw_passenger::HandleScript(), spell_the_lich_king_valkyr_target_search::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_gen_ayamiss_swarmer_loop::HandleScript(), WorldSession::HandleSetRaidDifficultyOpcode(), spell_sindragosa_icy_grip_jump::HandleSpecial(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), spell_item_draenic_pale_ale::HandleSummon(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpUnLoadCommand(), boss_felmyst::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_lieutenant_drake::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), boss_eck::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), boss_grand_warlock_nethekurse::IntroRP(), Creature::IsFreeToMove(), IsMutualChase(), boss_gahzranka::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), boss_yoggsaron_death_ray::IsSummonedBy(), npc_plague_cauldron_ghoul::IsSummonedBy(), npc_burning_spirit::IsSummonedBy(), npc_demonic_vapor::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), boss_kologarn_eyebeam::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_kservant::npc_kservantAI::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), Creature::IsUpdateNeeded(), JumpTo(), JumpTo(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), boss_ayamiss::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_cyclone::JustEngagedWith(), npc_sunblade_scout::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_amanishi_scout::JustEngagedWith(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_grandmaster_vorpil::JustEngagedWith(), boss_warlord_kalithresh::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nazan::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_felmyst::JustEngagedWith(), boss_janalai::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_alar::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), SmartAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), boss_ghazan::JustReachedHome(), boss_grand_warlock_nethekurse::JustReachedHome(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), npc_highlord_darion_mograine::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_frosthound::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_mekgineer_steamrigger::JustSummoned(), npc_hor_lich_king::JustSummoned(), npc_ulduar_storm_tempered_keeper::JustSummoned(), boss_ingvar_the_plunderer::JustSummoned(), boss_vexallus::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_janalai::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_sartharion::JustSummoned(), boss_novos::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_skadi::boss_skadiAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_overlord_drakuru_betrayal::JustSummoned(), npc_akama_shade::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), boss_mennu_the_betrayer::JustSummoned(), boss_kaelthas::JustSummoned(), boss_mechano_lord_capacitus::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_ichoron::JustSummoned(), boss_xevozz::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), Player::KillPlayer(), KnockbackFrom(), npc_plague_cauldron_ghoul::Land(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderStartedMoving(), Player::LeaveBattleground(), npc_crystalline_frayer::LeaveSeedPod(), LightOfDawnStartMarch(), Creature::Motion_Initialize(), CreatureAI::MoveBackwardsChecks(), boss_yoggsaron_cloud::MoveCircle(), CreatureAI::MoveCircleChecks(), boss_hadronox::MoveDownRamp(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), PetAI::MovementInform(), boss_ebonroc::MovementInform(), boss_nightbane::MovementInform(), npc_harrison_jones::MovementInform(), boss_bug_trio::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_malygos::MovementInform(), boss_volkhan::MovementInform(), brann_bronzebeard::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_wild_wyrm::MovementInform(), npc_akama_illidan::MovementInform(), boss_nazan::MovementInform(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), npc_rocknot::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_razorscale::MovementInform(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_cameron::MoveTheChildren(), npc_mistress_nagmara::MoveToApproachPoint(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_mistress_nagmara::MoveToGreetingPosition(), npc_janalai_hatcher::MoveToNewWaypoint(), npc_sorlof::MoveToNextNode(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_concentrated_ball::MoveToRandomStalker(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), boss_onyxia::MoveToWaypoint(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), NearTeleportTo(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_collapsing_star::npc_collapsing_star(), npc_frost_sphere::npc_frost_sphere(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vapors(), SmartAI::OnCharmed(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_hyjal_jaina::OnGossipSelect(), npc_kernobee::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), spell_chapter5_light_of_dawn_aura::OnRemove(), spell_malygos_vortex_visual::OnRemove(), npc_nerubian_burrower::OnSpellCast(), SplineHandler::operator()(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_wild_wyrm::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_dusk::PassengerBoarded(), npc_preparations_for_war_vehicle::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_anetheron::PathEndReached(), boss_rage_winterchill::PathEndReached(), npc_hyjal_ground_trash::PathEndReached(), npc_hyjal_frost_wyrm::PathEndReached(), boss_ambassador_hellmaw::PathEndReached(), npc_akama_illidan::PathEndReached(), boss_nefarian::PathEndReached(), npc_hyjal_gargoyle::PathEndReached(), PauseMovement(), Creature::PauseMovementForInteraction(), SmartAI::PausePath(), PetSpellFail(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), propagateSpeedChange(), npc_mistress_nagmara::ReachLoversStop(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), RemoveCharmedBy(), CreatureGroup::RemoveFormationMovement(), npc_phalanx::Reset(), npc_mistress_nagmara::Reset(), npc_rocknot::Reset(), boss_the_beast::Reset(), boss_felblood_kaelthas::Reset(), npc_acherus_necromancer::Reset(), npc_gothik_the_harvester::Reset(), npc_valkyr_battle_maiden::Reset(), boss_janalai::Reset(), npc_janalai_hatcher::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), npc_batrider::Reset(), npc_brew_bubble::Reset(), boss_archimonde::Reset(), boss_ayamiss::Reset(), boss_bug_trio::Reset(), boss_jedoga_shadowseeker::Reset(), boss_taldaram::Reset(), npc_fos_corrupted_soul_fragment::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_crystalline_frayer::Reset(), npc_assembly_lightning::Reset(), boss_kologarn::Reset(), npc_scrapbot::Reset(), npc_boombot::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), npc_voidtraveler::Reset(), boss_lady_vashj::Reset(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), npc_mistress_nagmara::ResetLovePotionEvent(), Creature::Respawn(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), ResumeMovement(), SmartAI::ResumePath(), Resurrect(), npc_snobold_vassal::npc_snobold_vassalAI::ReturnToGormok(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), boss_alar::ScheduleAbilities(), boss_illidan_stormrage::ScheduleAbilities(), boss_magtheridon::ScheduleCombatEvents(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), boss_grand_champion::ScheduleFindNewMount(), boss_felmyst::ScheduleGroundAbilities(), boss_nightbane::ScheduleLand(), boss_drakkari_colossus::boss_drakkari_colossusAI::ScheduleTasks(), boss_loken::ScheduleTasks(), boss_laj::ScheduleTasks(), Map::ScriptsProcess(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::SelectNewTarget(), WorldSession::SendDoFlight(), boss_sartharion::SendLavaWaves(), WorldSession::SendListInventory(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SendSaurfangCampWorkerOut(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetConfused(), SmartAI::SetCurrentRangeMode(), boss_grand_warlock_nethekurse::SetData(), gunship_npc_AI::SetData(), npc_enslaved_proto_drake::SetData(), boss_the_beast::SetData(), npc_eastvale_peasent::SetData(), setDeathState(), Creature::setDeathState(), SetFeared(), SmartAI::SetFollow(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), boss_gormok::boss_gormokAI::SetGUID(), npc_scarlet_ghoul::SetGUID(), Player::SetMover(), SetSpeed(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_mistress_nagmara::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_akama_illidan::sGossipSelect(), npc_akama_shade::sGossipSelect(), boss_thorim::SpawnAnArenaNPC(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), boss_attumen::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_forest_frog::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_wild_wyrm::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::SpellHitTarget(), npc_nerubian_burrower::SpellHitTarget(), boss_devourer_of_souls::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_escortAI::Start(), npc_phalanx::StartActivation(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), PetAI::StartChase(), npc_koltira_deathweaver::StartEvent(), FollowerAI::StartFollow(), boss_felmyst::StartIntro(), instance_ulduar::instance_ulduar_InstanceMapScript::StartLeviathanOutroSequence(), npc_mistress_nagmara::StartLoversRoute(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), SmartAI::StartPath(), SmartAI::StopFollow(), SmartAI::StopPath(), npc_expedition_engineer::StopRepairing(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vazruden_the_herald::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Spell::SummonGuardian(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), Acore::PlayerCommand::SummonOnlinePlayer(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SummonSaurfangCampVendor(), Player::TeleportTo(), CreatureAI::TriggerAlert(), Update(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_gyth::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::UpdateAI(), npc_rookery_hatcher::UpdateAI(), boss_victor_nefarius::UpdateAI(), boss_majordomo::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_scarlet_ghoul::UpdateAI(), npc_acherus_necromancer::UpdateAI(), npc_gothik_the_harvester::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_valkyr_battle_maiden::UpdateAI(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_akilzon_eagle::UpdateAI(), npc_forest_frog::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), boss_hadronox::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_nerubian_burrower::UpdateAI(), npc_anubarak_spike::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_fos_corrupted_soul_fragment::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_saurfang_event::npc_saurfang_eventAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), npc_power_spark::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_spark_of_ionar::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_brann_bronzebeard_algalon::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_flame_leviathan::UpdateAI(), npc_hodirs_fury::UpdateAI(), boss_flame_leviathan_safety_container::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_emergency_fire_bot::UpdateAI(), boss_razorscale::UpdateAI(), npc_expedition_engineer::UpdateAI(), boss_yoggsaron_death_ray::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_batrider::UpdateAI(), Player::UpdateCharmedAI(), npc_rocknot::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_jenny::UpdateFollowerAI(), npc_dusk::WaypointReached(), npc_emily::npc_emilyAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ GetMotionMaster() [2/2]

MotionMaster const * Unit::GetMotionMaster ( ) const
inline
1775{ return i_motionMaster; }

References i_motionMaster.

◆ GetMountID()

◆ GetNativeDisplayId()

◆ GetNativeObjectScale()

virtual float Unit::GetNativeObjectScale ( ) const
inlinevirtual

Reimplemented in Creature, and TestCreature.

1994{ return 1.0f; }

Referenced by RecalculateObjectScale().

◆ GetNegStat()

float Unit::GetNegStat ( Stats  stat) const
inline
1081{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_NEGSTAT0.

◆ GetNextRandomRaidMemberOrPet()

Unit * Unit::GetNextRandomRaidMemberOrPet ( float  radius)
8061{
8062 Player* player = nullptr;
8063 if (IsPlayer())
8064 player = ToPlayer();
8065 // Should we enable this also for charmed units?
8066 else if (IsCreature() && IsPet())
8067 player = GetOwner()->ToPlayer();
8068
8069 if (!player)
8070 return nullptr;
8071 Group* group = player->GetGroup();
8072 // When there is no group check pet presence
8073 if (!group)
8074 {
8075 // We are pet now, return owner
8076 if (player != this)
8077 return IsWithinDistInMap(player, radius) ? player : nullptr;
8078 Unit* pet = GetGuardianPet();
8079 // No pet, no group, nothing to return
8080 if (!pet)
8081 return nullptr;
8082 // We are owner now, return pet
8083 return IsWithinDistInMap(pet, radius) ? pet : nullptr;
8084 }
8085
8086 std::vector<Unit*> nearMembers;
8087 // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
8088 nearMembers.reserve(group->GetMembersCount() * 2);
8089
8090 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
8091 if (Player* Target = itr->GetSource())
8092 {
8093 if (Target != this && !IsWithinDistInMap(Target, radius))
8094 continue;
8095
8096 // IsHostileTo check duel and controlled by enemy
8097 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
8098 nearMembers.push_back(Target);
8099
8100 // Push player's pet to vector
8101 if (Unit* pet = Target->GetGuardianPet())
8102 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
8103 nearMembers.push_back(pet);
8104 }
8105
8106 if (nearMembers.empty())
8107 return nullptr;
8108
8109 uint32 randTarget = urand(0, nearMembers.size() - 1);
8110 return nearMembers[randTarget];
8111}
Definition GroupReference.h:27
Definition Group.h:178
uint32 GetMembersCount() const
Definition Group.h:255
GroupReference * GetFirstMember()
Definition Group.h:253
Group * GetGroup()
Definition Player.h:2514
Guardian * GetGuardianPet() const
Definition Unit.cpp:7585
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1386

References Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), Group::GetMembersCount(), GetOwner(), Object::IsCreature(), IsHostileTo(), IsPet(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), Object::ToPlayer(), and urand().

Referenced by HandleAuraRaidProcFromCharge(), and AuraEffect::HandleRaidProcFromChargeAuraProc().

◆ GetNpcFlags()

◆ GetOldFactionId()

uint32 Unit::GetOldFactionId ( ) const
inline
861{ return _oldFactionId; }

References _oldFactionId.

Referenced by npc_chesspiece::OnCharmed().

◆ GetOwnedAura()

Aura * Unit::GetOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
Aura *  except = nullptr 
) const
4808{
4809 AuraMapBounds range = m_ownedAuras.equal_range(spellId);
4810 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
4811 {
4812 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
4813 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
4814 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
4815 && (!except || except != itr->second))
4816 {
4817 return itr->second;
4818 }
4819 }
4820 return nullptr;
4821}
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition Unit.h:676

References m_ownedAuras.

Referenced by _TryStackingOrRefreshingExistingAura().

◆ GetOwnedAuras() [1/2]

◆ GetOwnedAuras() [2/2]

AuraMap const & Unit::GetOwnedAuras ( ) const
inline
1391{ return m_ownedAuras; }

References m_ownedAuras.

◆ GetOwner()

Unit * Unit::GetOwner ( ) const
Todo:
: move this in Object class or move GetUInt32value here but keep consistency
7535{
7536 if (ObjectGuid ownerGUID = GetOwnerGUID())
7537 return ObjectAccessor::GetUnit(*this, ownerGUID);
7538
7539 return nullptr;
7540}

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by _ExitVehicle(), Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck(), ApplyDiminishingToDuration(), ApplyResilience(), TotemAI::AttackStart(), spell_dk_anti_magic_zone::CalculateAmount(), spell_warl_generic_scaling::CalculateAPAmount(), npc_pet_dk_army_of_the_dead::CanAIAttack(), Creature::CanStartAttack(), spell_pri_mana_leech::CheckProc(), ClearInPetCombat(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), DealHeal(), npc_spring_rabbit::npc_spring_rabbitAI::DoAction(), Spell::DoAllEffectOnLaunchTarget(), Spell::DoAllEffectOnTarget(), PetAI::DoAttack(), Spell::EffectDispel(), Spell::EffectSchoolDMG(), Spell::EffectSummonType(), Spell::EffectWeaponDmg(), boss_illidari_council_memberAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::EnterEvadeMode(), ThreatManager::ForwardThreatForAssistingMe(), GetCharmerOrOwner(), GetCombatRatingReduction(), Spell::GetLOSCollisionHeight(), GetNextRandomRaidMemberOrPet(), GetReactionTo(), WorldObject::GetSpellModOwner(), GetSpellModOwner(), spell_warl_seduction::HandleAuraApply(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), debug_commandscript::HandleDebugThreatListCommand(), spell_sha_healing_stream_totem::HandleDummy(), spell_q12277_wintergarde_mine_explosion::HandleDummy(), spell_sha_mana_tide_totem::HandleDummy(), spell_mount_check_aura::HandleEffectPeriodic(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), modify_commandscript::HandleModifyTalentCommand(), WorldSession::HandlePetActionHelper(), spell_hun_kill_command_pet::HandleProc(), spell_warl_demonic_pact::HandleProc(), spell_sha_spirit_hunt::HandleProc(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12698_the_gift_that_keeps_on_giving::HandleScriptEffect(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_pet_dk_dancing_rune_weapon::InitializeAI(), npc_pet_hunter_snake_trap::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), IsAlwaysVisibleFor(), IsPetAura(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::JustDied(), Kill(), WorldObject::MagicSpellHitResult(), MeleeDamageBonusDone(), npc_dkc1_gothik::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_hun_aspect_of_the_beast::OnPetApply(), Acore::MostHPMissingGroupInRange::operator()(), PetSpellFail(), RemoveFromWorld(), npc_target_dummy::Reset(), npc_spring_rabbit::npc_spring_rabbitAI::Reset(), RestoreFaction(), Creature::SelectVictim(), SendPetActionFeedback(), SendPetAIReaction(), SetHealth(), SetMaxHealth(), SetMaxPower(), SetPower(), setPowerType(), SetStunned(), SpellDamageBonusDone(), SpellHealingBonusDone(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), Spell::SummonGuardian(), npc_pet_gen_wind_rider_cub::UpdateAI(), and UpdateAuraForGroup().

◆ GetOwnerGUID()

ObjectGuid Unit::GetOwnerGUID ( ) const
inlineoverridevirtual

Reimplemented from WorldObject.

@ UNIT_FIELD_SUMMONEDBY
Definition UpdateFields.h:90

References Object::GetGuidValue(), and UNIT_FIELD_SUMMONEDBY.

Referenced by Pet::AddToWorld(), BuildValuesUpdate(), PetAI::CanAttack(), CanFreeMove(), Spell::CheckRange(), boss_thorim_start_npcs::DamageTaken(), DealDamage(), Spell::DoAllEffectOnTarget(), FollowMovementGenerator< T >::DoUpdate(), GetCharmerOrOwnerGUID(), GetOwner(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModStealthLevel(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetRename(), HandleSpellClick(), Creature::HasMechanicTemplateImmunity(), Creature::IsDungeonBoss(), Creature::IsImmuneToKnockback(), isInAccessiblePlaceFor(), npc_living_mojo::npc_living_mojoAI::JustEngagedWith(), Kill(), Condition::Meets(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_venomhide_hatchling::OnGossipHello(), Acore::MostHPMissingGroupInRange::operator()(), PlayerOrPetCheck::operator()(), OutDebugInfo(), PetAI::ReceiveEmote(), Creature::Regenerate(), RemoveAllControlled(), RemoveEvadeAuras(), Pet::SavePetToDB(), spell_item_fetch_ball::SelectTarget(), SetMinion(), SetOwnerGUID(), SpellPctDamageModsDone(), Map::SummonCreature(), NPCStaveQuestAI::UnitIsUnfair(), Creature::Update(), and npc_pet_dk_ebon_gargoyle::UpdateAI().

◆ GetPartyMembers()

void Unit::GetPartyMembers ( std::list< Unit * > &  units)
14798{
14799 Unit* owner = GetCharmerOrOwnerOrSelf();
14800 Group* group = nullptr;
14801 if (owner->IsPlayer())
14802 group = owner->ToPlayer()->GetGroup();
14803
14804 if (group)
14805 {
14806 uint8 subgroup = owner->ToPlayer()->GetSubGroup();
14807
14808 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
14809 {
14810 Player* Target = itr->GetSource();
14811
14812 // IsHostileTo check duel and controlled by enemy
14813 if (Target && Target->IsInMap(owner) && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
14814 {
14815 if (Target->IsAlive())
14816 TagUnitMap.push_back(Target);
14817
14818 for (Unit::ControlSet::iterator iterator = Target->m_Controlled.begin(); iterator != Target->m_Controlled.end(); ++iterator)
14819 {
14820 if (Unit* pet = *iterator)
14821 if (pet->IsGuardian() && pet->IsAlive())
14822 TagUnitMap.push_back(pet);
14823 }
14824 }
14825 }
14826 }
14827 else
14828 {
14829 if (owner->IsAlive())
14830 TagUnitMap.push_back(owner);
14831
14832 for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
14833 {
14834 if (Unit* pet = *itr)
14835 if (pet->IsGuardian() && pet->IsAlive())
14836 TagUnitMap.push_back(pet);
14837 }
14838 }
14839}
uint8 GetSubGroup() const
Definition Player.h:2518
Unit * GetCharmerOrOwnerOrSelf() const
Definition Unit.h:1304

References GetCharmerOrOwnerOrSelf(), Group::GetFirstMember(), Player::GetGroup(), Player::GetSubGroup(), IsAlive(), IsHostileTo(), WorldObject::IsInMap(), Object::IsPlayer(), m_Controlled, and Object::ToPlayer().

Referenced by spell_warr_improved_spell_reflection_trigger_aura::HandleRemove().

◆ GetPctModifierValue()

◆ GetPetGUID()

◆ GetPhaseByAuras()

uint32 Unit::GetPhaseByAuras ( ) const
15017{
15018 uint32 currentPhase = 0;
15020 if (!phases.empty())
15021 for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
15022 currentPhase |= (*itr)->GetMiscValue();
15023
15024 return currentPhase;
15025}
@ SPELL_AURA_PHASE
Definition SpellAuraDefines.h:324

References GetAuraEffectsByType(), and SPELL_AURA_PHASE.

Referenced by Player::GetPhaseMaskForSpawn(), AuraEffect::HandlePhase(), and Player::SetGameMaster().

◆ GetPosStat()

float Unit::GetPosStat ( Stats  stat) const
inline
1080{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_POSSTAT0.

◆ GetPower()

uint32 Unit::GetPower ( Powers  power) const
inline
1149{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
@ UNIT_FIELD_POWER1
Definition UpdateFields.h:97

References Object::GetUInt32Value(), and UNIT_FIELD_POWER1.

Referenced by PetAI::_canMeleeAttack(), Player::_SaveCharacter(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_igb_cannon_blast::CalculatePower(), Creature::CanCastSpell(), Spell::CheckItems(), Spell::CheckPower(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), Spell::EffectCastButtons(), Spell::EffectWeaponDmg(), Pet::FillPetInfo(), Pet::GetHappinessState(), GetPowerPct(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), AuraEffect::HandleObsModPowerAuraTick(), spell_dk_pet_scaling::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetAbandon(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_pal_lay_on_hands::HandleScript(), Player::InitStatsForLevel(), SmartAI::IsMainSpellPrevented(), boss_shade_of_aran::JustEngagedWith(), npc_obsidian_destroyer::JustEngagedWith(), spell_gen_replenishment_aura::Load(), Pet::LoseHappiness(), ModifyPower(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), SmartScript::ProcessAction(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Pet::SavePetToDB(), Creature::SaveToDB(), ScriptedAI::SelectSpell(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetMaxPower(), SetPower(), setPowerType(), spell_igb_incinerating_blast::StoreEnergy(), TEST_F(), Aura::Update(), boss_moam::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), PetAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetPowerPct()

float Unit::GetPowerPct ( Powers  power) const
inline
1151{ return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1150
uint32 GetPower(Powers power) const
Definition Unit.h:1149

References GetMaxPower(), and GetPower().

Referenced by npc_obsidian_destroyer::JustEngagedWith(), npc_obsidian_eradicator::JustEngagedWith(), npc_obsidian_nullifier::JustEngagedWith(), boss_curator::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), and boss_hazzarah::UpdateAI().

◆ getPowerType()

Powers Unit::getPowerType ( ) const
inline
1145{ return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
Powers
Definition SharedDefines.h:256

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by boss_marli::_chargePlayer(), Player::ActivateSpec(), WorldSession::BuildPartyMemberStatsChangedPacket(), lfg::BuildRBInternalInfo(), Creature::CanCastSpell(), spell_pal_judgement_of_wisdom_mana::CheckProc(), Spell::EffectSummonPet(), spell_chain_burn::FilterTargets(), spell_moam_mana_drain_filter::FilterTargets(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleObsModPowerAuraTick(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_dru_revitalize::HandleProc(), spell_dru_t3_2p_bonus::HandleProc(), spell_item_heartpierce::HandleProc(), spell_item_heartpierce_hero::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), HasActivePowerType(), Player::HasActivePowerType(), Player::InitDataForForm(), Vehicle::Install(), SmartAI::IsMainSpellPrevented(), ManaVoidSelector::operator()(), LeechingThrowSelector::operator()(), PowerUsersSelector::operator()(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_item_mad_alchemists_potion::SecondaryEffect(), spell_item_crazy_alchemists_potion::SecondaryEffect(), setDeathState(), SetMaxPower(), SetPower(), Pet::Update(), Creature::Update(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_hazzarah::UpdateAI(), boss_faction_championsAI::UpdateAI(), and npc_nether_drake::npc_nether_drakeAI::UpdateAI().

◆ GetPowerTypeByAuraGroup()

Powers Unit::GetPowerTypeByAuraGroup ( UnitMods  unitMod) const
11965{
11966 switch (unitMod)
11967 {
11968 case UNIT_MOD_RAGE:
11969 return POWER_RAGE;
11970 case UNIT_MOD_FOCUS:
11971 return POWER_FOCUS;
11972 case UNIT_MOD_ENERGY:
11973 return POWER_ENERGY;
11974 case UNIT_MOD_HAPPINESS:
11975 return POWER_HAPPINESS;
11976 case UNIT_MOD_RUNE:
11977 return POWER_RUNE;
11979 return POWER_RUNIC_POWER;
11980 default:
11981 case UNIT_MOD_MANA:
11982 return POWER_MANA;
11983 }
11984}
@ UNIT_MOD_RUNE
Definition Unit.h:164
@ UNIT_MOD_ENERGY
Definition Unit.h:162
@ UNIT_MOD_FOCUS
Definition Unit.h:161
@ UNIT_MOD_HAPPINESS
Definition Unit.h:163
@ UNIT_MOD_MANA
Definition Unit.h:159
@ UNIT_MOD_RAGE
Definition Unit.h:160
@ UNIT_MOD_RUNIC_POWER
Definition Unit.h:165

References POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RUNE, and UNIT_MOD_RUNIC_POWER.

Referenced by UpdateUnitMod().

◆ GetPPMProcChance()

float Unit::GetPPMProcChance ( uint32  WeaponSpeed,
float  PPM,
SpellInfo const *  spellProto 
) const
10306{
10307 // proc per minute chance calculation
10308 if (PPM <= 0)
10309 return 0.0f;
10310
10311 // Apply chance modifer aura
10312 if (spellProto)
10313 if (Player* modOwner = GetSpellModOwner())
10314 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
10315
10316 return (WeaponSpeed * PPM) / 600.0f; // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
10317}
@ SPELLMOD_PROC_PER_MINUTE
Definition SpellDefines.h:110

References GetSpellModOwner(), SpellInfo::Id, and SPELLMOD_PROC_PER_MINUTE.

Referenced by Player::CastItemCombatSpell().

◆ GetProcAurasTriggeredOnEvent()

void Unit::GetProcAurasTriggeredOnEvent ( AuraApplicationProcContainer &  aurasTriggeringProc,
std::list< AuraApplication * > *  procAuras,
ProcEventInfo  eventInfo 
)
12549{
12550 TimePoint now = std::chrono::steady_clock::now();
12551
12552 auto processAuraApplication = [&](AuraApplication* aurApp)
12553 {
12554 if (uint8 procEffectMask = aurApp->GetBase()->GetProcEffectMask(aurApp, eventInfo, now))
12555 {
12556 aurApp->GetBase()->PrepareProcToTrigger(aurApp, eventInfo, now);
12557 aurasTriggeringProc.emplace_back(procEffectMask, aurApp);
12558 }
12559 else
12560 {
12561 if (aurApp->GetBase()->GetSpellInfo()->HasAttribute(SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE))
12562 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(aurApp->GetBase()->GetId()))
12563 aurApp->GetBase()->AddProcCooldown(procEntry, now);
12564 }
12565 };
12566
12567 // use provided list of auras which can proc
12568 if (procAuras)
12569 {
12570 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
12571 {
12572 ASSERT((*itr)->GetTarget() == this);
12573 if (!(*itr)->GetRemoveMode())
12574 processAuraApplication(*itr);
12575 }
12576 }
12577 // or generate one on our own
12578 else
12579 {
12580 for (AuraApplicationMap::iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
12581 processAuraApplication(itr->second);
12582 }
12583}
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition Duration.h:69
@ SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE
Definition SharedDefines.h:467
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1400
Definition SpellMgr.h:286

References ASSERT, GetAppliedAuras(), SPELL_ATTR2_PROC_COOLDOWN_ON_FAILURE, and sSpellMgr.

Referenced by TriggerAurasProcOnEvent().

◆ getRace()

uint8 Unit::getRace ( bool  original = false) const
16797{
16798 if (IsPlayer())
16799 {
16800 if (original)
16801 return m_realRace;
16802 else
16803 return m_race;
16804 }
16805
16807}

References Object::GetByteValue(), Object::IsPlayer(), m_race, m_realRace, and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::BuildPlayerRepop(), lfg::BuildRBInternalInfo(), Corpse::BuildValuesUpdate(), Player::CheckSkillLearnedBySpell(), Player::CreateCorpse(), GetModelForForm(), ObjectMgr::GetModelForShapeshift(), getRaceMask(), GetReactionTo(), Player::GetStartPosition(), Player::GetTeamId(), Player::GiveLevel(), WorldSession::HandleAlterAppearance(), AuraEffect::HandleAuraTransform(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetStatsOrLevelHelper(), spell_item_toy_train_set::HandleScriptEffect(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsSpellFitByClassAndRace(), Trainer::Trainer::IsTrainerValidForPlayer(), Channel::KickOrBan(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), InstanceScript::OnPlayerLeave(), RestoreFaction(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Player::SetGameMaster(), Player::StoreNewItemInBestSlots(), and Player::UpdateSkillsForLevel().

◆ getRaceMask()

◆ GetRageWeaponSpeedHitFactor()

uint32 Unit::GetRageWeaponSpeedHitFactor ( WeaponAttackType  att) const
inline
930 {
931 return uint32(GetAttackTime(att) / 1000.0f * (att == BASE_ATTACK ? 3.5f : 1.75f));
932 }

References BASE_ATTACK, and GetAttackTime().

Referenced by DealDamage(), DealMeleeDamage(), and TEST_F().

◆ GetRandomContactPoint()

bool Unit::GetRandomContactPoint ( Unit const *  target,
float &  x,
float &  y,
float &  z,
bool  force = false 
) const
839{
840 float combat_reach = GetCombatReach();
841 if (combat_reach < 0.1f) // sometimes bugged for players
842 combat_reach = DEFAULT_COMBAT_REACH;
843
844 uint32 attacker_number = getAttackers().size();
845 if (attacker_number > 0)
846 --attacker_number;
847 Creature const* c = obj->ToCreature();
848 if (c)
849 if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
850 attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
851
852 GetNearPoint(obj, x, y, z, isMoving() ? (obj->GetCombatReach() > 7.75f ? obj->GetCombatReach() - 7.5f : 0.25f) : obj->GetCombatReach(), 0.0f,
853 GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
854
855 // pussywizard
856 if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
857 {
858 x = this->GetPositionX();
859 y = this->GetPositionY();
860 z = this->GetPositionZ();
861 obj->UpdateAllowedPositionZ(x, y, z);
862 }
863 float maxDist = GetMeleeRange(obj);
864 if (GetExactDistSq(x, y, z) >= maxDist * maxDist)
865 {
866 if (force)
867 {
868 x = this->GetPositionX();
869 y = this->GetPositionY();
870 z = this->GetPositionZ();
871 return true;
872 }
873 return false;
874 }
875 return true;
876}
#define DEFAULT_COMBAT_REACH
Definition ObjectDefines.h:45
bool IsDungeonBoss() const
Definition Creature.cpp:3382
bool isControlled() const
Definition Pet.h:54
float GetCollisionHeight() const override
Return collision height sent to client.
Definition Unit.cpp:16890
float GetMeleeRange(Unit const *target) const
Definition Unit.cpp:807
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition Object.cpp:1391
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174

References DEFAULT_COMBAT_REACH, Position::GetAngle(), getAttackers(), GetCollisionHeight(), GetCombatReach(), Position::GetExactDistSq(), GetMeleeRange(), WorldObject::GetNearPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Pet::isControlled(), Creature::IsDungeonBoss(), isMoving(), IsPet(), WorldObject::IsWithinLOS(), Creature::isWorldBoss(), rand_norm(), Object::ToCreature(), ToPet(), and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_bug_trio::DamageTaken(), and boss_bug_trio::DoFinalSpell().

◆ GetRangedCritChanceReduction()

float Unit::GetRangedCritChanceReduction ( ) const
inline

◆ GetRangedCritDamageReduction()

uint32 Unit::GetRangedCritDamageReduction ( uint32  damage) const
inline

◆ GetRangedDamageReduction()

uint32 Unit::GetRangedDamageReduction ( uint32  damage) const
inline

◆ GetReactionTo()

ReputationRank Unit::GetReactionTo ( Unit const *  target,
bool  checkOriginalFaction = false 
) const
6912{
6913 // always friendly to self
6914 if (this == target)
6915 return REP_FRIENDLY;
6916
6917 // always friendly to charmer or owner
6919 return REP_FRIENDLY;
6920
6921 Player const* selfPlayerOwner = GetAffectingPlayer();
6922 Player const* targetPlayerOwner = target->GetAffectingPlayer();
6923
6924 // check forced reputation to support SPELL_AURA_FORCE_REACTION
6925 if (selfPlayerOwner)
6926 {
6927 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
6928 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
6929 return *repRank;
6930 }
6931 else if (targetPlayerOwner)
6932 {
6933 if (FactionTemplateEntry const* selfFactionTemplateEntry = GetFactionTemplateEntry())
6934 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(selfFactionTemplateEntry))
6935 return *repRank;
6936 }
6937
6939 {
6940 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
6941 {
6942 if (selfPlayerOwner && targetPlayerOwner)
6943 {
6944 // always friendly to other unit controlled by player, or to the player himself
6945 if (selfPlayerOwner == targetPlayerOwner)
6946 return REP_FRIENDLY;
6947
6948 // duel - always hostile to opponent
6949 if (selfPlayerOwner->duel && selfPlayerOwner->duel->Opponent == targetPlayerOwner && selfPlayerOwner->duel->State == DUEL_STATE_IN_PROGRESS)
6950 return REP_HOSTILE;
6951
6952 // same group - checks dependant only on our faction - skip FFA_PVP for example
6953 if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
6954 return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
6955 // however client seems to allow mixed group parties, because in 13850 client it works like:
6956 // return GetFactionReactionTo(GetFactionTemplateEntry(), target);
6957 }
6958
6959 // check FFA_PVP
6960 if (IsFFAPvP() && target->IsFFAPvP())
6961 return REP_HOSTILE;
6962
6963 if (selfPlayerOwner)
6964 {
6965 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
6966 {
6967 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
6968 return *repRank;
6969 if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
6970 {
6971 if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
6972 {
6973 if (targetFactionEntry->CanHaveReputation())
6974 {
6975 // check contested flags
6976 if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
6977 && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
6978 return REP_HOSTILE;
6979
6980 // if faction has reputation, hostile state depends only from AtWar state
6981 if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
6982 return REP_HOSTILE;
6983 return REP_FRIENDLY;
6984 }
6985 }
6986 }
6987 }
6988 }
6989 }
6990 }
6991
6992 ReputationRank repRank = REP_HATED;
6993 if (!sScriptMgr->IfNormalReaction(this, target, repRank))
6994 {
6995 return ReputationRank(repRank);
6996 }
6997
6998 FactionTemplateEntry const* factionTemplateEntry = nullptr;
6999 if (checkOriginalFaction)
7000 {
7001 if (IsPlayer())
7002 {
7003 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace()))
7004 {
7005 factionTemplateEntry = sFactionTemplateStore.LookupEntry(rEntry->FactionID);
7006 }
7007 }
7008 else
7009 {
7010 Unit* owner = GetOwner();
7011 if (HasUnitTypeMask(UNIT_MASK_MINION) && owner)
7012 {
7013 factionTemplateEntry = sFactionTemplateStore.LookupEntry(owner->GetFaction());
7014 }
7015 else if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate())
7016 {
7017 factionTemplateEntry = sFactionTemplateStore.LookupEntry(cinfo->faction);
7018 }
7019 }
7020 }
7021
7022 if (!factionTemplateEntry)
7023 {
7024 factionTemplateEntry = GetFactionTemplateEntry();
7025 }
7026
7027 // do checks dependant only on our faction
7028 return GetFactionReactionTo(factionTemplateEntry, target);
7029}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
@ REP_HATED
Definition SharedDefines.h:157
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:1125
bool IsAtWar(uint32 faction_id) const
Definition ReputationMgr.cpp:55
bool IsInRaidWith(Unit const *unit) const
Definition Unit.cpp:14775
Definition DBCStructure.h:706

References Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), GetCharmerOrOwnerOrSelf(), GetFaction(), GetFactionReactionTo(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetOwner(), getRace(), Player::GetReputationMgr(), Player::HasPlayerFlag(), HasUnitFlag(), HasUnitFlag2(), HasUnitTypeMask(), ReputationMgr::IsAtWar(), IsFFAPvP(), IsInRaidWith(), Object::IsPlayer(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HATED, REP_HOSTILE, sChrRacesStore, sFactionStore, sFactionTemplateStore, sScriptMgr, Object::ToCreature(), UNIT_FLAG2_IGNORE_REPUTATION, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_MINION.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), Player::GetNPCIfCanInteractWith(), IsFriendlyTo(), IsHostileTo(), Condition::Meets(), Player::SendTaxiNodeStatusMultiple(), and WorldSession::SendTaxiStatus().

◆ GetResistance() [1/2]

uint32 Unit::GetResistance ( SpellSchoolMask  mask) const
15998{
15999 int32 resist = -1;
16000 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
16001 if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
16002 resist = int32(GetResistance(SpellSchools(i)));
16003
16004 // resist value will never be negative here
16005 return uint32(resist);
16006}
SpellSchools
Definition SharedDefines.h:270
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:280

References GetResistance(), MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by Player::_SaveStats(), GetArmor(), GetEffectiveResistChance(), GetResistance(), and Player::outDebugValues().

◆ GetResistance() [2/2]

uint32 Unit::GetResistance ( SpellSchools  school) const
inline
1212{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_RESISTANCES) + school); }
@ UNIT_FIELD_RESISTANCES
Definition UpdateFields.h:156

References Object::GetUInt32Value(), and UNIT_FIELD_RESISTANCES.

◆ GetSchoolImmunityMask()

uint32 Unit::GetSchoolImmunityMask ( ) const

◆ GetShapeshiftForm()

◆ GetSharedVisionList()

◆ GetSheath()

SheathState Unit::GetSheath ( ) const
inline
SheathState
Definition UnitDefines.h:128

References Object::GetByteValue(), and UNIT_FIELD_BYTES_2.

◆ GetShieldBlockValue() [1/2]

virtual uint32 Unit::GetShieldBlockValue ( ) const
pure virtual

◆ GetShieldBlockValue() [2/2]

uint32 Unit::GetShieldBlockValue ( uint32  soft_cap,
uint32  hard_cap 
) const
inline
1191 {
1192 uint32 value = GetShieldBlockValue();
1193 if (value >= hard_cap)
1194 {
1195 value = (soft_cap + hard_cap) / 2;
1196 }
1197 else if (value > soft_cap)
1198 {
1199 value = soft_cap + ((value - soft_cap) / 2);
1200 }
1201
1202 return value;
1203 }

References GetShieldBlockValue().

◆ GetSingleCastAuras() [1/2]

AuraList & Unit::GetSingleCastAuras ( )
inline

◆ GetSingleCastAuras() [2/2]

AuraList const & Unit::GetSingleCastAuras ( ) const
inline
1447{ return m_scAuras; }

References m_scAuras.

◆ GetSpeed()

float Unit::GetSpeed ( UnitMoveType  mtype) const
11126{
11127 return m_speed_rate[mtype] * (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
11128}
std::array< float, MAX_MOVE_TYPE > playerBaseMoveSpeed
Definition Unit.cpp:95
std::array< float, MAX_MOVE_TYPE > baseMoveSpeed
Definition Unit.cpp:94

References baseMoveSpeed, IsControlledByPlayer(), m_speed_rate, and playerBaseMoveSpeed.

Referenced by Object::BuildMovementUpdate(), Spell::CalculateJumpSpeeds(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), ChaseMovementGenerator< T >::DoUpdate(), GetTargetSpeedInMotion(), WorldSession::HandleForceSpeedChangeAck(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), npc_highlord_darion_mograine::JustSummoned(), Movement::MoveSplineInit::Launch(), FormationMovementGenerator::LaunchMovement(), LightOfDawnStartMarch(), PredictPosition(), SmartScript::ProcessAction(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), RunTimeTo(), SendSpeedToController(), SetSpeed(), boss_shade_of_akama::SpellHit(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and WalkTimeTo().

◆ GetSpeedRate()

◆ GetSpellCritChanceReduction()

float Unit::GetSpellCritChanceReduction ( ) const
inline

◆ GetSpellCritDamageReduction()

◆ GetSpellDamageReduction()

uint32 Unit::GetSpellDamageReduction ( uint32  damage) const
inline

◆ GetSpellMaxRangeForTarget()

float Unit::GetSpellMaxRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
11576{
11577 if (!spellInfo->RangeEntry)
11578 {
11579 return 0;
11580 }
11581
11582 if (spellInfo->RangeEntry->RangeMax[1] == spellInfo->RangeEntry->RangeMax[0])
11583 {
11584 return spellInfo->GetMaxRange();
11585 }
11586
11587 if (!target)
11588 {
11589 return spellInfo->GetMaxRange(true);
11590 }
11591
11592 return spellInfo->GetMaxRange(!IsHostileTo(target));
11593}

References SpellInfo::GetMaxRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMax.

Referenced by Pet::CastPendingSpell(), spell_sha_fire_nova::CheckFireTotem(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), ScriptedAI::SelectSpell(), and GameObject::TriggeringLinkedGameObject().

◆ GetSpellMinRangeForTarget()

float Unit::GetSpellMinRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
11596{
11597 if (!spellInfo->RangeEntry)
11598 {
11599 return 0;
11600 }
11601
11602 if (spellInfo->RangeEntry->RangeMin[1] == spellInfo->RangeEntry->RangeMin[0])
11603 {
11604 return spellInfo->GetMinRange();
11605 }
11606
11607 return spellInfo->GetMinRange(!IsHostileTo(target));
11608}

References SpellInfo::GetMinRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMin.

Referenced by SpellTargetSelector::operator()(), SmartScript::ProcessAction(), and ScriptedAI::SelectSpell().

◆ GetSpellModOwner()

Player * Unit::GetSpellModOwner ( ) const
overridevirtual

Reimplemented from WorldObject.

12654{
12655 if (Player* player = const_cast<Unit*>(this)->ToPlayer())
12656 {
12657 return player;
12658 }
12659
12660 if (Unit* owner = GetOwner())
12661 {
12662 if (Player* player = owner->ToPlayer())
12663 {
12664 return player;
12665 }
12666 }
12667
12668 // Special handling for Eye of Kilrogg
12670 {
12671 if (TempSummon const* tempSummon = ToTempSummon())
12672 {
12673 if (Unit* summoner = tempSummon->GetSummonerUnit())
12674 {
12675 return summoner->ToPlayer();
12676 }
12677 }
12678 }
12679
12680 return nullptr;
12681}
@ NPC_EYE_OF_KILROGG
Definition PetDefines.h:102
Definition TemporarySummon.h:50

References Object::GetEntry(), GetOwner(), NPC_EYE_OF_KILROGG, Object::ToPlayer(), and ToTempSummon().

Referenced by Creature::AddSpellCooldown(), ApplyEffectModifiers(), CalcArmorReducedDamage(), Aura::CalcDispelChance(), Aura::CalcMaxCharges(), Aura::CalcMaxDuration(), AuraEffect::CalcPeriodicCritChance(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), spell_dru_brambles_treant::CalculateAmount(), ThreatManager::CalculateModifiedThreat(), AuraEffect::CalculatePeriodic(), CalculateSpellDamageTaken(), Spell::CheckRuneCost(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::finish(), GetEffectiveResistChance(), GetPPMProcChance(), IsAlwaysDetectableFor(), MeleeSpellMissChance(), Aura::SetDuration(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHealingBonusDone(), SpellHealingBonusTaken(), Spell::SummonGuardian(), Spell::TakePower(), Spell::TakeRunePower(), TriggerAurasProcOnEvent(), and Aura::UpdateOwner().

◆ GetSpellSchoolByAuraGroup()

SpellSchools Unit::GetSpellSchoolByAuraGroup ( UnitMods  unitMod) const
11904{
11906
11907 switch (unitMod)
11908 {
11910 school = SPELL_SCHOOL_HOLY;
11911 break;
11913 school = SPELL_SCHOOL_FIRE;
11914 break;
11916 school = SPELL_SCHOOL_NATURE;
11917 break;
11919 school = SPELL_SCHOOL_FROST;
11920 break;
11922 school = SPELL_SCHOOL_SHADOW;
11923 break;
11925 school = SPELL_SCHOOL_ARCANE;
11926 break;
11927
11928 default:
11929 break;
11930 }
11931
11932 return school;
11933}
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:276
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:274
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:275
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:277
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:273
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:272
@ UNIT_MOD_RESISTANCE_SHADOW
Definition Unit.h:171
@ UNIT_MOD_RESISTANCE_FROST
Definition Unit.h:170
@ UNIT_MOD_RESISTANCE_HOLY
Definition Unit.h:167
@ UNIT_MOD_RESISTANCE_ARCANE
Definition Unit.h:172
@ UNIT_MOD_RESISTANCE_FIRE
Definition Unit.h:168
@ UNIT_MOD_RESISTANCE_NATURE
Definition Unit.h:169

References SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, and UNIT_MOD_RESISTANCE_SHADOW.

Referenced by UpdateUnitMod().

◆ getStandState()

◆ GetStat()

◆ GetStatByAuraGroup()

Stats Unit::GetStatByAuraGroup ( UnitMods  unitMod) const
11936{
11937 Stats stat = STAT_STRENGTH;
11938
11939 switch (unitMod)
11940 {
11942 stat = STAT_STRENGTH;
11943 break;
11945 stat = STAT_AGILITY;
11946 break;
11948 stat = STAT_STAMINA;
11949 break;
11951 stat = STAT_INTELLECT;
11952 break;
11954 stat = STAT_SPIRIT;
11955 break;
11956
11957 default:
11958 break;
11959 }
11960
11961 return stat;
11962}
Stats
Definition SharedDefines.h:245
@ STAT_SPIRIT
Definition SharedDefines.h:250
@ STAT_INTELLECT
Definition SharedDefines.h:249
@ STAT_AGILITY
Definition SharedDefines.h:247
@ STAT_STRENGTH
Definition SharedDefines.h:246
@ STAT_STAMINA
Definition SharedDefines.h:248
@ UNIT_MOD_STAT_INTELLECT
Definition Unit.h:156
@ UNIT_MOD_STAT_SPIRIT
Definition Unit.h:157
@ UNIT_MOD_STAT_STRENGTH
Definition Unit.h:153
@ UNIT_MOD_STAT_AGILITY
Definition Unit.h:154
@ UNIT_MOD_STAT_STAMINA
Definition Unit.h:155

References STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by UpdateUnitMod().

◆ GetTarget()

◆ GetThreatMgr() [1/2]

ThreatManager & Unit::GetThreatMgr ( )
inline
965{ return m_threatManager; }

References m_threatManager.

Referenced by PetAI::_stopAttack(), Vehicle::AddPassenger(), ThreatManager::AddThreat(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), ThreatManager::CalculateModifiedThreat(), Creature::CallForHelp(), boss_hazzarah::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_ouro::CastBoulderIfReady(), boss_mor_grayhoof::CastRandomSpell(), spell_hun_misdirection::CheckProc(), Pet::Create(), boss_eadric::DamageTaken(), boss_grand_champion::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_paletress::DamageTaken(), boss_kiljaeden::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), npc_spark_of_ionar::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), ScriptedAI::DoAddThreat(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoGetThreat(), ScriptedAI::DoModifyThreatByPercent(), ScriptedAI::DoResetThreat(), ScriptedAI::DoResetThreatList(), Spell::DoSpellHitOnUnit(), spell_halion_twilight_phasing_aura::DropCombat(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectModifyThreatPercent(), Spell::EffectRedirectThreat(), Spell::EffectSanctuary(), Spell::EffectTaunt(), Spell::EffectThreat(), CombatManager::EndAllPvECombat(), CombatReference::EndCombat(), boss_faction_championsAI::EnemiesInRange(), EnergizeBySpell(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), UnitAI::EvadeTimerExpired(), TemporaryThreatModifierEvent::Execute(), StartMovementEvent::Execute(), boss_supremus::FindHatefulStrikeTarget(), npc_raging_flames::FixateRandomTarget(), ThreatManager::ForwardThreatForAssistingMe(), SmartScript::GetTargets(), UnitAI::GetThreatMgr(), AuraEffect::HandleAuraModDmgImmunity(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStun(), AuraEffect::HandleAuraModTotalThreat(), misc_commandscript::HandleCombatStopCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugThreatInfoCommand(), debug_commandscript::HandleDebugThreatListCommand(), spell_karazhan_blink::HandleDummy(), spell_patchwerk_hateful_strike_primer::HandleEffect(), spell_kaelthas_mind_control::HandleEffect(), spell_ulduar_random_aggro_periodic::HandleEffectPeriodic(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModDetaunt(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModThreat(), WorldSession::HandleMoveWorldportAck(), AuraEffect::HandleObsModPowerAuraTick(), spell_enveloping_webs::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_pet_guard_dog::HandleProc(), spell_rog_tricks_of_the_trade_proc::HandleRemove(), spell_warr_vigilance::HandleRemove(), PetAI::HandleReturnMovement(), spell_pursue::HandleScript(), spell_gurtogg_eject::HandleScriptEffect(), spell_leotheras_whirlwind::HandleScriptEffect(), spell_kaelthas_nether_beam::HandleScriptEffect(), Spell::HandleThreatSpells(), HasTargetableThreat(), Creature::InitEntry(), npc_pet_mage_mirror_image::InitializeAI(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), NPCStaveQuestAI::IsFairFight(), boss_hadronox::IsInCombatWithPlayer(), npc_onyxian_whelp::IsSummonedBy(), boss_attumen::IsSummonedBy(), boss_talon_king_ikiss::JustEngagedWith(), boss_blackheart_the_inciter::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_jindo::JustSummoned(), boss_urom::boss_uromAI::LeaveCombat(), WorldSession::LogoutPlayer(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), Creature::ModifyThreatPercentTemp(), boss_bug_trio::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_hun_misdirection::OnRemove(), spell_hun_misdirection_proc::OnRemove(), spell_rog_tricks_of_the_trade_aura::OnRemove(), NonTankTargetSelector::operator()(), PowerUsersSelector::operator()(), MalleableGooSelector::operator()(), boss_jeklik::PathEndReached(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Map::RemovePlayerFromMap(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_talon_king_ikiss::Reset(), npc_toc5_grand_champion_minion::ScheduleMountAbilities(), boss_grand_champion::ScheduleMountAbilities(), boss_faction_championsAI::SelectEnemyCaster(), spell_patchwerk_hateful_strike_primer::SelectTargets(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), instance_naxxramas::SetBossState(), npc_icc_orb_controller::SetGUID(), boss_thorim_start_npcs::SetGUID(), Player::SetInWater(), npc_ulduar_iron_construct::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_eck::SpellHitTarget(), boss_ouro::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), NPCStaveQuestAI::StorePlayerGUID(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Submit(), ThreatReference::UnregisterAndFree(), Creature::Update(), boss_drakkisath::UpdateAI(), boss_nefarian::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_molten_golem::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), boss_netherspite::UpdatePortals(), and NPCStaveQuestAI::ValidThreatlist().

◆ GetThreatMgr() [2/2]

ThreatManager const & Unit::GetThreatMgr ( ) const
inline
966{ return m_threatManager; }

References m_threatManager.

◆ GetTotalAttackPowerValue()

float Unit::GetTotalAttackPowerValue ( WeaponAttackType  attType,
Unit *  pVictim = nullptr 
) const
11987{
11988 if (attType == RANGED_ATTACK)
11989 {
11991 if (victim)
11992 ap += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
11993
11994 if (ap < 0)
11995 return 0.0f;
11997 }
11998 else
11999 {
12001 if (victim)
12002 ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
12003
12004 if (ap < 0)
12005 return 0.0f;
12007 }
12008}
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:190
@ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:228
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition UpdateFields.h:166
int32 GetInt32Value(uint16 index) const
Definition Object.cpp:297

References Object::GetFloatValue(), Object::GetInt32Value(), GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, and UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER.

Referenced by lfg::BuildRBInternalInfo(), spell_dk_ghoul_thrash::CalcDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_execute::HandleEffect(), spell_sha_shamanistic_rage::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), Spell::HandleThreatSpells(), Guardian::InitStatsForLevel(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellHealingBonusDone(), and Guardian::UpdateDamagePhysical().

◆ GetTotalAuraModifier() [1/2]

int32 Unit::GetTotalAuraModifier ( AuraType  auratype) const
6104{
6105 return GetTotalAuraModifier(auraType, [](AuraEffect const* /*aurEff*/) { return true; });
6106}

References GetTotalAuraModifier().

Referenced by Player::AddSpellAndCategoryCooldowns(), CalcArmorReducedDamage(), Aura::CalcDispelChance(), CalculateMeleeDamage(), Player::CalculateReputationGain(), CalculateSpellDamageTaken(), DealMeleeDamage(), Spell::Delayed(), Spell::DelayedChannel(), Creature::GetAggroRange(), Creature::GetAttackDistance(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByAffectMask(), GetTotalAuraModifierByMiscMask(), GetTotalAuraModifierByMiscValue(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitMissChance(), GetUnitParryChance(), Player::HandleFall(), isBlockCritical(), WorldObject::MagicSpellHitResult(), MeleeDamageBonusDone(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), RecalculateObjectScale(), Creature::RegenerateHealth(), Player::RegenerateHealth(), RewardRage(), RollMeleeOutcomeAgainst(), SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellDoneCritChance(), WorldObject::SpellHitResult(), WorldObject::SpellHitResult(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), UpdateDamageDoneMods(), Player::UpdateDodgePercentage(), Player::UpdateExpertise(), Player::UpdateManaRegen(), Player::UpdateMeleeHitChances(), Player::UpdateParryPercentage(), Player::UpdateRangedHitChances(), UpdateResistanceBuffModsMod(), UpdateSpeed(), Player::UpdateSpellCritChance(), Player::UpdateSpellHitChances(), UpdateStatBuffMod(), and Player::UpdateWeaponDependentCritAuras().

◆ GetTotalAuraModifier() [2/2]

int32 Unit::GetTotalAuraModifier ( AuraType  auratype,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6016{
6017 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6018 if (mTotalAuraList.empty())
6019 return 0;
6020
6021 std::map<SpellGroup, int32> sameEffectSpellGroup;
6022 int32 modifier = 0;
6023
6024 for (AuraEffect const* aurEff : mTotalAuraList)
6025 {
6026 if (predicate(aurEff))
6027 {
6028 // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
6029 // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
6030 if (!sSpellMgr->AddSameEffectStackRuleSpellGroups(aurEff->GetSpellInfo(), static_cast<uint32>(auraType),
6031 aurEff->GetMiscValue(), aurEff->GetAmount(), sameEffectSpellGroup))
6032 modifier += aurEff->GetAmount();
6033 }
6034 }
6035
6036 // Add the highest of the Same Effect Stack Rule SpellGroups to the accumulator
6037 for (auto const& [_, amount] : sameEffectSpellGroup)
6038 modifier += amount;
6039
6040 return modifier;
6041}

References GetAuraEffectsByType(), and sSpellMgr.

◆ GetTotalAuraModifierByAffectMask()

int32 Unit::GetTotalAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6204{
6205 return GetTotalAuraModifier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6206 {
6207 if (aurEff->IsAffectedOnSpell(affectedSpell))
6208 return true;
6209 return false;
6210 });
6211}

References GetTotalAuraModifier(), and AuraEffect::IsAffectedOnSpell().

◆ GetTotalAuraModifierByMiscMask()

◆ GetTotalAuraModifierByMiscValue()

int32 Unit::GetTotalAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6164{
6165 return GetTotalAuraModifier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6166 {
6167 if (aurEff->GetMiscValue() == miscValue)
6168 return true;
6169 return false;
6170 });
6171}

References AuraEffect::GetMiscValue(), and GetTotalAuraModifier().

Referenced by Player::CalculateReputationGain(), GetMechanicResistChance(), MeleeSpellHitResult(), WorldObject::ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), RollMeleeOutcomeAgainst(), Player::UpdateEnergyRegen(), and Player::UpdateManaRegen().

◆ GetTotalAuraModValue()

float Unit::GetTotalAuraModValue ( UnitMods  unitMod) const
11886{
11887 if (unitMod >= UNIT_MOD_END)
11888 {
11889 LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
11890 return 0.0f;
11891 }
11892
11893 if (GetPctModifierValue(unitMod, TOTAL_PCT) <= 0.0f)
11894 return 0.0f;
11895
11896 float value = GetFlatModifierValue(unitMod, BASE_VALUE);
11897 value *= GetPctModifierValue(unitMod, BASE_PCT);
11898 value += GetFlatModifierValue(unitMod, TOTAL_VALUE);
11899 value *= GetPctModifierValue(unitMod, TOTAL_PCT);
11900 return value;
11901}
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:11715
float GetFlatModifierValue(UnitMods unitMod, UnitModifierFlatType modifierType) const
Definition Unit.cpp:11704

References BASE_PCT, BASE_VALUE, GetFlatModifierValue(), GetPctModifierValue(), LOG_ERROR, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_END.

Referenced by Creature::UpdateArmor(), Creature::UpdateMaxHealth(), Creature::UpdateMaxPower(), and Creature::UpdateResistances().

◆ GetTotalAuraMultiplier() [1/2]

◆ GetTotalAuraMultiplier() [2/2]

float Unit::GetTotalAuraMultiplier ( AuraType  auraType,
std::function< bool(AuraEffect const *)> const &  predicate 
) const
6044{
6045 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auraType);
6046 if (mTotalAuraList.empty())
6047 return 1.0f;
6048
6049 std::map<SpellGroup, int32> sameEffectSpellGroup;
6050 float multiplier = 1.0f;
6051
6052 for (AuraEffect const* aurEff : mTotalAuraList)
6053 {
6054 if (predicate(aurEff))
6055 {
6056 // Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
6057 // If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
6058 if (!sSpellMgr->AddSameEffectStackRuleSpellGroups(aurEff->GetSpellInfo(), static_cast<uint32>(auraType),
6059 aurEff->GetMiscValue(), aurEff->GetAmount(), sameEffectSpellGroup))
6060 AddPct(multiplier, aurEff->GetAmount());
6061 }
6062 }
6063
6064 // Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier
6065 for (auto itr = sameEffectSpellGroup.begin(); itr != sameEffectSpellGroup.end(); ++itr)
6066 AddPct(multiplier, itr->second);
6067
6068 return multiplier;
6069}

References AddPct(), GetAuraEffectsByType(), and sSpellMgr.

◆ GetTotalAuraMultiplierByAffectMask()

float Unit::GetTotalAuraMultiplierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6214{
6215 return GetTotalAuraMultiplier(auraType, [affectedSpell](AuraEffect const* aurEff) -> bool
6216 {
6217 if (aurEff->IsAffectedOnSpell(affectedSpell))
6218 return true;
6219 return false;
6220 });
6221}

References GetTotalAuraMultiplier(), and AuraEffect::IsAffectedOnSpell().

◆ GetTotalAuraMultiplierByMiscMask()

◆ GetTotalAuraMultiplierByMiscValue()

float Unit::GetTotalAuraMultiplierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6174{
6175 return GetTotalAuraMultiplier(auraType, [miscValue](AuraEffect const* aurEff) -> bool
6176 {
6177 if (aurEff->GetMiscValue() == miscValue)
6178 return true;
6179 return false;
6180 });
6181}

References AuraEffect::GetMiscValue(), and GetTotalAuraMultiplier().

Referenced by AuraEffect::HandleAuraModIncreaseEnergyPercent(), Creature::Regenerate(), Player::Regenerate(), Player::UpdateEnergyRegen(), and Player::UpdateManaRegen().

◆ GetTotalStatValue()

float Unit::GetTotalStatValue ( Stats  stat,
float  additionalValue = 0.0f 
) const
11870{
11871 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_STAT_START) + stat);
11872
11873 if (GetPctModifierValue(unitMod, TOTAL_PCT) <= 0.0f)
11874 return 0.0f;
11875
11876 // value = ((base_value * base_pct) + total_value) * total_pct
11877 float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreateStat(stat);
11878 value *= GetPctModifierValue(unitMod, BASE_PCT);
11879 value += GetFlatModifierValue(unitMod, TOTAL_VALUE) + additionalValue;
11880 value *= GetPctModifierValue(unitMod, TOTAL_PCT);
11881
11882 return value;
11883}
UnitMods
Definition Unit.h:152
@ UNIT_MOD_STAT_START
Definition Unit.h:180
float GetCreateStat(Stats stat) const
Definition Unit.h:1077

References BASE_PCT, BASE_VALUE, GetCreateStat(), GetFlatModifierValue(), GetPctModifierValue(), TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_STAT_START.

Referenced by Player::UpdateAllStats(), Guardian::UpdateStats(), and Player::UpdateStats().

◆ getTransForm()

◆ GetTransGUID()

◆ GetUnitBlockChance()

float Unit::GetUnitBlockChance ( ) const
3603{
3604 if (Player const* player = ToPlayer())
3605 {
3606 if (player->CanBlock())
3607 {
3608 Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
3609 if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
3611 }
3612 // is player but has no block ability or no not broken shield equipped
3613 return 0.0f;
3614 }
3615 else
3616 {
3617 if (ToCreature()->IsTotem())
3618 return 0.0f;
3619 else
3620 {
3621 float block = 5.0f;
3623 return block > 0.0f ? block : 0.0f;
3624 }
3625 }
3626}
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:678
#define INVENTORY_SLOT_BAG_0
Definition Player.h:657
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition SpellAuraDefines.h:114
@ PLAYER_BLOCK_PERCENTAGE
Definition UpdateFields.h:346
bool IsBroken() const
Definition Item.h:257
uint32 Block
Definition ItemTemplate.h:674

References ItemTemplate::Block, EQUIPMENT_SLOT_OFFHAND, Object::GetFloatValue(), Item::GetTemplate(), GetTotalAuraModifier(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), IsTotem(), PLAYER_BLOCK_PERCENTAGE, SPELL_AURA_MOD_BLOCK_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitCriticalChance()

float Unit::GetUnitCriticalChance ( WeaponAttackType  attackType,
Unit const *  victim 
) const
3629{
3630 float crit;
3631
3632 if (IsPlayer())
3633 {
3634 switch (attackType)
3635 {
3636 case BASE_ATTACK:
3638 break;
3639 case OFF_ATTACK:
3641 break;
3642 case RANGED_ATTACK:
3644 break;
3645 // Just for good manner
3646 default:
3647 crit = 0.0f;
3648 break;
3649 }
3650 }
3651 else
3652 {
3653 crit = 5.0f;
3656 }
3657
3658 // flat aura mods
3659 if (attackType == RANGED_ATTACK)
3660 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
3661 else
3662 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
3663
3664 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, [this](AuraEffect const* aurEff)
3665 {
3666 return GetGUID() == aurEff->GetCasterGUID();
3667 });
3668
3669 // reduce crit chance from Rating for players
3670 if (attackType != RANGED_ATTACK)
3671 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
3672 else
3673 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
3674
3675 // Apply crit chance from defence skill
3676 crit += GetCritChanceFromSkillDiff(victim);
3677
3678 // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end
3679 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
3680
3681 if (crit < 0.0f)
3682 crit = 0.0f;
3683 return crit;
3684}
@ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Definition SpellAuraDefines.h:371
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE
Definition SpellAuraDefines.h:251
@ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
Definition SpellAuraDefines.h:260
@ SPELL_AURA_MOD_CRIT_PCT
Definition SpellAuraDefines.h:353
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition SpellAuraDefines.h:115
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition UpdateFields.h:351
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition UpdateFields.h:353
float GetCritChanceFromSkillDiff(Unit const *victim) const
Definition Unit.cpp:3686

References ApplyResilience(), BASE_ATTACK, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, AuraEffect::GetCasterGUID(), GetCritChanceFromSkillDiff(), Object::GetFloatValue(), Object::GetGUID(), GetTotalAuraModifier(), Object::IsPlayer(), OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_MOD_CRIT_PCT, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by spell_dk_wandering_plague_aura::CheckProc(), and RollMeleeOutcomeAgainst().

◆ GetUnitDodgeChance()

float Unit::GetUnitDodgeChance ( ) const
3541{
3542 if (IsPlayer())
3543 return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE);
3544 else
3545 {
3546 if (ToCreature()->IsTotem())
3547 return 0.0f;
3548 else
3549 {
3550 float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference)
3552 return dodge > 0.0f ? dodge : 0.0f;
3553 }
3554 }
3555}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition SpellAuraDefines.h:112
float GetRealDodge() const
Definition Player.h:2654

References Player::GetRealDodge(), GetTotalAuraModifier(), Object::IsPlayer(), IsTotem(), Creature::isWorldBoss(), SPELL_AURA_MOD_DODGE_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitFlags()

◆ GetUnitFlags2()

UnitFlags2 Unit::GetUnitFlags2 ( ) const
inline

Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.

UnitFlags2
Definition UnitDefines.h:294
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118

References Object::GetUInt32Value(), and UNIT_FIELD_FLAGS_2.

Referenced by npc_commandscript::HandleNpcInfoCommandShowCreature().

◆ GetUnitMeleeSkill()

uint32 Unit::GetUnitMeleeSkill ( Unit const *  target = nullptr) const
inline
1205{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }

References GetLevel(), and getLevelForTarget().

Referenced by DealMeleeDamage(), GetDefenseSkillValue(), and GetWeaponSkillValue().

◆ GetUnitMissChance()

float Unit::GetUnitMissChance ( WeaponAttackType  attType) const
3588{
3589 float miss_chance = 5.00f;
3590
3591 if (Player const* player = ToPlayer())
3592 miss_chance += player->GetMissPercentageFromDefence();
3593
3594 if (attType == RANGED_ATTACK)
3596 else
3598
3599 return miss_chance;
3600}
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition SpellAuraDefines.h:247
@ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE
Definition SpellAuraDefines.h:248

References GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE, and Object::ToPlayer().

Referenced by MeleeSpellMissChance().

◆ GetUnitMovementFlags()

◆ GetUnitParryChance()

float Unit::GetUnitParryChance ( ) const
3558{
3559 float chance = 0.0f;
3560
3561 if (Player const* player = ToPlayer())
3562 {
3563 if (player->CanParry())
3564 {
3565 Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true);
3566 if (!tmpitem)
3567 tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true);
3568
3569 if (tmpitem)
3570 chance = player->GetRealParry(); //GetFloatValue(PLAYER_PARRY_PERCENTAGE);
3571 }
3572 }
3573 else if (IsCreature())
3574 {
3575 if (ToCreature()->isWorldBoss())
3576 chance = 13.4f; // + 0.6 by skill diff
3578 chance = 5.0f;
3579
3580 // Xinef: if aura is present, type should not matter
3582 }
3583
3584 return chance > 0.0f ? chance : 0.0f;
3585}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition SpellAuraDefines.h:110

References BASE_ATTACK, CREATURE_TYPE_HUMANOID, GetCreatureType(), GetTotalAuraModifier(), Object::IsCreature(), OFF_ATTACK, SPELL_AURA_MOD_PARRY_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by spell_dk_spell_deflection::Absorb(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitState()

uint32 Unit::GetUnitState ( ) const
inline

◆ GetUnitTypeMask()

uint32 Unit::GetUnitTypeMask ( ) const
inline
749{ return m_unitTypeMask; }

References m_unitTypeMask.

◆ GetVehicle()

Vehicle * Unit::GetVehicle ( ) const
inline
1948{ return m_vehicle; }

References m_vehicle.

Referenced by KillRewarder::_InitXP(), boss_flame_leviathan_seat::ActivateTurrets(), Vehicle::AddPassenger(), WorldSession::BuildPartyMemberStatsChangedPacket(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::CanAIAttack(), npc_raging_spirit::npc_raging_spiritAI::CanAIAttack(), npc_icc_lk_checktarget::npc_icc_lk_checktargetAI::CanAIAttack(), boss_flame_leviathan_defense_turret::CanAIAttack(), instance_eye_of_eternity::CheckAchievementCriteriaMeet(), instance_trial_of_the_crusader::CheckAchievementCriteriaMeet(), Spell::CheckCast(), Spell::EffectJumpDest(), Spell::EffectKnockBack(), CreatureAI::EnterEvadeMode(), GetDirectTransport(), SmartScript::GetTargets(), GetTransGUID(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_switch_infragreen_bomber_station::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), WorldSession::HandleMoverRelocation(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::IsPetNeedBeTemporaryUnsummoned(), npc_nexus_lord::JustDied(), npc_scion_of_eternity::JustDied(), boss_flame_leviathan_defense_turret::JustDied(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_scion_of_eternity::npc_scion_of_eternity(), achievement_flame_leviathan_garage::OnCheck(), achievement_wg_didnt_stand_a_chance::OnCheck(), spell_hookshot_aura::OnPeriodic(), BattlefieldWG::OnPlayerLeaveWar(), boss_flame_leviathan_overload_device::OnSpellClick(), VehicleCheck::operator()(), OutDebugInfo(), Player::ProcessDelayedOperations(), Player::ProcessTerrainStatusUpdate(), Vehicle::RemovePassenger(), Creature::SelectVictim(), SetControlled(), Creature::setDeathState(), boss_gormok::boss_gormokAI::SetGUID(), Player::SetViewpoint(), lfg::LFGMgr::TeleportPlayer(), npc_pilgrims_bounty_chair::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), boss_flame_leviathan_seat::UpdateAI(), boss_flame_leviathan_safety_container::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdatePosition(), UpdateSpeed(), GameObject::Use(), Acore::MessageDistDeliverer::Visit(), and Acore::MessageDistDelivererToHostile::Visit().

◆ GetVehicleBase()

Unit * Unit::GetVehicleBase ( ) const

◆ GetVehicleCreatureBase()

◆ GetVehicleKit()

Vehicle * Unit::GetVehicleKit ( ) const
inline
1947{ return m_vehicleKit; }

References m_vehicleKit.

Referenced by _EnterVehicle(), boss_flame_leviathan_seat::ActivateTurret(), Creature::AddToWorld(), Creature::AtEngage(), npc_salvaged_siege_engine::BeforeSpellClick(), npc_snobold_vassal::npc_snobold_vassalAI::BoardGormok(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::boss_deathbringer_saurfangAI(), Object::BuildMovementUpdate(), spell_igb_cannon_blast::CalculatePower(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::CheckCast(), SmartAI::CheckConditions(), VehicleAI::CheckConditions(), Map::CreatureRelocation(), MotionTransport::DelayedTeleportTransport(), Dismount(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), npc_ulduar_vx001::DoAction(), npc_hover_disk::DoAction(), Spell::EffectTeleportUnits(), CreatureAI::EnterEvadeMode(), boss_ick::boss_ickAI::GetKrick(), npc_ulduar_leviathan_mkii::GetS3(), SmartScript::GetTargets(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandleCastSpellOpcode(), spell_q13280_13283_plant_battle_standard::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_vehicle_throw_passenger::HandleScript(), spell_auto_repair::HandleScript(), spell_vehicle_grab_pyrite::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_q11652_rescue_injured_soldier::HandleScriptEffect(), HandleSpellClick(), IsLeviathanSeatAvailable(), IsOnVehicle(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), GridObjectLoader::LoadCreatures(), Mount(), npc_hover_disk::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::npc_high_overlord_saurfangAI(), npc_orb_carrier::npc_orb_carrierAI::npc_orb_carrierAI(), spell_systems_shutdown_aura::OnApply(), VehicleAI::OnCharmed(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), FlameLeviathanPursuedTargetSelector::operator()(), OutDebugInfo(), npc_wintergarde_gryphon::PassengerBoarded(), boss_flame_leviathan_seat::PassengerBoarded(), Map::PlayerRelocation(), SmartScript::ProcessAction(), spell_malygos_surge_of_power_warning_selector_25::SendThreeTargets(), SetCharmedBy(), boss_gormok::boss_gormokAI::SetGUID(), instance_trial_of_the_crusader::SetSnoboldCarrier(), SmartAI::SmartAI(), npc_wintergarde_gryphon::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), boss_flame_leviathan::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), Vehicle::TeleportVehicle(), boss_gormok::boss_gormokAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_hyldsmeet_protodrake::UpdateAI(), npc_wg_siege_machine::npc_wg_siege_machineAI::UpdateAI(), UpdateHeight(), and UpdateOrientation().

◆ GetVictim()

Unit * Unit::GetVictim ( ) const
inline
910{ return m_attacking; }

References m_attacking.

Referenced by boss_marli::_chargePlayer(), PetAI::_needToStop(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), Attack(), PetAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), boss_malygos::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), Object::BuildMovementUpdate(), Creature::CallAssistance(), TurretAI::CanAIAttack(), PetAI::CanAttack(), boss_midnight::CanMeleeHit(), boss_swamplord_muselek::CanShootVictim(), boss_ouro::CastBoulderIfReady(), Pet::CastPendingSpell(), Spell::CheckCast(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_isalien::DamageTaken(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_murmur::DamageTaken(), boss_thorim::DamageTaken(), boss_leotheras_the_blind::DemonTime(), SmartAI::DistanceYourself(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), UnitAI::DoCast(), UnitAI::DoCastToAllHostilePlayers(), UnitAI::DoCastVictim(), ConfusedMovementGenerator< T >::DoFinalize(), Creature::DoFleeToGetAssistance(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), ScriptedAI::DoStopAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectTaunt(), boss_ouro::Emerge(), boss_faction_championsAI::EnemiesInRange(), RestoreAttack::Execute(), StartMovementEvent::Execute(), boss_sartharion_tenebron::ExecuteEvent(), boss_sartharion_shadron::ExecuteEvent(), boss_sartharion_vesperon::ExecuteEvent(), emerald_dragonAI::ExecuteEvent(), spell_shazzrah_gate_dummy::FilterTargets(), spell_malchezaar_enfeeble::FilterTargets(), spell_chain_burn::FilterTargets(), spell_morogrim_tidewalker_watery_grave::FilterTargets(), TimedFleeingMovementGenerator::Finalize(), boss_supremus::FindHatefulStrikeTarget(), ThreatManager::GetAnyTarget(), getAttackerForHelper(), Player::GetInitialVisiblePackets(), CreatureGroup::GetNewTargetForMember(), SmartScript::GetTargets(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), WorldSession::HandleAttackSwingOpcode(), cast_commandscript::HandleCastTargetCommad(), debug_commandscript::HandleDebugThreatListCommand(), spell_aggro_drones::HandleDummy(), spell_gen_threshalisk_charge::HandleDummy(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_lurker_below_spout::HandleEffectRemove(), spell_mirkblood_blood_mirror_target_picker::HandleHit(), AuraEffect::HandleModPossessPet(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetActionHelper(), spell_gen_overlords_brand::HandleProc(), spell_gen_overlords_brand_dot::HandleProc(), spell_kaelthas_nether_beam::HandleScriptEffect(), WorldSession::HandleSetRaidDifficultyOpcode(), ChaseMovementGenerator< T >::HasLostTarget(), HasTargetableThreat(), Spell::InitExplicitTargets(), RotateMovementGenerator::Initialize(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), IsMutualChase(), boss_ouro::IsPlayerWithinMeleeRange(), boss_attumen::IsSummonedBy(), npc_pet_dk_ghoul::IsSummonedBy(), boss_ragnaros::IsVictimWithinMeleeRange(), npc_malchezaar_axe::JustEngagedWith(), boss_shade_of_aran::JustEngagedWith(), boss_akilzon::JustEngagedWith(), boss_zuljin::JustEngagedWith(), npc_zealot_zath::JustEngagedWith(), npc_black_knight_ghoul::JustEngagedWith(), npc_nexus_lord::JustEngagedWith(), boss_freya::JustEngagedWith(), npc_overlord_drakuru_betrayal::JustEngagedWith(), npc_yor::JustEngagedWith(), boss_blackheart_the_inciter::JustEngagedWith(), npc_flame_of_azzinoth::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nethermancer_sepethrea::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_sacrolash::JustEngagedWith(), boss_alythess::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), boss_vem::JustEngagedWith(), boss_veklor::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_halazzi::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), PetAI::KilledUnit(), boss_ick::boss_ickAI::KilledUnit(), boss_flame_leviathan::KilledUnit(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderStartedMoving(), CreatureGroup::MemberEngagingTarget(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_kerlonian::npc_kerlonianAI::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_ringo::npc_ringoAI::MoveInLineOfSight(), boss_gluth::boss_gluthAI::MoveInLineOfSight(), npc_future_you::npc_future_youAI::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), boss_nightbane::MovementInform(), boss_bug_trio::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_kagani_nightstrike::MovementInform(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), CreatureAI::OnOwnerCombatInteraction(), NecroticPlagueTargetCheck::operator()(), NonTankTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), BoneStormMoveTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), UnboundPlagueTargetSelector::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), boss_nefarian::PathEndReached(), SmartScript::ProcessEvent(), SmartScript::ProcessEventsFor(), SmartScript::ProcessTimedAction(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_yoggsaron_guardian_of_ys::Reset(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), Resurrect(), boss_kiljaeden::ScheduleBasicAbilities(), npc_sunblade_scout::ScheduleCombat(), npc_amanishi_scout::ScheduleCombat(), boss_taldaram::ScheduleCombatEvents(), boss_magtheridon::ScheduleCombatEvents(), npc_thaladred::ScheduleEvents(), boss_nightbane::ScheduleFly(), npc_toc5_grand_champion_minion::ScheduleMountAbilities(), boss_grand_champion::ScheduleMountAbilities(), boss_the_lurker_below::SchedulerPhaseOne(), npc_darkfallen_noble::ScheduleSpells(), npc_giant_claw_tentacle::ScheduleTasks(), boss_dred::boss_dredAI::ScheduleTasks(), boss_faction_championsAI::SelectEnemyCaster(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), PetAI::SelectNextTarget(), spell_patchwerk_hateful_strike_primer::SelectTargets(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), SmartAI::SetCombatMovement(), SetConfused(), SmartAI::SetCurrentRangeMode(), SetFeared(), npc_icc_orb_controller::SetGUID(), SetStunned(), boss_murmur::ShouldCastResonance(), npc_ulduar_iron_construct::SpellHit(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::SpellHitTarget(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), StopAttackFaction(), NPCStaveQuestAI::StorePlayerGUID(), SummonCroneIfReady(), boss_akilzon::SummonEagles(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_dorothee::SummonTito(), boss_netherspite::SwitchToBanishPhase(), npc_onyxian_whelp::TeleportIfVictimUnreachable(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Creature::Update(), Player::Update(), CasterAI::UpdateAI(), ArcherAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_general_angerforge::UpdateAI(), boss_gorosh_the_dervish::UpdateAI(), boss_grizzle::UpdateAI(), boss_hedrum::UpdateAI(), boss_okthor::UpdateAI(), boss_drakkisath::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), npc_rookery_hatcher::UpdateAI(), boss_broodlord::UpdateAI(), boss_firemaw::UpdateAI(), boss_flamegor::UpdateAI(), boss_nefarian::UpdateAI(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), npc_twilight_summon::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_nerubian_burrower::UpdateAI(), npc_anubarak_spike::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::UpdateAI(), boss_marwyn::UpdateAI(), npc_hor_lumbering_abomination::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_putricide_mutated_abomination::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_nexus_lord::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_summons::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), boss_razorscale::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_runic_colossus::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), npc_azure_invader::UpdateAI(), npc_azure_raider::UpdateAI(), npc_azure_captain::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_warbear_matriarch::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), guard_shattrath_scryer::guard_shattrath_scryerAI::UpdateAI(), guard_shattrath_aldor::guard_shattrath_aldorAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), PossessedAI::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_dark_fiend::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), npc_pet_dk_army_of_the_dead::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), SmartAI::UpdateMeleeStance(), SmartAI::UpdatePath(), boss_netherspite::UpdatePortals(), CreatureAI::UpdateVictim(), CreatureAI::UpdateVictimWithGaze(), and boss_hexlord_malacrass::UseAbility().

◆ GetVirtualItemId()

uint32 Unit::GetVirtualItemId ( uint32  slot) const
16952{
16953 if (slot >= MAX_EQUIPMENT_ITEMS)
16954 return 0;
16955
16957}
#define MAX_EQUIPMENT_ITEMS
Definition CreatureData.h:36
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition UpdateFields.h:116

References Object::GetUInt32Value(), MAX_EQUIPMENT_ITEMS, and UNIT_VIRTUAL_ITEM_SLOT_ID.

◆ GetVisibleAura()

AuraApplication * Unit::GetVisibleAura ( uint8  slot)
inline
1558 {
1559 VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
1560 if (itr != m_visibleAuras.end())
1561 return itr->second;
1562 return nullptr;
1563 }

References m_visibleAuras.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), AuraApplication::BuildUpdatePacket(), and WorldSession::HandleRequestPartyMemberStatsOpcode().

◆ GetVisibleAuras()

◆ GetWeaponDamageRange()

float Unit::GetWeaponDamageRange ( WeaponAttackType  attType,
WeaponDamageRange  type,
uint8  damageIndex = 0 
) const
12011{
12012 if (attType == OFF_ATTACK && !HasOffhandWeaponForAttack())
12013 return 0.0f;
12014
12015 return m_weaponDamage[attType][type][damageIndex];
12016}

References HasOffhandWeaponForAttack(), m_weaponDamage, and OFF_ATTACK.

Referenced by Player::_ApplyWeaponDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and Guardian::UpdateDamagePhysical().

◆ GetWeaponProcChance()

float Unit::GetWeaponProcChance ( ) const
10295{
10296 // normalized proc chance for weapon attack speed
10297 // (odd formula...)
10299 return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f);
10301 return (GetAttackTime(OFF_ATTACK) * 1.6f / 1000.0f);
10302 return 0;
10303}

References BASE_ATTACK, GetAttackTime(), HasOffhandWeaponForAttack(), isAttackReady(), and OFF_ATTACK.

Referenced by Player::CastItemCombatSpell().

◆ GetWeaponSkillValue()

uint32 Unit::GetWeaponSkillValue ( WeaponAttackType  attType,
Unit const *  target = nullptr 
) const
3701{
3702 uint32 value = 0;
3703 if (Player const* player = ToPlayer())
3704 {
3705 Item* item = player->GetWeaponForAttack(attType, true);
3706
3707 // feral or unarmed skill only for base attack
3708 if (attType != BASE_ATTACK && !item)
3709 return 0;
3710
3711 if (IsInFeralForm())
3712 return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
3713
3714 // weapon skill or (unarmed for base attack)
3715 uint32 skill = SKILL_UNARMED;
3716 if (item)
3717 skill = item->GetSkill();
3718
3719 // in PvP use full skill instead current skill value
3720 value = (target && target->IsControlledByPlayer())
3721 ? player->GetMaxSkillValue(skill)
3722 : player->GetSkillValue(skill);
3723 // Modify value from ratings
3724 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL));
3725 switch (attType)
3726 {
3727 case BASE_ATTACK:
3728 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND));
3729 break;
3730 case OFF_ATTACK:
3731 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND));
3732 break;
3733 case RANGED_ATTACK:
3734 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED));
3735 break;
3736 default:
3737 break;
3738 }
3739 }
3740 else
3741 value = GetUnitMeleeSkill(target);
3742 return value;
3743}
@ SKILL_UNARMED
Definition SharedDefines.h:3140
@ CR_WEAPON_SKILL_RANGED
Definition Unit.h:253
@ CR_WEAPON_SKILL
Definition Unit.h:231
@ CR_WEAPON_SKILL_OFFHAND
Definition Unit.h:252
@ CR_WEAPON_SKILL_MAINHAND
Definition Unit.h:251
uint32 GetSkill()
Definition Item.cpp:549
bool IsInFeralForm() const
Definition Unit.h:1982

References BASE_ATTACK, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, GetMaxSkillValueForLevel(), Item::GetSkill(), GetUnitMeleeSkill(), IsControlledByPlayer(), IsInFeralForm(), OFF_ATTACK, RANGED_ATTACK, SKILL_UNARMED, and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), RollMeleeOutcomeAgainst(), and Player::UpdateCritPercentage().

◆ HandleAuraRaidProcFromCharge()

bool Unit::HandleAuraRaidProcFromCharge ( AuraEffect *  triggeredByAura)
private
13617{
13618 // aura can be deleted at casts
13619 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
13620
13621 uint32 damageSpellId;
13622 switch (spellProto->Id)
13623 {
13624 case 57949: // shiver
13625 damageSpellId = 57952;
13626 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
13627 break;
13628 case 59978: // shiver
13629 damageSpellId = 59979;
13630 break;
13631 case 43593: // Cold Stare
13632 damageSpellId = 43594;
13633 break;
13634 default:
13635 LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: {}", spellProto->Id);
13636 return false;
13637 }
13638
13639 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
13640
13641 // jumps
13642 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
13643
13644 // current aura expire
13645 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
13646
13647 // next target selection
13648 if (jumps > 0)
13649 {
13650 if (Unit* caster = triggeredByAura->GetCaster())
13651 {
13652 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
13653 if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
13654 {
13655 CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
13656 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
13657 aura->SetCharges(jumps);
13658 }
13659 }
13660 }
13661
13662 CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
13663
13664 return true;
13665}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:1005
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:8060

References CastSpell(), SpellInfo::Effects, AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), GetNextRandomRaidMemberOrPet(), AuraEffect::GetSpellInfo(), SpellInfo::Id, LOG_ERROR, and Aura::SetCharges().

◆ HandleAuraRaidProcFromChargeWithValue()

bool Unit::HandleAuraRaidProcFromChargeWithValue ( AuraEffect *  triggeredByAura)
private
13528{
13529 // aura can be deleted at casts
13530 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
13531 int32 heal = triggeredByAura->GetAmount();
13532 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
13533
13534 // Currently only Prayer of Mending
13535 if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
13536 {
13537 LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: {}", spellProto->Id);
13538 return false;
13539 }
13540
13541 // jumps
13542 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
13543
13544 // current aura expire
13545 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
13546
13547 // next target selection
13548 if (jumps > 0)
13549 {
13550 if (Unit* caster = triggeredByAura->GetCaster())
13551 {
13552 // smart healing
13553 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
13554 std::list<Unit*> nearMembers;
13555
13556 Player* player = nullptr;
13557 if (IsPlayer())
13558 player = ToPlayer();
13559 else if (GetOwner())
13560 player = GetOwner()->ToPlayer();
13561
13562 if (player)
13563 {
13564 Group* group = player->GetGroup();
13565 if (!group)
13566 {
13567 if (player != this)
13568 {
13569 if (IsWithinDistInMap(player, radius))
13570 nearMembers.push_back(player);
13571 }
13572 else if (Unit* pet = GetGuardianPet())
13573 {
13574 if (IsWithinDistInMap(pet, radius))
13575 nearMembers.push_back(pet);
13576 }
13577 }
13578 else
13579 {
13580 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
13581 if (Player* Target = itr->GetSource())
13582 {
13583 if (Target != this && !IsWithinDistInMap(Target, radius))
13584 continue;
13585
13586 // IsHostileTo check duel and controlled by enemy
13587 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
13588 nearMembers.push_back(Target);
13589
13590 // Push player's pet to vector
13591 if (Unit* pet = Target->GetGuardianPet())
13592 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
13593 nearMembers.push_back(pet);
13594 }
13595 }
13596
13597 if (!nearMembers.empty())
13598 {
13599 nearMembers.sort(Acore::HealthPctOrderPred());
13600 if (Unit* target = nearMembers.front())
13601 {
13602 CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
13603 CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
13604 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
13605 aura->SetCharges(jumps);
13606 }
13607 }
13608 }
13609 }
13610 }
13611
13612 // heal
13613 CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid);
13614 return true;
13615}
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3790
Definition Unit.h:2316

References CastCustomSpell(), CastSpell(), SpellInfo::Effects, AuraEffect::GetAmount(), AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), GetOwner(), AuraEffect::GetSpellInfo(), SpellInfo::Id, IsHostileTo(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, Aura::SetCharges(), SPELLFAMILY_PRIEST, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and Object::ToPlayer().

◆ HandleEmoteCommand()

void Unit::HandleEmoteCommand ( uint32  emoteId)
2196{
2198 packet.EmoteID = emoteId;
2199 packet.Guid = GetGUID();
2200 SendMessageToSet(packet.Write(), true);
2201}
Definition ChatPackets.h:29
WorldPacket const * Write() override
Definition ChatPackets.cpp:20
uint32 EmoteID
Definition ChatPackets.h:35
ObjectGuid Guid
Definition ChatPackets.h:36

References WorldPackets::Chat::Emote::EmoteID, Object::GetGUID(), WorldPackets::Chat::Emote::Guid, WorldObject::SendMessageToSet(), and WorldPackets::Chat::Emote::Write().

Referenced by npc_ulduar_leviathan_mkii::AttackStart(), npc_ulduar_vx001::DamageTaken(), boss_viscidus::DamageTaken(), boss_kiljaeden::DamageTaken(), DealMeleeDamage(), npc_dkc1_gothik::DoAction(), boss_twinemperorsAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_felblood_kaelthas::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), boss_hodir::DoHelperVictoryEmotes(), StandUpEvent::Execute(), PartyTimeEmoteEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_ragnaros::HandleEmerge(), WorldSession::HandleEmoteOpcode(), spell_chapter5_return_to_capital::HandleHit(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcYellCommand(), spell_item_toy_train_set::HandleScriptEffect(), WorldSession::HandleTextEmoteOpcode(), boss_yoggsaron_constrictor_tentacle::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_sentinel_leader::MovementInform(), npc_sentinel_infiltrator::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_akama_illidan::MovementInform(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::MovementInform(), boss_felmyst::MovementInform(), boss_xt002::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), spell_gen_spectator_cheer_trigger::PrepareSpellScript(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), PetAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), boss_ragnaros::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), DarkFallenAI::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_felmyst::ScheduleGroundAbilities(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), npc_rocknot::ScheduleKiss(), CreatureTextMgr::SendEmote(), boss_grand_warlock_nethekurse::SetData(), npc_harrison_jones::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_rocknot::sQuestReward(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), boss_nightbane::TriggerHealthTakeOff(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), boss_rend_blackhand::UpdateAI(), boss_vaelastrasz::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_valkyr_battle_maiden::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shenthul::npc_shenthulAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_highlord_tirion_fordring_lh::npc_highlord_tirion_fordringAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_mimiron::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_dancing_flames::npc_dancing_flamesAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_rocknot::UpdateEscortAI(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), npc_isla_starmane::npc_isla_starmaneAI::WaypointReached(), and npc_rocknot::WaypointStart().

◆ HandleProcExtraAttackFor()

void Unit::HandleProcExtraAttackFor ( Unit *  victim,
uint32  count 
)
2959{
2960 while (count)
2961 {
2962 --count;
2963 AttackerStateUpdate(victim, BASE_ATTACK, true);
2964 }
2965}
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition Unit.cpp:2760

References AttackerStateUpdate(), and BASE_ATTACK.

Referenced by Update().

◆ HandleSafeUnitPointersOnDelete()

void Unit::HandleSafeUnitPointersOnDelete ( Unit *  thisUnit)
static
4302{
4303 if (thisUnit->SafeUnitPointerSet.empty())
4304 return;
4305 for (std::set<SafeUnitPointer*>::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr)
4306 (*itr)->UnitDeleted();
4307
4308 thisUnit->SafeUnitPointerSet.clear();
4309}

References SafeUnitPointerSet.

Referenced by ~Unit().

◆ HandleSpellClick()

bool Unit::HandleSpellClick ( Unit *  clicker,
int8  seatId = -1 
)

First check simple relations from clicker to clickee

Check database conditions

15229{
15230 Creature* creature = ToCreature();
15231 if (creature && creature->IsAIEnabled)
15232 {
15233 if (!creature->AI()->BeforeSpellClick(clicker))
15234 {
15235 return false;
15236 }
15237 }
15238
15239 bool result = false;
15240 uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
15241 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
15242 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
15243 {
15245 if (!itr->second.IsFitToRequirements(clicker, this))
15246 continue;
15247
15249 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
15250 ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
15251 if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
15252 continue;
15253
15254 Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
15255 Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
15256 ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
15257
15258 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId);
15259
15260 // xinef: dont allow players to enter vehicles on arena
15261 if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->IsPlayer() && caster->FindMap() && caster->FindMap()->IsBattleArena())
15262 continue;
15263
15264 if (seatId > -1)
15265 {
15266 uint8 i = 0;
15267 bool valid = false;
15268 while (i < MAX_SPELL_EFFECTS)
15269 {
15270 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
15271 {
15272 valid = true;
15273 break;
15274 }
15275 ++i;
15276 }
15277
15278 if (!valid)
15279 {
15280 LOG_ERROR("sql.sql", "Spell {} specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
15281 continue;
15282 }
15283
15284 if (IsInMap(caster))
15285 caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
15286 else // This can happen during Player::_LoadAuras
15287 {
15289 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
15290 bp0[j] = spellInfo->Effects[j].BasePoints;
15291
15292 bp0[i] = seatId;
15293 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
15294 }
15295 }
15296 else
15297 {
15298 if (IsInMap(caster))
15299 caster->CastSpell(target, spellInfo, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
15300 else
15301 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
15302 }
15303
15304 result = true;
15305 }
15306
15307 if (creature && creature->IsAIEnabled)
15308 creature->AI()->OnSpellClick(clicker, result);
15309
15310 return result;
15311}
#define sConditionMgr
Definition ConditionMgr.h:296
std::list< Condition * > ConditionList
Definition ConditionMgr.h:240
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition ObjectMgr.h:412
@ NPC_CLICK_CAST_TARGET_CLICKER
Definition SharedDefines.h:679
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
Definition SharedDefines.h:680
@ NPC_CLICK_CAST_CASTER_CLICKER
Definition SharedDefines.h:678
SpellValueMod
Definition SpellDefines.h:120
virtual void OnSpellClick(Unit *, bool &)
Definition CreatureAI.h:243
virtual bool BeforeSpellClick(Unit *)
Definition CreatureAI.h:241
bool IsBattleArena() const
Definition Map.h:306
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:906
uint32 GetCreatureEntry() const
Definition Vehicle.h:39
Map * FindMap() const
Definition Object.h:638
Definition ConditionMgr.h:185

References Creature::AI(), CreatureAI::BeforeSpellClick(), CastCustomSpell(), CastSpell(), SpellInfo::Effects, WorldObject::FindMap(), Vehicle::GetCreatureEntry(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), GetVehicleKit(), SpellInfo::HasAura(), IsAIEnabled, Map::IsBattleArena(), WorldObject::IsInMap(), Object::IsPlayer(), LOG_ERROR, MAX_EFFECT_MASK, MAX_SPELL_EFFECTS, NPC_CLICK_CAST_CASTER_CLICKER, NPC_CLICK_CAST_ORIG_CASTER_OWNER, NPC_CLICK_CAST_TARGET_CLICKER, CreatureAI::OnSpellClick(), sConditionMgr, sObjectMgr, SPELL_AURA_CONTROL_VEHICLE, SPELLVALUE_BASE_POINT0, sSpellMgr, Object::ToCreature(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_NONE, and Aura::TryRefreshStackOrCreate().

Referenced by WorldSession::HandleSpellClick(), Vehicle::InstallAccessory(), boss_xt002::JustEngagedWith(), and npc_ulduar_vx001::UpdateAI().

◆ HandleStatFlatModifier()

bool Unit::HandleStatFlatModifier ( UnitMods  unitMod,
UnitModifierFlatType  modifierType,
float  amount,
bool  apply 
)
11637{
11638 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_FLAT_END)
11639 {
11640 LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
11641 return false;
11642 }
11643
11644 if (!amount)
11645 return false;
11646
11647 switch (modifierType)
11648 {
11649 case BASE_VALUE:
11650 case TOTAL_VALUE:
11651 m_auraFlatModifiersGroup[unitMod][modifierType] += apply ? amount : -amount;
11652 break;
11653 default:
11654 break;
11655 }
11656
11657 UpdateUnitMod(unitMod);
11658 return true;
11659}
void apply(T *val)
Definition ByteConverter.h:40

References BASE_VALUE, LOG_ERROR, m_auraFlatModifiersGroup, MODIFIER_TYPE_FLAT_END, TOTAL_VALUE, UNIT_MOD_END, and UpdateUnitMod().

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), AuraEffect::HandleAuraModAttackPower(), AuraEffect::HandleAuraModIncreaseEnergy(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), AuraEffect::HandleAuraModRangedAttackPower(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleModBaseResistance(), and Player::UpdateDamageDoneMods().

◆ HasActivePowerType()

◆ HasAllAuras()

template<typename... Auras>
bool Unit::HasAllAuras ( Auras...  spellIds) const
inline

Checks if the unit has ALL specified auras.

Template Parameters
AurasCan be any type convertible to uint32.
Parameters
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the unit has ALL of the specified auras. Otherwise false.
1505 {
1506 std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
1507 return HasAuras(SearchMethod::MatchAll, spellList);
1508 }
bool HasAuras(SearchMethod sm, std::vector< uint32 > &spellIds) const
Check if unit has ANY or ALL specified auras.
Definition Unit.cpp:5792

References HasAuras(), and MatchAll.

Referenced by achievement_staying_buffed_all_winter_10::OnCheck(), achievement_staying_buffed_all_winter_25::OnCheck(), npc_alchemist_adrianna::OnGossipHello(), and npc_nelson::npc_nelsonAI::SpellHit().

◆ HasAllowOnlyAbilityAura()

bool Unit::HasAllowOnlyAbilityAura ( ) const
inline
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition SpellAuraDefines.h:326
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5822

References HasAuraType(), and SPELL_AURA_ALLOW_ONLY_ABILITY.

Referenced by AuraEffect::HandleAuraAllowOnlyAbility().

◆ HasAnyAuras()

template<typename... Auras>
bool Unit::HasAnyAuras ( Auras...  spellIds) const
inline

◆ HasAOECharmAura()

bool Unit::HasAOECharmAura ( ) const
inline
@ SPELL_AURA_AOE_CHARM
Definition SpellAuraDefines.h:240

References HasAuraType(), and SPELL_AURA_AOE_CHARM.

◆ HasAttackerSpellCritChanceAura()

bool Unit::HasAttackerSpellCritChanceAura ( ) const
inline
@ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:242

References HasAuraType(), and SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE.

Referenced by SpellTakenCritChance().

◆ HasAura()

bool Unit::HasAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5816{
5817 if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
5818 return true;
5819 return false;
5820}

References GetAuraApplication().

Referenced by at_hol_hall_of_watchers::_OnTrigger(), boss_grand_champion::AddCreatureAddonAuras(), Pet::AddToWorld(), spell_warl_health_funnel::ApplyEffect(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ApplyIccHealthBuff(), Player::ApplyItemDependentAuras(), Player::ApplyItemObtainSpells(), boss_archavon::boss_archavonAI::AttackStart(), boss_emalon::boss_emalonAI::AttackStart(), boss_koralon::boss_koralonAI::AttackStart(), boss_toravon::boss_toravonAI::AttackStart(), boss_leotheras_the_blind::AttackStart(), npc_toc5_player_vehicle::BeforeSpellClick(), boss_grand_champion::boss_grand_champion(), boss_hodir::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_chromaggus::CanAIAttack(), npc_parasitic_shadowfiend::CanAIAttack(), npc_wg_siege_machine::npc_wg_siege_machineAI::CanControlVehicle(), Player::CanJoinToBattleground(), Player::CanResummonPet(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CastItemCombatSpell(), spell_pal_aura_mastery_immune::CheckAreaTarget(), spell_q12237_rescue_villager::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_pal_immunities::CheckCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), Spell::CheckItems(), spell_rog_honor_among_thieves::CheckProc(), spell_dru_eclipse::CheckProc(), spell_hun_lock_and_load::CheckProc(), spell_mage_combustion::CheckProc(), spell_mage_gen_extra_effects::CheckProc(), spell_pal_hand_of_sacrifice::CheckTarget(), SpellInfo::CheckTarget(), npc_jenny::DamageTaken(), npc_mc_core_hound::DamageTaken(), boss_sartharion::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), boss_yoggsaron::DamageTaken(), boss_thekal::DamageTaken(), boss_tenris_mirkblood::DamageTaken(), boss_anub_arak::DamageTaken(), boss_thorim::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_razorscale_harpoon_fire_state::DoAction(), boss_hydross_the_unstable::DoAction(), boss_lady_vashj::DoAction(), boss_kalecgos::DoAction(), npc_midsummer_ribbon_pole_target::DoCleanupChecks(), Spell::DoCreateItem(), boss_hodir::DoHelperVictoryEmotes(), Spell::EffectDummy(), Spell::EffectHeal(), Spell::EffectInstaKill(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonPlayer(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), NPCStaveQuestAI::EvadeOnFeignDeath(), IceTombSummonEvent::Execute(), PartyTimeEmoteEvent::Execute(), spell_class_call_polymorph::FilterTargets(), spell_dru_wild_growth::FilterTargets(), spell_pri_circle_of_healing::FilterTargets(), lfg::LFGMgr::FinishDungeon(), npc_razorscale_harpoon_fire_state::GetData(), GetDispellableAuraList(), Player::GetResurrectionSpellId(), go_wind_stone::go_wind_stoneAI::GossipHello(), go_soulwell::go_soulwellAI::GossipHello(), go_orb_of_domination::GossipHello(), spell_braziers_hit::HandleAfterEffectApply(), spell_dk_scourge_strike::HandleAfterHit(), spell_amanitar_potent_fungus::HandleApply(), spell_dru_enrage::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraMounted(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBattleFieldPortOpcode(), spell_thaddius_pos_neg_charge::HandleDamage(), spell_capacitus_polarity_charge::HandleDamage(), spell_mage_summon_water_elemental::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_execute::HandleEffect(), spell_q12851_going_bearback::HandleEffectApply(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_cauldron_event_timer_aura::HandleExpire(), Player::HandleFall(), gm_commandscript::HandleGMVisibleCommand(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleMessagechatOpcode(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_mark_of_frost_freeze::HandleOnHit(), OPvPCapturePointZM_Graveyard::HandleOpenGo(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_dru_omen_of_clarity::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dru_glyph_of_shred::HandleProc(), spell_pal_infusion_of_light::HandleProc(), spell_pal_light_s_beacon::HandleProc(), spell_mage_gen_extra_effects::HandleProc(), spell_warr_vigilance::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_pal_lay_on_hands::HandleScript(), spell_freya_attuned_to_nature_dose_reduction::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12641_death_comes_from_on_high_recall_eye::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_dru_glyph_of_starfire::HandleScriptEffect(), misc_commandscript::HandleUnFreezeCommand(), boss_yoggsaron_sara::HasAlivePlayerInIllusion(), HasAuras(), boss_yoggsaron_sara::InformCloud(), boss_taldaram::InitializeAI(), npc_pet_hunter_snake_trap::InitializeAI(), Player::IsDeserter(), SpellArea::IsFitToRequirements(), boss_krik_thir::boss_krik_thirAI::IsInFrenzy(), npc_anzu_spirit::IsSummonedBy(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), lfg::LFGMgr::JoinLfg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), boss_sindragosa::boss_sindragosaAI::JustDied(), boss_hydross_the_unstable::JustDied(), boss_alar::JustDied(), npc_sunblade_scout::JustEngagedWith(), boss_zuljin::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), boss_bjarngrim::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), boss_vem::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_faerlina::boss_faerlinaAI::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_hydross_the_unstable::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), Kill(), boss_hydross_the_unstable::KilledUnit(), boss_hadronox::KilledUnit(), Creature::LoadCreaturesAddon(), WorldObject::ModSpellCastTime(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_daranelle::npc_daranelleAI::MoveInLineOfSight(), boss_jormungarAI::MovementInform(), boss_felmyst::MovementInform(), boss_kagani_nightstrike::MovementInform(), achievement_fa_la_la_la_ogrila::OnCheck(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), MidsummerPlayerScript::OnPlayerUpdateZone(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_mage_missile_barrage_proc::OnRemove(), spell_mage_arcane_missiles::OnRemove(), at_karazhan_atiesh_aran::OnTrigger(), at_hor_battered_hilt_start::OnTrigger(), at_hor_battered_hilt_throw::OnTrigger(), at_commander_dawnforge::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Acore::FriendlyMissingBuffInRange::operator()(), NotInStomachSelector::operator()(), SindragosaIceTombCheck::operator()(), DefaultTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), ShadowOfDeathSelector::operator()(), Acore::UnitAuraCheck::operator()(), SpectralBlastCheck::operator()(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Player::ReportedAfkBy(), npc_corrupted_totem::Reset(), boss_janalai::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_magus_telestra::Reset(), boss_fathomlord_karathress::Reset(), Player::RewardHonor(), RewardRage(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_grand_champion::ScheduleFindNewMount(), boss_supremus::SchedulePhase(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::SelectNewTarget(), Player::SendInitialPacketsAfterAddToMap(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), boss_anomalus::SetData(), BattlefieldWG::SetupBattlefield(), npc_chesspiece::sGossipHello(), npc_aged_dying_ancient_kodo::sGossipHello(), npc_omen::npc_omenAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_necropolis::SpellHit(), npc_pool_of_tar::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_necrotic_shard::SpellHit(), boss_magus_telestra::SpellHit(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::SpellHit(), SpellPctDamageModsDone(), SpellTakenCritChance(), boss_moam::SummonedCreatureDies(), boss_apothecary_hummel::boss_apothecary_hummelAI::SummonedCreatureDies(), npc_blackhand_incarcerator::UpdateAI(), boss_vaelastrasz::UpdateAI(), npc_mc_core_hound::UpdateAI(), npc_cyclone::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_moam::UpdateAI(), boss_ossirian::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_grand_champion::UpdateAI(), boss_anubarak_trial::UpdateAI(), npc_nerubian_burrower::UpdateAI(), npc_anubarak_spike::UpdateAI(), npc_hor_lich_king::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_vezax::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_yoggsaron_cloud::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), boss_ichoron::UpdateAI(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_dark_fiend::UpdateAI(), Player::UpdateAreaDependentAuras(), boss_netherspite::UpdatePortals(), Player::UpdateZoneDependentAuras(), and Spell::WriteAmmoToPacket().

◆ HasAuraEffect()

bool Unit::HasAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  caster = ObjectGuid::Empty 
) const
5763{
5764 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5765 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5766 {
5767 if (itr->second->HasEffect(effIndex)
5768 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5769 {
5770 return true;
5771 }
5772 }
5773 return false;
5774}

References m_appliedAuras.

Referenced by AuraEffect::HandleAuraModIncreaseFlightSpeed(), spell_q12683_take_sputum_sample::HandleDummy(), AchievementCriteriaData::Meets(), and boss_headless_horseman::UpdateAI().

◆ HasAuras()

bool Unit::HasAuras ( SearchMethod  sm,
std::vector< uint32 > &  spellIds 
) const

Check if unit has ANY or ALL specified auras.

Parameters
smThe search method to use
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the search method condition is met. Otherwise false.
5793{
5794 if (sm == SearchMethod::MatchAll)
5795 {
5796 for (auto const& spellId : spellIds)
5797 if (!HasAura(spellId))
5798 return false;
5799 return true;
5800 }
5801 else if (sm == SearchMethod::MatchAny)
5802 {
5803 for (auto const& spellId : spellIds)
5804 if (HasAura(spellId))
5805 return true;
5806 return false;
5807 }
5808 else
5809 {
5810 LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm);
5811 return false;
5812 }
5813}

References HasAura(), LOG_ERROR, MatchAll, and MatchAny.

Referenced by HasAllAuras(), and HasAnyAuras().

◆ HasAuraState()

bool Unit::HasAuraState ( AuraStateType  flag,
SpellInfo const *  spellProto = nullptr,
Unit const *  Caster = nullptr 
) const
7482{
7483 if (Caster)
7484 {
7485 if (spellProto)
7486 {
7487 AuraEffectList const& stateAuras = Caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
7488 for (AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
7489 if ((*j)->IsAffectedOnSpell(spellProto))
7490 return true;
7491 }
7492 // Check per caster aura state
7493 // If aura with aurastate by caster not found return false
7494 if ((1 << (flag - 1)) & PER_CASTER_AURA_STATE_MASK)
7495 {
7496 AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
7497 for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
7498 if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
7499 return true;
7500 return false;
7501 }
7502 }
7503
7504 return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7505}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition Unit.h:684

References GetAuraEffectsByType(), Object::GetGUID(), Object::HasFlag(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, SPELL_AURA_ABILITY_IGNORE_AURASTATE, and UNIT_FIELD_AURASTATE.

Referenced by Player::_addSpell(), Pet::addSpell(), Spell::CheckCast(), spell_sha_earthliving_weapon::CheckProc(), spell_warl_decimation::CheckProc(), SpellInfo::CheckTarget(), ClearAllReactives(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_sweeping_strikes::HandleProc(), isFrozen(), Player::LoadFromDB(), SpellPctDamageModsDone(), SpellTakenCritChance(), and UpdateReactives().

◆ HasAuraType()

bool Unit::HasAuraType ( AuraType  auraType) const
5823{
5824 return (!m_modAuras[auraType].empty());
5825}

References m_modAuras.

Referenced by npc_anubarak_spike::CanPursue(), Player::CanTameExoticPets(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraEmpathy(), AuraEffect::HandleAuraFeatherFall(), AuraEffect::HandleAuraHover(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModStalked(), AuraEffect::HandleAuraTrackStealthed(), AuraEffect::HandleAuraUntrackable(), AuraEffect::HandleAuraWaterWalk(), AuraEffect::HandleComprehendLanguage(), AuraEffect::HandleForceMoveForward(), HasAllowOnlyAbilityAura(), HasAOECharmAura(), HasAttackerSpellCritChanceAura(), HasAuraTypeWithFamilyFlags(), HasCloneCasterAura(), HasConfuseAura(), HasControlVehicleAura(), HasDecreaseSpeedAura(), HasDetectAmoreAura(), HasDetectSpellsAura(), HasFearAura(), HasFeatherFallAura(), HasFlyAura(), HasGhostAura(), HasHealthRegenInCombatAura(), HasHoverAura(), HasIgnoreHitDirectionAura(), HasIgnoreTargetResistModifiersAura(), HasIncreaseMountedFlightSpeedAura(), HasIncreaseMountedSpeedAura(), HasInterruptRegenAura(), HasInvisibilityAura(), HasInvisibilityDetectAura(), Player::HasItemFitToSpellRequirements(), HasMountedAura(), HasNoPVPCreditAura(), HasOpenStableAura(), HasPacifyAura(), HasPacifySilenceAura(), HasPeriodicDummyAura(), HasPreventDurabilityLossAura(), HasPreventResurectionAura(), HasPreventsFleeingAura(), HasReflectSpellsAura(), HasRegenDuringCombatAura(), HasRootAura(), HasShapeshiftAura(), HasSilenceAura(), HasSpellMagnetAura(), HasSpiritOfRedemptionAura(), HasStealthAura(), HasStealthDetectAura(), HasStunAura(), HasTauntAura(), HasTransformAura(), HasUnattackableAura(), HasWaterBreathingAura(), HasWaterWalkAura(), Player::IsFreeFlying(), Player::RemoveItemDependentAurasAndCasts(), Vehicle::RemovePassenger(), Player::SendInitialPacketsAfterAddToMap(), and ThreatReference::ShouldBeSuppressed().

◆ HasAuraTypeWithAffectMask()

bool Unit::HasAuraTypeWithAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5856{
5857 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5858 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5859 if ((*i)->IsAffectedOnSpell(affectedSpell))
5860 return true;
5861 return false;
5862}

References GetAuraEffectsByType().

Referenced by AuraEffect::CalculatePeriodic(), Spell::DoSpellHitOnUnit(), Spell::handle_immediate(), Aura::RefreshDuration(), and Aura::RefreshTimersWithMods().

◆ HasAuraTypeWithCaster()

bool Unit::HasAuraTypeWithCaster ( AuraType  auratype,
ObjectGuid  caster 
) const
5828{
5829 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5830 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5831 if (caster == (*i)->GetCasterGUID())
5832 return true;
5833 return false;
5834}

References GetAuraEffectsByType().

Referenced by BuildValuesUpdate(), IsAlwaysDetectableFor(), and PatchValuesUpdate().

◆ HasAuraTypeWithFamilyFlags()

bool Unit::HasAuraTypeWithFamilyFlags ( AuraType  auraType,
uint32  familyName,
uint32  familyFlags 
) const
904{
905 if (!HasAuraType(auraType))
906 return false;
907 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
908 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
909 if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
910 if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
911 return true;
912 return false;
913}

References GetAuraEffectsByType(), and HasAuraType().

◆ HasAuraTypeWithMiscvalue()

bool Unit::HasAuraTypeWithMiscvalue ( AuraType  auratype,
int32  miscvalue 
) const
5847{
5848 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5849 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5850 if (miscvalue == (*i)->GetMiscValue())
5851 return true;
5852 return false;
5853}

References GetAuraEffectsByType().

Referenced by Player::Regenerate(), Player::UpdateManaRegen(), and Player::UpdateStats().

◆ HasAuraTypeWithTriggerSpell()

bool Unit::HasAuraTypeWithTriggerSpell ( AuraType  auratype,
uint32  triggerSpell 
) const
5874{
5875 for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
5876 {
5877 if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
5878 {
5879 return true;
5880 }
5881 }
5882
5883 return false;
5884}

References GetAuraEffectsByType().

Referenced by WorldSession::HandlePetActionHelper().

◆ HasAuraTypeWithValue()

bool Unit::HasAuraTypeWithValue ( AuraType  auratype,
int32  value 
) const
5865{
5866 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5867 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5868 if (value == (*i)->GetAmount())
5869 return true;
5870 return false;
5871}

References GetAuraEffectsByType().

◆ HasAuraWithMechanic()

bool Unit::HasAuraWithMechanic ( uint64  mechanicMask) const
5910{
5911 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5912 {
5913 SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
5914 if (spellInfo->Mechanic && (mechanicMask & (1ULL << spellInfo->Mechanic)))
5915 return true;
5916
5917 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5918 if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
5919 if (mechanicMask & (1ULL << spellInfo->Effects[i].Mechanic))
5920 return true;
5921 }
5922
5923 return false;
5924}

References SpellInfo::Effects, m_appliedAuras, MAX_SPELL_EFFECTS, and SpellInfo::Mechanic.

Referenced by EarthenPowerTargetSelector::operator()(), SpellPctDamageModsDone(), SpellTakenCritChance(), and npc_pet_mage_mirror_image::UpdateAI().

◆ HasBreakableByDamageAuraType()

bool Unit::HasBreakableByDamageAuraType ( AuraType  type,
uint32  excludeAura = 0 
) const
958{
959 AuraEffectList const& auras = GetAuraEffectsByType(type);
960 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
961 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
962 ((*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
963 return true;
964 return false;
965}

References AURA_INTERRUPT_FLAG_TAKE_DAMAGE, and GetAuraEffectsByType().

Referenced by HasBreakableByDamageCrowdControlAura(), and ThreatReference::ShouldBeSuppressed().

◆ HasBreakableByDamageCrowdControlAura()

bool Unit::HasBreakableByDamageCrowdControlAura ( Unit *  excludeCasterChannel = nullptr) const
968{
969 uint32 excludeAura = 0;
970 if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
971 excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
972
978}
@ SPELL_AURA_MOD_FEAR
Definition SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition SpellAuraDefines.h:89
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
@ SPELL_AURA_MOD_CONFUSE
Definition SpellAuraDefines.h:68
@ SPELL_AURA_MOD_STUN
Definition SpellAuraDefines.h:75
bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura=0) const
Definition Unit.cpp:957
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1593

References CURRENT_CHANNELED_SPELL, GetCurrentSpell(), HasBreakableByDamageAuraType(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, and SPELL_AURA_TRANSFORM.

Referenced by PetAI::CanAttack(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), CasterAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ HasCloneCasterAura()

bool Unit::HasCloneCasterAura ( ) const
inline
@ SPELL_AURA_CLONE_CASTER
Definition SpellAuraDefines.h:310

References HasAuraType(), and SPELL_AURA_CLONE_CASTER.

Referenced by WorldSession::HandleMirrorImageDataRequest().

◆ HasConfuseAura()

bool Unit::HasConfuseAura ( ) const
inline

◆ HasControlVehicleAura()

bool Unit::HasControlVehicleAura ( ) const
inline

◆ HasDecreaseSpeedAura()

bool Unit::HasDecreaseSpeedAura ( ) const
inline
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition SpellAuraDefines.h:96

References HasAuraType(), and SPELL_AURA_MOD_DECREASE_SPEED.

Referenced by Spell::EffectWeaponDmg().

◆ HasDetectAmoreAura()

bool Unit::HasDetectAmoreAura ( ) const
inline
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233

References HasAuraType(), and SPELL_AURA_DETECT_AMORE.

Referenced by AuraEffect::HandleDetectAmore().

◆ HasDetectSpellsAura()

bool Unit::HasDetectSpellsAura ( ) const
inline
@ SPELL_AURA_DEFLECT_SPELLS
Definition SpellAuraDefines.h:350

References HasAuraType(), and SPELL_AURA_DEFLECT_SPELLS.

◆ HasExtraUnitMovementFlag()

uint16 Unit::HasExtraUnitMovementFlag ( uint16  f) const
inline

◆ HasFearAura()

◆ HasFeatherFallAura()

bool Unit::HasFeatherFallAura ( ) const
inline
@ SPELL_AURA_FEATHER_FALL
Definition SpellAuraDefines.h:168

References HasAuraType(), and SPELL_AURA_FEATHER_FALL.

Referenced by Player::HandleFall().

◆ HasFlyAura()

◆ HasGhostAura()

bool Unit::HasGhostAura ( ) const
inline

◆ HasHealthRegenInCombatAura()

bool Unit::HasHealthRegenInCombatAura ( ) const
inline
@ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
Definition SpellAuraDefines.h:224

References HasAuraType(), and SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT.

Referenced by Player::RegenerateAll().

◆ HasHoverAura()

bool Unit::HasHoverAura ( ) const
inline
1821{ return HasAuraType(SPELL_AURA_HOVER); };
@ SPELL_AURA_HOVER
Definition SpellAuraDefines.h:169

References HasAuraType(), and SPELL_AURA_HOVER.

Referenced by Player::HandleFall(), and Creature::UpdateMovementFlags().

◆ HasIgnoreHitDirectionAura()

bool Unit::HasIgnoreHitDirectionAura ( ) const
inline

◆ HasIgnoreTargetResistModifiersAura()

bool Unit::HasIgnoreTargetResistModifiersAura ( ) const
inline
@ SPELL_AURA_MOD_IGNORE_TARGET_RESIST_MODIFIERS
Definition SpellAuraDefines.h:332

References HasAuraType(), and SPELL_AURA_MOD_IGNORE_TARGET_RESIST_MODIFIERS.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ HasIncreaseMountedFlightSpeedAura()

◆ HasIncreaseMountedSpeedAura()

bool Unit::HasIncreaseMountedSpeedAura ( ) const
inline
@ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
Definition SpellAuraDefines.h:95

References HasAuraType(), and SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED.

◆ HasInterruptRegenAura()

bool Unit::HasInterruptRegenAura ( ) const
inline
@ SPELL_AURA_INTERRUPT_REGEN
Definition SpellAuraDefines.h:157

References HasAuraType(), and SPELL_AURA_INTERRUPT_REGEN.

Referenced by Player::Regenerate().

◆ HasInvisibilityAura()

bool Unit::HasInvisibilityAura ( ) const
inline

◆ HasInvisibilityDetectAura()

bool Unit::HasInvisibilityDetectAura ( ) const
inline
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
Definition SpellAuraDefines.h:82

References HasAuraType(), and SPELL_AURA_MOD_INVISIBILITY_DETECT.

Referenced by AuraEffect::HandleModInvisibilityDetect().

◆ HasMainhandWeapon()

bool Unit::HasMainhandWeapon ( ) const
inline
997{ return HasWeapon(BASE_ATTACK); }
virtual bool HasWeapon(WeaponAttackType type) const =0

References BASE_ATTACK, and HasWeapon().

◆ hasMainhandWeaponForAttack()

bool Unit::hasMainhandWeaponForAttack ( ) const
inline
virtual bool HasWeaponForAttack(WeaponAttackType type) const
Definition Unit.h:1002

References BASE_ATTACK, and HasWeaponForAttack().

◆ HasMainhandWeaponForAttack()

bool Unit::HasMainhandWeaponForAttack ( ) const
inline

◆ HasMountedAura()

◆ HasNegativeAuraWithAttribute()

bool Unit::HasNegativeAuraWithAttribute ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5899{
5900 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5901 {
5902 Aura const* aura = iter->second->GetBase();
5903 if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
5904 return true;
5905 }
5906 return false;
5907}
uint32 Attributes
Definition SpellInfo.h:348

References SpellInfo::Attributes, Aura::GetCasterGUID(), Aura::GetSpellInfo(), and m_appliedAuras.

◆ HasNegativeAuraWithInterruptFlag()

bool Unit::HasNegativeAuraWithInterruptFlag ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5887{
5888 if (!(m_interruptMask & flag))
5889 return false;
5890 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
5891 {
5892 if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
5893 return true;
5894 }
5895 return false;
5896}

References m_interruptableAuras, and m_interruptMask.

◆ HasNoPVPCreditAura()

bool Unit::HasNoPVPCreditAura ( ) const
inline
@ SPELL_AURA_NO_PVP_CREDIT
Definition SpellAuraDefines.h:222

References HasAuraType(), and SPELL_AURA_NO_PVP_CREDIT.

Referenced by Player::RewardHonor().

◆ HasNpcFlag()

◆ HasOffhandWeapon()

bool Unit::HasOffhandWeapon ( ) const
inline
998{ return HasWeapon(OFF_ATTACK); }

References HasWeapon(), and OFF_ATTACK.

◆ HasOffhandWeaponForAttack()

◆ HasOpenStableAura()

bool Unit::HasOpenStableAura ( ) const
inline
@ SPELL_AURA_OPEN_STABLE
Definition SpellAuraDefines.h:355

References HasAuraType(), and SPELL_AURA_OPEN_STABLE.

◆ HasPacifyAura()

bool Unit::HasPacifyAura ( ) const
inline
@ SPELL_AURA_MOD_PACIFY
Definition SpellAuraDefines.h:88

References HasAuraType(), and SPELL_AURA_MOD_PACIFY.

Referenced by AuraEffect::HandleAuraModPacify(), and WorldSession::HandlePetActionHelper().

◆ HasPacifySilenceAura()

bool Unit::HasPacifySilenceAura ( ) const
inline

◆ HasPeriodicDummyAura()

bool Unit::HasPeriodicDummyAura ( ) const
inline
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289

References HasAuraType(), and SPELL_AURA_PERIODIC_DUMMY.

◆ HasPreventDurabilityLossAura()

bool Unit::HasPreventDurabilityLossAura ( ) const
inline
@ SPELL_AURA_PREVENT_DURABILITY_LOSS
Definition SpellAuraDefines.h:352

References HasAuraType(), and SPELL_AURA_PREVENT_DURABILITY_LOSS.

Referenced by Player::DurabilityPointsLoss().

◆ HasPreventResurectionAura()

bool Unit::HasPreventResurectionAura ( ) const
inline

◆ HasPreventsFleeingAura()

bool Unit::HasPreventsFleeingAura ( ) const
inline
@ SPELL_AURA_PREVENTS_FLEEING
Definition SpellAuraDefines.h:155

References HasAuraType(), and SPELL_AURA_PREVENTS_FLEEING.

Referenced by Creature::DoFleeToGetAssistance().

◆ HasRangedWeapon()

bool Unit::HasRangedWeapon ( ) const
inline
999{ return HasWeapon(RANGED_ATTACK); }

References HasWeapon(), and RANGED_ATTACK.

◆ HasRangedWeaponForAttack()

bool Unit::HasRangedWeaponForAttack ( ) const
inline

◆ HasReflectSpellsAura()

bool Unit::HasReflectSpellsAura ( ) const
inline
@ SPELL_AURA_REFLECT_SPELLS
Definition SpellAuraDefines.h:91

References HasAuraType(), and SPELL_AURA_REFLECT_SPELLS.

Referenced by Spell::DoSpellHitOnUnit().

◆ HasRegenDuringCombatAura()

bool Unit::HasRegenDuringCombatAura ( ) const
inline
@ SPELL_AURA_MOD_REGEN_DURING_COMBAT
Definition SpellAuraDefines.h:179

References HasAuraType(), and SPELL_AURA_MOD_REGEN_DURING_COMBAT.

Referenced by Player::RegenerateAll(), and Player::RegenerateHealth().

◆ HasRootAura()

bool Unit::HasRootAura ( ) const
inline

References HasAuraType(), and SPELL_AURA_MOD_ROOT.

Referenced by SetControlled().

◆ HasSchoolImmunityForMask()

bool Unit::HasSchoolImmunityForMask ( SpellSchoolMask  schoolMask,
Unit const *  caster,
SpellInfo const *  spellInfo 
) const
9684{
9685 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9686 return false;
9687
9688 uint32 accumulatedMask = 0;
9689 for (auto const& [immunitySchoolMask, immunityAuraId] : m_spellImmune[IMMUNITY_SCHOOL])
9690 {
9691 // Beneficial immunities may refresh themselves. Hostile ones (Cyclone, Banish)
9692 // must still report immunity when cast again while their aura is active.
9693 if (spellInfo && spellInfo->IsPositive() && immunityAuraId == spellInfo->Id)
9694 continue;
9695
9696 SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(immunityAuraId);
9697
9698 if (IgnoresSchoolImmunityFromFriendlyCaster(caster, immunityAuraId, immuneSpellInfo))
9699 continue;
9700
9701 if (spellInfo && immuneSpellInfo && spellInfo->CanPierceImmuneAura(immuneSpellInfo))
9702 continue;
9703
9704 accumulatedMask |= immunitySchoolMask;
9705 }
9706
9707 return (SpellSchoolMask(accumulatedMask) & schoolMask) == schoolMask;
9708}
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1400
@ SPELL_SCHOOL_MASK_NONE
Definition SharedDefines.h:284
bool IgnoresSchoolImmunityFromFriendlyCaster(Unit const *caster, uint32 immunityAuraId, SpellInfo const *immunitySpellInfo) const
Definition Unit.cpp:9671

References SpellInfo::CanPierceImmuneAura(), SpellInfo::Id, IgnoresSchoolImmunityFromFriendlyCaster(), IMMUNITY_SCHOOL, SpellInfo::IsPositive(), m_spellImmune, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by npc_anubarak_spike::CanPursue(), IsImmunedToSpell(), and IsImmunedToSpell().

◆ HasShapeshiftAura()

bool Unit::HasShapeshiftAura ( ) const
inline

◆ HasSharedVision()

◆ HasSilenceAura()

bool Unit::HasSilenceAura ( ) const
inline

◆ HasSpell()

◆ HasSpellCooldown()

virtual bool Unit::HasSpellCooldown ( uint32  ) const
inlinevirtual

◆ HasSpellItemCooldown()

virtual bool Unit::HasSpellItemCooldown ( uint32  ,
uint32   
) const
inlinevirtual

Reimplemented in Player.

1353{ return false; }

Referenced by Spell::CheckCast().

◆ HasSpellMagnetAura()

bool Unit::HasSpellMagnetAura ( ) const
inline

◆ HasSpiritOfRedemptionAura()

◆ HasStealthAura()

◆ HasStealthDetectAura()

bool Unit::HasStealthDetectAura ( ) const
inline
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition SpellAuraDefines.h:80

References HasAuraType(), and SPELL_AURA_MOD_STEALTH_DETECT.

Referenced by AuraEffect::HandleModStealthDetect().

◆ HasStunAura()

bool Unit::HasStunAura ( ) const
inline

◆ HasTauntAura()

bool Unit::HasTauntAura ( ) const
inline
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74

References HasAuraType(), and SPELL_AURA_MOD_TAUNT.

Referenced by Creature::CanCreatureAttack(), and PetAI::SelectNextTarget().

◆ HasTransformAura()

bool Unit::HasTransformAura ( ) const
inline

◆ HasUnattackableAura()

bool Unit::HasUnattackableAura ( ) const
inline

◆ HasUnitFlag()

bool Unit::HasUnitFlag ( UnitFlags  flags) const
inline
753{ return HasFlag(UNIT_FIELD_FLAGS, flags); }

References Object::HasFlag(), and UNIT_FIELD_FLAGS.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), Vehicle::AddPassenger(), AttackerStateUpdate(), boss_malygos::AttackStart(), SmartAI::AttackStart(), npc_onyxian_whelp::AttackStart(), npc_ghostly_priest::AttackStart(), npc_phantom_mage::AttackStart(), npc_shadowy_mercenary::AttackStart(), npc_spectral_footman::AttackStart(), npc_tortured_rifleman::AttackStart(), violet_hold_trashAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::AttackStart(), npc_ravenous_worg::npc_ravenous_worgAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanNoReagentCast(), CanSwim(), CanUseAttackType(), Spell::CheckEffectTarget(), boss_muru::DamageTaken(), boss_black_knight::DamageTaken(), npc_frost_sphere::DamageTaken(), boss_bronjahm::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_power_spark::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), Spell::DoSpellHitOnUnit(), RandomMovementGenerator< T >::DoUpdate(), boss_dorothee::EnterEvadeMode(), boss_roar::EnterEvadeMode(), boss_strawman::EnterEvadeMode(), boss_tinhead::EnterEvadeMode(), boss_julianne::EnterEvadeMode(), SmartAI::EnterEvadeMode(), ThreatReference::FlagsAllowFighting(), GetReactionTo(), GetVelocity(), spell_anubarak_shadow_strike::HandleDummy(), spell_gen_model_visible::HandleEffectApply(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_gen_mounted_charge::HandleScriptEffect(), CombatManager::InheritCombatStatesFrom(), IsAreaEffectPvPBlocked(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsMounted(), IsPetInCombat(), isTargetableForAttack(), WorldObject::IsValidAttackTarget(), boss_freya_elder_stonebark::JustEngagedWith(), boss_freya_elder_brightleaf::JustEngagedWith(), boss_freya_elder_ironbranch::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), boss_hodir::JustExitedCombat(), boss_novos::JustSummoned(), CreatureGroup::LeaderStartedMoving(), Condition::Meets(), MotionMaster::MoveCharge(), MotionMaster::MoveChase(), MotionMaster::MoveConfused(), MotionMaster::MoveDistract(), MotionMaster::MoveFall(), MotionMaster::MoveFleeing(), MotionMaster::MoveFollow(), MotionMaster::MoveFormation(), boss_sartharion_dragonAI::MoveInLineOfSight(), boss_professor_putricide::boss_professor_putricideAI::MoveInLineOfSight(), boss_palehoof::boss_palehoofAI::MoveInLineOfSight(), npc_massive_jormungar::npc_massive_jormungarAI::MoveInLineOfSight(), npc_ferocious_rhino::npc_ferocious_rhinoAI::MoveInLineOfSight(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::MoveInLineOfSight(), npc_frenzied_worgen::npc_frenzied_worgenAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), npc_nether_drake::npc_nether_drakeAI::MoveInLineOfSight(), MotionMaster::MoveLand(), npc_koltira_deathweaver::MovementInform(), MotionMaster::MovePoint(), MotionMaster::MovePointBackwards(), MotionMaster::MoveRandom(), MotionMaster::MoveSeekAssistance(), MotionMaster::MoveSeekAssistanceDistract(), MotionMaster::MoveSplinePath(), MotionMaster::MoveTakeoff(), MotionMaster::MoveTargetedHome(), MotionMaster::MoveWaypoint(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), WorldSession::ProcessMovementInfo(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::RefreshSwimmingFlag(), ScriptedAI::SelectSpell(), SetCanFly(), SetCharm(), Player::SetClientControl(), CombatManager::SetEvadeState(), SetSpeed(), PetAI::StartChase(), boss_the_lurker_below::SummonedCreatureDies(), boss_anub_arak::SummonedCreatureDies(), Player::Update(), npc_onyxian_lair_guard::UpdateAI(), boss_anub_arak::UpdateAI(), boss_anubarak_trial::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_novos::UpdateAI(), boss_bronjahm::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), npc_power_spark::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_ravenous_worg::npc_ravenous_worgAI::UpdateAI(), and WorldSession::VerifyMovementInfo().

◆ HasUnitFlag2()

◆ HasUnitMovementFlag()

◆ HasUnitState()

bool Unit::HasUnitState ( const uint32  f) const
inline
742{ return (m_state & f); }

References m_state.

Referenced by Spell::_cast(), Creature::_IsTargetAcceptable(), _IsValidAssistTarget(), _IsValidAttackTarget(), boss_yoggsaron_keeper::Activate(), Player::ActivateTaxiPathTo(), AddThreat(), AtEngage(), Attack(), AttackerStateUpdate(), FollowerAI::AttackStart(), SmartAI::AttackStart(), npc_raging_spirit::npc_raging_spiritAI::AttackStart(), boss_bigbadwolf::boss_bigbadwolf(), boss_blindeye_the_seer::boss_blindeye_the_seer(), boss_dorothee::boss_dorothee(), boss_eadric::boss_eadric(), boss_fathomguard_caribdis::boss_fathomguard_caribdis(), boss_fathomguard_tidalvess::boss_fathomguard_tidalvess(), boss_grand_champion::boss_grand_champion(), boss_jarien::boss_jarien(), boss_kiggler_the_crazed::boss_kiggler_the_crazed(), boss_krosh_firehand::boss_krosh_firehand(), boss_mor_grayhoof::boss_mor_grayhoof(), boss_nazan::boss_nazan(), boss_olm_the_summoner::boss_olm_the_summoner(), boss_paletress::boss_paletress(), boss_roar::boss_roar(), boss_sothos::boss_sothos(), boss_strawman::boss_strawman(), boss_tinhead::boss_tinhead(), boss_vazruden::boss_vazruden(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacle(), PathGenerator::CalculatePath(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), boss_gurtogg_bloodboil::CanAIAttack(), PetAI::CanAttack(), CombatManager::CanBeginCombat(), Player::CanEquipItem(), CanFreeMove(), Creature::CanPeriodicallyCallForAssistance(), spell_dk_death_grip::CheckCast(), Spell::CheckCast(), Spell::CheckPetCast(), spell_warr_retaliation::CheckProc(), SpellInfo::CheckTarget(), CreatureUnitRelocationWorker(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), DisableRotate(), FormationMovementGenerator::DoInitialize(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), Spell::DoSpellHitOnUnit(), FormationMovementGenerator::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectEnergizePct(), Spell::EffectKnockBack(), CritterAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Spell::finish(), ThreatManager::ForwardThreatForAssistingMe(), Player::GetInitialVisiblePackets(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleAuctionListItems(), spell_anubarak_shadow_strike::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_mistress_kiss_aura::HandleEffectPeriodic(), WorldSession::HandleEmoteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), ArenaSpectator::HandleSpectatorSpectateCommand(), IsActionPreventedByCasting(), WaypointMovementGenerator< Creature >::IsAllowedToMove(), isAttackingPlayer(), boss_faction_championsAI::IsCCed(), IsImmobilizedState(), Creature::IsInEvadeMode(), IsInFlight(), IsMovementPreventedByCasting(), Creature::IsMovementPreventedByCasting(), isPossessed(), isPossessedByPlayer(), isSpellBlocked(), IsStopped(), isTargetableForAttack(), Creature::IsUpdateNeeded(), CritterAI::JustEngagedWith(), boss_priestess_delrissa::JustEngagedWith(), npc_coren_direbrew_sisters::JustEngagedWith(), boss_essence_of_desire::boss_essence_of_desireAI::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_novos::JustEngagedWith(), PetAI::KilledUnit(), CreatureGroup::LeaderStartedMoving(), GridObjectLoader::LoadCreatures(), WorldObject::MagicSpellHitResult(), MeleeSpellHitResult(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_kaelthas::MovementInform(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_apothecary_baxter::npc_apothecary_baxter(), npc_argent_soldier::npc_argent_soldier(), npc_batrider::npc_batrider(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrm(), npc_memory::npc_memory(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minion(), ICCOrbControllerMinionSearch::operator()(), Acore::FriendlyCCedInRange::operator()(), MysticBuffetTargetFilter::operator()(), SmartScript::ProcessAction(), RemoveCharmedBy(), boss_kormok::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_ohgan::npc_ohganAI::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_isalien::Reset(), npc_anubisath_guardian::Reset(), npc_fos_corrupted_soul_fragment::Reset(), DarkFallenAI::Reset(), npc_ashtongue_channeler::Reset(), Player::ResyncCanFlyToClient(), RollMeleeOutcomeAgainst(), boss_alar::ScheduleMainSpellAttack(), Player::SetClientControl(), SetContestedPvP(), SetControlled(), SmartAI::SetCurrentRangeMode(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SetInFront(), SetStunned(), npc_ulduar_vx001::SpellHit(), lfg::LFGMgr::TeleportPlayer(), CreatureAI::TriggerAlert(), Creature::Update(), Player::Update(), Update(), TimedFleeingMovementGenerator::Update(), boss_sartharion_dragonAI::UpdateAI(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), brd_ironhand_guardian::UpdateAI(), npc_phalanx::UpdateAI(), boss_anubshiah::UpdateAI(), boss_emperor_dagran_thaurissan::UpdateAI(), boss_eviscerator::UpdateAI(), boss_gorosh_the_dervish::UpdateAI(), boss_grizzle::UpdateAI(), boss_hedrum::UpdateAI(), boss_moira_bronzebeard::UpdateAI(), boss_high_priestess_thaurissan::UpdateAI(), boss_okthor::UpdateAI(), boss_drakkisath::UpdateAI(), boss_halycon::UpdateAI(), boss_highlord_omokk::UpdateAI(), boss_lord_valthalak::UpdateAI(), boss_overlord_wyrmthalak::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::UpdateAI(), npc_rookery_hatcher::UpdateAI(), boss_solakar_flamewreath::UpdateAI(), boss_the_beast::UpdateAI(), boss_urok_doomhowl::UpdateAI(), npc_vaelastrasz_the_red::UpdateAI(), boss_chromaggus::UpdateAI(), boss_ebonroc::UpdateAI(), boss_firemaw::UpdateAI(), boss_flamegor::UpdateAI(), boss_victor_nefarius::UpdateAI(), boss_nefarian::UpdateAI(), boss_razorgore::UpdateAI(), boss_vaelastrasz::UpdateAI(), boss_garr::UpdateAI(), boss_golemagg::UpdateAI(), npc_core_rager::UpdateAI(), boss_majordomo::UpdateAI(), boss_ragnaros::UpdateAI(), npc_flamewaker_priest::UpdateAI(), npc_mc_core_hound::UpdateAI(), boss_netherspite::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_kilrek::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), boss_blight_worm::boss_blight_wormAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), npc_hallows_end_soh::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), boss_onyxia::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_anub_arak::UpdateAI(), boss_hadronox::UpdateAI(), boss_sartharion::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_memory::UpdateAI(), npc_argent_soldier::UpdateAI(), npc_black_knight_ghoul::UpdateAI(), boss_anubarak_trial::UpdateAI(), npc_nerubian_burrower::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), boss_jaraxxus::UpdateAI(), npc_fel_infernal::UpdateAI(), npc_mistress_of_pain::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::UpdateAI(), boss_devourer_of_souls::UpdateAI(), boss_falric::UpdateAI(), boss_marwyn::UpdateAI(), npc_ghostly_priest::UpdateAI(), npc_phantom_mage::UpdateAI(), npc_shadowy_mercenary::UpdateAI(), npc_spectral_footman::UpdateAI(), npc_tortured_rifleman::UpdateAI(), boss_frostsworn_general::UpdateAI(), npc_hor_spiritual_reflection::UpdateAI(), npc_hor_risen_witch_doctor::UpdateAI(), npc_hor_lumbering_abomination::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), npc_rotting_frost_giant::npc_rotting_frost_giantAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_captain_arnath::npc_captain_arnathAI::UpdateAI(), npc_captain_brandon::npc_captain_brandonAI::UpdateAI(), npc_captain_grondel::npc_captain_grondelAI::UpdateAI(), npc_captain_rupert::npc_captain_rupertAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious_minion::boss_razuvious_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::UpdateAI(), npc_nexus_lord::UpdateAI(), npc_scion_of_eternity::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::UpdateAI(), boss_ionar::UpdateAI(), boss_volkhan::UpdateAI(), npc_molten_golem::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_steelbreaker::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_sanctum_sentry::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_stonebark::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), boss_freya_elder_ironbranch::UpdateAI(), boss_freya_summons::UpdateAI(), boss_vezax::UpdateAI(), boss_hodir::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_ignis::UpdateAI(), boss_kologarn::UpdateAI(), npc_ulduar_leviathan_mkii::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_ulduar_aerial_command_unit::UpdateAI(), boss_razorscale::UpdateAI(), npc_razorscale_dark_rune_watcher::UpdateAI(), npc_razorscale_dark_rune_guardian::UpdateAI(), npc_razorscale_dark_rune_sentinel::UpdateAI(), boss_thorim::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_thorim_start_npcs::UpdateAI(), boss_thorim_gauntlet_npcs::UpdateAI(), boss_thorim_runic_colossus::UpdateAI(), boss_thorim_ancient_rune_giant::UpdateAI(), boss_thorim_arena_npcs::UpdateAI(), boss_xt002::UpdateAI(), npc_life_spark::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_yoggsaron::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), npc_ulduar_storm_tempered_keeper::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), npc_enslaved_proto_drake::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), npc_erekem_guard::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), boss_exarch_maladaar::UpdateAI(), boss_nexusprince_shaffar::UpdateAI(), npc_yor::UpdateAI(), boss_anzu::UpdateAI(), npc_maiev_illidan::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_veras_darkshadow::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_doomlord_kazzak::boss_doomlordkazzakAI::UpdateAI(), boss_doomwalker::UpdateAI(), boss_leotheras_the_blind::UpdateAI(), boss_gruul::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), boss_watchkeeper_gargolmar::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_alar::UpdateAI(), advisor_baseAI::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), npc_enslaved_netherwing_drake::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_dk_ghoul::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), emerald_dragonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_target_dummy::UpdateAI(), PetAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), npc_wg_spirit_guide::npc_wg_spirit_guideAI::UpdateAI(), Player::UpdateCharmedAI(), npc_general_andorov::UpdateEscortAI(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::UpdateEscortAI(), boss_bjarngrim::UpdateEscortAI(), npc_kurenai_captive::npc_kurenai_captiveAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), SmartAI::UpdateMeleeStance(), and SmartAI::UpdatePath().

◆ HasUnitTypeMask()

◆ HasVisibleAuraType()

bool Unit::HasVisibleAuraType ( AuraType  auraType) const
5837{
5838 AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType);
5839 for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i)
5840 if ((*i)->GetBase()->CanBeSentToClient())
5841 return true;
5842
5843 return false;
5844}

References GetAuraEffectsByType().

◆ HasWaterBreathingAura()

bool Unit::HasWaterBreathingAura ( ) const
inline
@ SPELL_AURA_WATER_BREATHING
Definition SpellAuraDefines.h:145

References HasAuraType(), and SPELL_AURA_WATER_BREATHING.

Referenced by Player::getMaxTimer().

◆ HasWaterWalkAura()

bool Unit::HasWaterWalkAura ( ) const
inline
@ SPELL_AURA_WATER_WALK
Definition SpellAuraDefines.h:167

References HasAuraType(), and SPELL_AURA_WATER_WALK.

◆ HasWeapon()

virtual bool Unit::HasWeapon ( WeaponAttackType  type) const
pure virtual

Implemented in Creature, and Player.

Referenced by HasMainhandWeapon(), HasOffhandWeapon(), and HasRangedWeapon().

◆ HasWeaponForAttack()

virtual bool Unit::HasWeaponForAttack ( WeaponAttackType  type) const
inlinevirtual

Reimplemented in Creature, and Player.

1002{ return CanUseAttackType(type); }
bool CanUseAttackType(WeaponAttackType attacktype) const
Definition Unit.h:1006

References CanUseAttackType().

Referenced by hasMainhandWeaponForAttack(), HasMainhandWeaponForAttack(), HasOffhandWeaponForAttack(), HasRangedWeaponForAttack(), Creature::HasWeaponForAttack(), and Player::HasWeaponForAttack().

◆ haveOffhandWeapon()

bool Unit::haveOffhandWeapon ( ) const
649{
650 if (Player const* player = ToPlayer())
651 return player->GetWeaponForAttack(OFF_ATTACK, true);
652
653 return CanDualWield();
654}
bool CanDualWield() const
Definition Unit.h:992

References CanDualWield(), OFF_ATTACK, and Object::ToPlayer().

Referenced by boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), spell_dk_threat_of_thassarian::HandleProc(), and boss_twin_valkyrAI::myDoMeleeAttackIfReady().

◆ HealBySpell()

int32 Unit::HealBySpell ( HealInfo &  healInfo,
bool  critical = false 
)
8188{
8189 uint32 heal = healInfo.GetHeal();
8190 sScriptMgr->ModifyHealReceived(this, healInfo.GetTarget(), heal, healInfo.GetSpellInfo());
8191 healInfo.SetHeal(heal);
8192
8193 // calculate heal absorb and reduce healing
8194 CalcHealAbsorb(healInfo);
8195
8196 int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
8197 healInfo.SetEffectiveHeal(gain);
8198
8199 SendHealSpellLog(healInfo, critical);
8200 return gain;
8201}
Unit * GetHealer() const
Definition Unit.h:437
void SetHeal(uint32 amount)
Definition Unit.h:422
void SetEffectiveHeal(uint32 amount)
Definition Unit.h:432
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2697
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:7891
void SendHealSpellLog(HealInfo const &healInfo, bool critical=false)
Definition Unit.cpp:8170

References CalcHealAbsorb(), DealHeal(), HealInfo::GetHeal(), HealInfo::GetHealer(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SendHealSpellLog(), HealInfo::SetEffectiveHeal(), HealInfo::SetHeal(), and sScriptMgr.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ HealthAbovePct()

◆ HealthAbovePctHealed()

bool Unit::HealthAbovePctHealed ( int32  pct,
uint32  heal 
) const
inline

◆ HealthBelowPct()

bool Unit::HealthBelowPct ( int32  pct) const
inline
1130{ return GetHealth() < CountPctFromMaxHealth(pct); }

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_moira_bronzebeard::CastOnEmperorIfPossible(), spell_dru_glyph_of_rejuvenation::CheckProc(), spell_item_blood_draining_enchant::CheckProc(), spell_warr_t3_prot_8p_bonus::CheckProc(), boss_mor_grayhoof::DamageTaken(), boss_isalien::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::DamageTaken(), boss_hadronox::DamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), ScriptedAI::HealthBelowPct(), boss_kalec::JustEngagedWith(), boss_sathrovarr::JustEngagedWith(), npc_akama_illidan::JustEngagedWith(), npc_maiev_illidan::JustEngagedWith(), boss_olm_the_summoner::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_yazzai::JustEngagedWith(), boss_grand_warlock_nethekurse::JustEngagedWith(), Player::LoadFromDB(), npc_wild_wyrm::PassengerBoarded(), SetHealth(), SpellPctHealingModsDone(), Update(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_xt002::UpdateAI(), boss_yoggsaron_immortal_guardian::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), and npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI().

◆ HealthBelowPctDamaged()

bool Unit::HealthBelowPctDamaged ( int32  pct,
uint32  damage 
) const
inline
1131{ return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
std::int64_t int64
Definition Define.h:102

References CountPctFromMaxHealth(), and GetHealth().

Referenced by spell_item_proc_below_pct_damaged::CheckProc(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_lord_valthalak::DamageTaken(), npc_blackhand_incarcerator::DamageTaken(), boss_quartermaster_zigris::DamageTaken(), boss_warmaster_voone::DamageTaken(), boss_baron_geddon::DamageTaken(), boss_golemagg::DamageTaken(), npc_core_rager::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_kormok::DamageTaken(), npc_batrider::DamageTaken(), npc_coren_direbrew::DamageTaken(), boss_headless_horseman_head::DamageTaken(), npc_anubisath_guardian::DamageTaken(), boss_ouro::DamageTaken(), npc_anubisath_sentinel::aqsentinelAI::DamageTaken(), npc_anubisath_defender::DamageTaken(), boss_elder_nadox::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), npc_anub_ar_crusher::DamageTaken(), boss_sartharion::DamageTaken(), boss_bronjahm::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_razorscale::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_akama_shade::DamageTaken(), boss_vazruden::DamageTaken(), npc_millhouse_manastorm::npc_millhouse_manastormAI::DamageTaken(), BossAI::DamageTaken(), boss_halazzi::DamageTaken(), boss_malygos::DamageTaken(), boss_buru::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), boss_bug_trio::DamageTaken(), boss_hadronox::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), spell_warl_seed_of_corruption_dummy::HandleProc(), and SmartScript::ProcessEvent().

◆ IgnoresSchoolImmunityFromFriendlyCaster()

bool Unit::IgnoresSchoolImmunityFromFriendlyCaster ( Unit const *  caster,
uint32  immunityAuraId,
SpellInfo const *  immunitySpellInfo 
) const
9672{
9673 if (!caster || !caster->IsFriendlyTo(this))
9674 return false;
9675
9676 if (immunitySpellInfo)
9677 return !immunitySpellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS);
9678
9679 // Creature template immunities are loaded with a placeholder spell id.
9680 return immunityAuraId == std::numeric_limits<uint32>::max();
9681}
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition SharedDefines.h:423

References SpellInfo::HasAttribute(), IsFriendlyTo(), and SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS.

Referenced by HasSchoolImmunityForMask(), IsImmunedToAuraPeriodicTick(), and IsImmunedToDamage().

◆ IncrDiminishing()

void Unit::IncrDiminishing ( DiminishingGroup  group)
11462{
11463 // Checking for existing in the table
11464 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
11465 {
11466 if (i->DRGroup != group)
11467 continue;
11468 if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
11469 i->hitCount += 1;
11470 return;
11471 }
11473}
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
Definition SpellMgr.cpp:313
Definition Unit.h:286

References DIMINISHING_LEVEL_2, GetDiminishingReturnsMaxLevel(), GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ InitCharmInfo()

CharmInfo * Unit::InitCharmInfo ( )
12363{
12364 if (!m_charmInfo)
12365 m_charmInfo = new CharmInfo(this);
12366
12367 return m_charmInfo;
12368}
Definition CharmInfo.h:127

References m_charmInfo.

Referenced by Guardian::Guardian(), Pet::Pet(), and SetCharmedBy().

◆ InitStatBuffMods()

void Unit::InitStatBuffMods ( )
inline
1084 {
1085 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + i, 0);
1086 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + i, 0);
1087 }

References STAT_STRENGTH, UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::InitStatsForLevel().

◆ InitTamedPet()

bool Unit::InitTamedPet ( Pet *  pet,
uint8  level,
uint32  spell_id 
)
13500{
13501 Player* player = ToPlayer();
13502 PetStable& petStable = player->GetOrInitPetStable();
13503 if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
13504 return false;
13505
13506 pet->SetCreatorGUID(GetGUID());
13507 pet->SetFaction(GetFaction());
13508 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
13509
13510 if (IsPlayer())
13512
13513 if (!pet->InitStatsForLevel(level))
13514 {
13515 LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: {})!", pet->GetEntry());
13516 return false;
13517 }
13518
13519 pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
13520 // this enables pet details window (Shift+P)
13521 pet->InitPetCreateSpells();
13522 pet->SetFullHealth();
13523 pet->FillPetInfo(&petStable.CurrentPet.emplace());
13524 return true;
13525}
@ UNIT_CREATED_BY_SPELL
Definition UpdateFields.h:138
bool InitStatsForLevel(uint8 level)
Definition Pet.cpp:1069
Definition PetDefines.h:212
PetInfo const * GetUnslottedHunterPet() const
Definition PetDefines.h:240
Optional< PetInfo > CurrentPet
Definition PetDefines.h:235
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition Pet.cpp:2478
void InitPetCreateSpells()
Definition Pet.cpp:2068
PetStable & GetOrInitPetStable()
Definition Player.cpp:16157
void SetFullHealth()
Definition Unit.h:1140
void SetFaction(uint32 faction)
Definition Unit.cpp:6903
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition Unit.h:756
CharmInfo * GetCharmInfo()
Definition Unit.h:1298
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:722
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition CharmInfo.cpp:230

References PetStable::CurrentPet, Pet::FillPetInfo(), GetCharmInfo(), Object::GetEntry(), GetFaction(), Object::GetGUID(), Player::GetOrInitPetStable(), PetStable::GetUnslottedHunterPet(), Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Object::IsPlayer(), LOG_ERROR, ReplaceAllUnitFlags(), SetCreatorGUID(), SetFaction(), SetFullHealth(), CharmInfo::SetPetNumber(), SetUInt32Value(), sObjectMgr, Object::ToPlayer(), UNIT_CREATED_BY_SPELL, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by CreateTamedPetFrom(), and CreateTamedPetFrom().

◆ InterruptNonMeleeSpells()

void Unit::InterruptNonMeleeSpells ( bool  withDelayed,
uint32  spellid = 0,
bool  withInstant = true,
bool  bySelf = false 
)
4073{
4074 // generic spells are interrupted if they are not finished or delayed
4075 if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
4076 InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, bySelf);
4077
4078 // autorepeat spells are interrupted if they are not finished or delayed
4079 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
4080 InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, bySelf);
4081
4082 // channeled spells are interrupted if they are not finished, even if they are delayed
4083 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
4084 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4085}

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, InterruptSpell(), and m_currentSpells.

Referenced by _EnterVehicle(), PetAI::_stopAttack(), Player::ActivateSpec(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), CleanupBeforeRemoveFromMap(), CombatStop(), boss_julianne::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_yoggsaron_guardian_of_ys::DamageTaken(), boss_yoggsaron::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), DealDamage(), boss_leotheras_the_blind::DemonTime(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_razorscale::DoAction(), npc_expedition_trapper::DoAction(), boss_akilzon::DoAction(), npc_medivh_bm::DoAction(), boss_thorim_sif::DoAction(), boss_nazan::DoAction(), npc_ranshalla::npc_ranshallaAI::DoContinueEscort(), Spell::EffectKnockBack(), boss_leotheras_the_blind::ElfTime(), boss_felblood_kaelthas::GravityLapseSequence(), spell_dk_death_grip::HandleBaseDummy(), WorldSession::HandleCancelCastOpcode(), spell_magtheridon_shadow_grasp::HandleDummyRemove(), spell_novos_crystal_handler_death_aura::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLootOpcode(), WorldSession::HandlePetActionHelper(), spell_the_lich_king_jump::HandleScript(), boss_shade_of_aran::JustEngagedWith(), npc_kilrek::JustEngagedWith(), boss_archimonde::JustEngagedWith(), boss_infinite_corruptor::boss_infinite_corruptorAI::JustEngagedWith(), boss_taldaram::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_thorim_runic_colossus::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_curator::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustEngagedWith(), boss_paletress::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_gal_darah::JustEngagedWith(), boss_runemaster_molgeim::JustEngagedWith(), boss_stormcaller_brundir::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), npc_risen_archmage::npc_risen_archmageAI::JustEnteredCombat(), PetAI::KilledUnit(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_shade_of_aran::OnPowerUpdate(), boss_jeklik::PathEndReached(), npc_akama_illidan::PathEndReached(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), RemoveAurasWithInterruptFlags(), boss_curator::Reset(), boss_malchezaar::Reset(), boss_varos::boss_varosAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_talon_king_ikiss::Reset(), boss_high_astromancer_solarian::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), boss_illidan_stormrage::ScheduleAbilities(), boss_the_lurker_below::SchedulerPhaseOne(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_anomalus::SetData(), setDeathState(), boss_gormok::boss_gormokAI::SetGUID(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), StopAttackFaction(), Player::TeleportTo(), CasterAI::UpdateAI(), TotemAI::UpdateAI(), boss_ragnaros::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_ichoron::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ InterruptSpell()

void Unit::InterruptSpell ( CurrentSpellTypes  spellType,
bool  withDelayed = true,
bool  withInstant = true,
bool  bySelf = false 
)
4001{
4002 //LOG_DEBUG("entities.unit", "Interrupt spell for unit {}.", GetEntry());
4003 Spell* spell = m_currentSpells[spellType];
4004 if (spell
4005 && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
4006 && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only)
4007 {
4008 // for example, do not let self-stun aura interrupt itself
4009 if (!spell->IsInterruptable())
4010 return;
4011
4012 // send autorepeat cancel message for autorepeat spells
4013 if (spellType == CURRENT_AUTOREPEAT_SPELL)
4014 if (IsPlayer())
4016
4017 if (spell->getState() != SPELL_STATE_FINISHED)
4018 spell->cancel(bySelf);
4019 else
4020 {
4021 m_currentSpells[spellType] = nullptr;
4022 spell->SetReferencedFromCurrent(false);
4023 }
4024
4025 if (IsCreature() && IsAIEnabled)
4026 ToCreature()->AI()->OnSpellFailed(spell->GetSpellInfo());
4027 }
4028}
@ SPELL_STATE_DELAYED
Definition Spell.h:241
virtual void OnSpellFailed(SpellInfo const *)
Definition CreatureAI.h:174
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:154
SpellInfo const * GetSpellInfo() const
Definition Spell.h:601
bool IsInterruptable() const
Definition Spell.h:578
int32 GetCastTime() const
Definition Spell.h:562
uint32 getState() const
Definition Spell.h:496
void cancel(bool bySelf=false)
Definition Spell.cpp:3860

References Creature::AI(), Spell::cancel(), CURRENT_AUTOREPEAT_SPELL, Spell::GetCastTime(), Spell::GetSpellInfo(), Spell::getState(), IsAIEnabled, Object::IsCreature(), Spell::IsInterruptable(), Object::IsPlayer(), m_currentSpells, CreatureAI::OnSpellFailed(), Player::SendAutoRepeatCancel(), Spell::SetReferencedFromCurrent(), SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, Object::ToCreature(), and Object::ToPlayer().

Referenced by _UpdateAutoRepeatSpell(), Player::ActivateTaxiPathTo(), Attack(), AttackStop(), CastStop(), Spell::EffectInterruptCast(), Spell::EffectSanctuary(), AuraEffect::HandleAuraModSilence(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandleCancelAutoRepeatSpellOpcode(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleCancelChanneling(), spell_hun_scatter_shot::HandleDummy(), AuraEffect::HandleFeignDeath(), spell_yogg_saron_diminish_power_aura::HandleProc(), InterruptNonMeleeSpells(), SmartAI::JustEngagedWith(), Player::RemoveItemDependentAurasAndCasts(), SetCurrentCastedSpell(), npc_blackhand_incarcerator::SetData(), boss_nightbane::TriggerHealthTakeOff(), and npc_belnistrasz::npc_belnistraszAI::UpdateAI().

◆ InvalidateValuesUpdateCache()

void Unit::InvalidateValuesUpdateCache ( )
inlineprivate
2248{ _valuesUpdateCache.clear(); }

References _valuesUpdateCache.

Referenced by SetUInt32Value(), and Update().

◆ IsActionPreventedByCasting()

bool Unit::IsActionPreventedByCasting ( ) const
4136{
4137 // can always act when not casting
4139 return false;
4140
4141 // a regular cast in progress always prevents other actions, even alongside a permissive channel
4143 if (spell->getState() != SPELL_STATE_FINISHED)
4144 return true;
4145
4146 // channeled spells during channel stage (after the initial cast timer) allow actions with a specific spell attribute
4148 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive() && spell->GetSpellInfo()->IsActionAllowedChannel())
4149 return false;
4150
4151 // prohibit actions for all other spell casts
4152 return true;
4153}
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188

References CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by BossAI::_CheckHealthAfterCast(), AttackerStateUpdate(), boss_ouro::CastBoulderIfReady(), BossAI::DamageTaken(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), CombatAI::UpdateAI(), CasterAI::UpdateAI(), BossAI::UpdateAI(), WorldBossAI::UpdateAI(), and SmartScript::UpdateTimer().

◆ IsAlive()

bool Unit::IsAlive ( ) const
inline
1812{ return (m_deathState == DeathState::Alive); };

References Alive, and m_deathState.

Referenced by _CreateAuraApplication(), CreatureAI::_EnterEvadeMode(), _EnterVehicle(), _ExitVehicle(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::_LoadItem(), BossAI::_Reset(), WorldBossAI::_Reset(), KillRewarder::_RewardHonor(), KillRewarder::_RewardKillCredit(), KillRewarder::_RewardXP(), PetAI::_stopAttack(), AddAura(), Battleground::AddPlayer(), Map::AddPlayerToMap(), Spell::AddUnitTarget(), Creature::AtDisengage(), Attack(), PetAI::AttackedBy(), AttackerStateUpdate(), boss_freya::boss_freya(), boss_hodir::boss_hodir(), boss_mimiron::boss_mimiron(), WorldSession::BuildPartyMemberStatsChangedPacket(), Player::BuyItemFromVendorSlot(), CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), Creature::CallForHelp(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), Creature::CanAssistTo(), PetAI::CanAttack(), CombatManager::CanBeginCombat(), Player::CanCaptureTowerPoint(), CanHaveThreatList(), Player::CanInteractWithQuestGiver(), CreatureGroup::CanLeaderStartMoving(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CanUseItem(), Player::CastItemCombatSpell(), Pet::CastPendingSpell(), instance_trial_of_the_crusader::CheckAchievementCriteriaMeet(), Player::CheckAreaExploreAndOutdoor(), spell_q12237_rescue_villager::CheckCast(), spell_dk_raise_ally::CheckCast(), spell_hun_check_pet_los::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), boss_moroes::CheckGuestsInRoom(), BattlegroundRV::CheckPositionForUnit(), spell_mage_focus_magic::CheckProc(), spell_dk_blood_caked_blade::CheckProc(), spell_dk_dancing_rune_weapon::CheckProc(), spell_item_necrotic_touch::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_putricide_mutation_init::CheckRequirementInternal(), boss_heigan::CheckSafetyDance(), SpellInfo::CheckTarget(), instance_blackrock_depths::CheckTombReset(), CreatureUnitRelocationWorker(), boss_thorim::DamageTaken(), DealDamage(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), Creature::DisappearAndDie(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_sergeant_bly::npc_sergeant_blyAI::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), npc_xerestrasza::npc_xerestraszaAI::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), npc_expedition_trapper::DoAction(), npc_expedition_engineer::DoAction(), boss_hydross_the_unstable::DoAction(), boss_lady_vashj::DoAction(), boss_high_king_maulgar::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), boss_tharon_ja::boss_tharon_jaAI::DoAction(), boss_ichoron::DoAction(), Spell::DoAllEffectOnTarget(), spell_hun_masters_call::DoCheckCast(), boss_hodir::DoHelperVictoryEmotes(), RandomMovementGenerator< T >::DoInitialize(), WorldSession::DoLootRelease(), instance_trial_of_the_crusader::DoNeedCleanup(), WaypointMovementGenerator< Creature >::DoUpdate(), instance_blackrock_spire::Dragonspireroomcheck(), Spell::EffectAddExtraAttacks(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectEnvironmentalDMG(), Spell::EffectFeedPet(), Spell::EffectHeal(), Spell::EffectHealMaxHealth(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), Spell::EffectHealthLeech(), Spell::EffectInstaKill(), Spell::EffectInterruptCast(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectResurrect(), Spell::EffectResurrectNew(), Spell::EffectResurrectPet(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSelfResurrect(), Spell::EffectSkinPlayerCorpse(), Spell::EffectStuck(), Spell::EffectThreat(), Spell::EffectWeaponDmg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Player::EnvironmentalDamage(), Player::EquipItem(), BattleExperienceEvent::Execute(), DelayedMovementEvent::Execute(), IceTombSummonEvent::Execute(), SACActivateEvent::Execute(), boss_sartharion_tenebron::ExecuteEvent(), boss_erekem::ExecuteEvent(), TimedFleeingMovementGenerator::Finalize(), AssistanceMovementGenerator::Finalize(), Creature::ForcedDespawn(), CreatureGroup::FormationReset(), boss_krik_thir::boss_krik_thirAI::GetData(), npc_highlord_darion_mograine::GetData(), GetDebugInfo(), Player::GetInitialVisiblePackets(), FollowerAI::GetLeaderForFollower(), Player::getMaxTimer(), CreatureGroup::GetNewTargetForMember(), Player::GetNPCIfCanInteractWith(), GetPartyMembers(), npc_air_force_bots::npc_air_force_botsAI::GetSummonedGuard(), Pet::GivePetXP(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipSelect(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_kelthuzad_void_blast::HandleAfterHit(), BattlegroundEY::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModTotalThreat(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugThreatListCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_valkyr_ball_passive::HandleDummy(), spell_dred_raptor_call::HandleDummy(), spell_q12211_container_of_rats::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_valkyr_touch_aura::HandleEffectPeriodic(), WorldSession::HandleEmoteOpcode(), Player::HandleFall(), misc_commandscript::HandleFreezeCommand(), spell_razorscale_flame_breath::HandleHit(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleLootOpcode(), WorldSession::HandleMessagechatOpcode(), AuraEffect::HandleModDetaunt(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), AuraEffect::HandleObsModPowerAuraTick(), WorldSession::HandleOpenItemOpcode(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetStopAttack(), misc_commandscript::HandlePInfoCommand(), spell_item_mana_drain::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_gen_black_bow_of_the_betrayer::HandleProc(), WorldSession::HandleReclaimCorpseOpcode(), spell_gormok_jump_to_hand::HandleRemove(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleSummonResponseOpcode(), WorldSession::HandleUnstablePet(), boss_yoggsaron_sara::HasAlivePlayerInIllusion(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_moroes::InitializeGuests(), IsAnyAssemblyMemberEngaged(), Player::IsAtGroupRewardDistance(), Player::IsAtRecruitAFriendDistance(), Creature::IsInvisibleDueToDespawn(), Player::IsOutdoorPvPActive(), Player::IsPetNeedBeTemporaryUnsummoned(), isTargetableForAttack(), IsValidCombatTarget(), Spell::IsValidDeadOrAliveTarget(), boss_rajaxx::JustDied(), boss_twin_valkyrAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_sartharion::JustEngagedWith(), boss_freya::JustEngagedWith(), npc_underbat::JustEngagedWith(), npc_escortAI::JustExitedCombat(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustExitedCombat(), boss_fathomlord_karathress::JustReachedHome(), npc_kiljaeden_controller::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), Kill(), boss_anetheron::KilledUnit(), boss_azgalor::KilledUnit(), boss_kazrogal::KilledUnit(), boss_rage_winterchill::KilledUnit(), boss_hadronox::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), CreatureGroup::LeaderStartedMoving(), LightOfDawnScheduleMarch(), Player::LoadCorpse(), GridObjectLoader::LoadCreatures(), Player::LoadFromDB(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), WorldObject::MagicSpellHitResult(), AchievementCriteriaData::Meets(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), boss_lord_marrowgar::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), npc_scion_of_eternity::npc_scion_of_eternity(), instance_blackrock_depths::OnCreatureCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), CreatureAI::OnOwnerCombatInteraction(), spell_yogg_saron_brain_link_aura::OnPeriodic(), instance_eye_of_eternity::OnPlayerEnter(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), spell_malygos_vortex_visual::OnRemove(), at_dragonspire_hall::OnTrigger(), at_blackrock_stadium::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_orb_of_command::OnTrigger(), at_ancient_leaf::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), at_commander_dawnforge::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), SmartTrigger::OnTrigger(), AreaTrigger_at_area_52_entrance::OnTrigger(), WretchedGhoulCleaner::operator()(), ValithriaDespawner::operator()(), ICCOrbControllerMinionSearch::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck::operator()(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Acore::NearestPlayerInObjectRangeCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::AnyUnitInObjectRangeCheck::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Acore::AnyDeadUnitCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::MostHPMissingGroupInRange::operator()(), FrostwingVrykulSearcher::operator()(), Acore::AllDeadCreaturesInRange::operator()(), ShadowTrapLKTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetAI::OwnerAttacked(), npc_pet_dk_army_of_the_dead::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), npc_pet_dk_army_of_the_dead::OwnerAttackedBy(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_ulduar_snow_mound::PassengerBoarded(), boss_kologarn::PassengerBoarded(), MapMgr::PlayerCannotEnter(), SmartScript::ProcessAction(), ProcSkillsAndAuras(), RemoveCharmedBy(), Group::RemoveMember(), Battleground::RemovePlayerAtLeave(), Player::RepopAtGraveyard(), boss_kiljaeden::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_fathomlord_karathress::Reset(), Vehicle::Reset(), Player::ResetAllPowers(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Creature::Respawn(), npc_snobold_vassal::npc_snobold_vassalAI::ReturnToGormok(), Player::RewardPlayerAndGroupAtEvent(), BossAI::ScheduleEnrageTimer(), npc_snobold_vassal::npc_snobold_vassalAI::SelectFireBombTarget(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), Player::SendLoot(), SendMeleeAttackStop(), npc_corrupted_totem::SetAura(), instance_naxxramas::SetBossState(), SetConfused(), boss_emperor_dagran_thaurissan::SetData(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::SetData(), instance_halls_of_reflection::SetData(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::SetData(), npc_enslaved_proto_drake::SetData(), boss_teron_gorefiend::SetData(), setDeathState(), Player::setDeathState(), SetFeared(), boss_gormok::boss_gormokAI::SetGUID(), SetHover(), CombatManager::SetInCombatWith(), SetStunned(), Battlefield::ShowNpc(), instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanOutro(), npc_dark_iron_guzzler::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_hor_lich_king::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), WaypointMovementGenerator< Creature >::StartMove(), PassengerController::SummonCreatures(), boss_rend_blackhand::SummonedCreatureDespawn(), boss_priestess_delrissa::SummonedCreatureDies(), Player::SwapItem(), lfg::LFGMgr::TeleportPlayer(), Player::TeleportTo(), BattlegroundRV::TeleportUnitToNewZ(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_halls_of_reflection::Update(), Creature::Update(), TempSummon::Update(), Puppet::Update(), Player::Update(), Totem::Update(), Update(), TimedFleeingMovementGenerator::Update(), TotemAI::UpdateAI(), SmartAI::UpdateAI(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_malygos::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), boss_runemaster_molgeim::UpdateAI(), npc_ulduar_hodir_priest::UpdateAI(), npc_ulduar_hodir_druid::UpdateAI(), npc_ulduar_hodir_shaman::UpdateAI(), npc_ulduar_hodir_mage::UpdateAI(), boss_ignis::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), PetAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), Creature::UpdateMovementFlags(), boss_netherspite::UpdatePortals(), UpdateSplineMovement(), CreatureAI::UpdateVictim(), Player::UpdateZone(), instance_eye_of_eternity::VortexHandling(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsAlwaysDetectableFor()

bool Unit::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

10915{
10917 return true;
10918
10919 if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID()))
10920 return true;
10921
10922 if (Player* ownerPlayer = GetSpellModOwner())
10923 if (Player const* seerPlayer = seer->ToPlayer())
10924 {
10925 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
10926 return true;
10927 }
10928
10929 return false;
10930}
@ SPELL_AURA_MOD_STALKED
Definition SpellAuraDefines.h:131
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
Definition Object.h:825

References Object::GetGUID(), GetSpellModOwner(), HasAuraTypeWithCaster(), WorldObject::IsAlwaysDetectableFor(), SPELL_AURA_MOD_STALKED, and Object::ToPlayer().

Referenced by Creature::IsAlwaysDetectableFor(), and Player::IsAlwaysDetectableFor().

◆ IsAlwaysVisibleFor()

bool Unit::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overrideprotectedvirtual

: Check if unit is eligible for sparring damages. Work only if attacker and victim are creatures.

Reimplemented from WorldObject.

10896{
10898 return true;
10899
10900 // Always seen by owner
10901 if (ObjectGuid guid = GetCharmerOrOwnerGUID())
10902 if (seer->GetGUID() == guid)
10903 return true;
10904
10905 if (Player const* seerPlayer = seer->ToPlayer())
10906 if (Unit* owner = GetOwner())
10907 if (Player* ownerPlayer = owner->ToPlayer())
10908 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
10909 return true;
10910
10911 return false;
10912}
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition Object.h:822

References GetCharmerOrOwnerGUID(), Object::GetGUID(), GetOwner(), WorldObject::IsAlwaysVisibleFor(), and Object::ToPlayer().

◆ IsAreaEffectPvPBlocked()

bool Unit::IsAreaEffectPvPBlocked ( Unit const *  target,
SpellInfo const *  bySpell 
) const
10559{
10560 if (!bySpell || !bySpell->IsAffectingArea() || bySpell->HasAttribute(SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK))
10561 return false;
10562
10563 // only player controlled units take part in PvP, PvP flagged creatures remain valid targets
10565 return false;
10566
10567 return !IsPvP();
10568}
@ SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK
Definition SharedDefines.h:561
bool IsPvP() const
Definition Unit.h:1058

References SpellInfo::HasAttribute(), HasUnitFlag(), SpellInfo::IsAffectingArea(), IsPvP(), SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by _IsValidAttackTarget().

◆ IsArmorer()

bool Unit::IsArmorer ( ) const
inline
@ UNIT_NPC_FLAG_REPAIR
Definition UnitDefines.h:334
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:769

References HasNpcFlag(), and UNIT_NPC_FLAG_REPAIR.

◆ isAttackingPlayer()

bool Unit::isAttackingPlayer ( ) const
7364{
7366 return true;
7367
7368 if (!m_Controlled.empty())
7369 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7370 if ((*itr)->isAttackingPlayer())
7371 return true;
7372
7373 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
7374 if (m_SummonSlot[i])
7375 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
7376 if (summon->isAttackingPlayer())
7377 return true;
7378
7379 return false;
7380}
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:2442

References Map::GetCreature(), WorldObject::GetMap(), HasUnitState(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, and UNIT_STATE_ATTACK_PLAYER.

◆ isAttackReady()

◆ IsAttackSpeedOverridenShapeShift()

bool Unit::IsAttackSpeedOverridenShapeShift ( ) const
15189{
15190 // Mirroring clientside gameplay logic
15191 if (ShapeshiftForm form = GetShapeshiftForm())
15192 if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form))
15193 return entry->attackSpeed > 0;
15194
15195 return false;
15196}

References GetShapeshiftForm(), and sSpellShapeshiftFormStore.

Referenced by Player::CalculateMinMaxDamage().

◆ IsAuctioner()

bool Unit::IsAuctioner ( ) const
inline
@ UNIT_NPC_FLAG_AUCTIONEER
Definition UnitDefines.h:343

References HasNpcFlag(), and UNIT_NPC_FLAG_AUCTIONEER.

◆ IsBanker()

bool Unit::IsBanker ( ) const
inline
@ UNIT_NPC_FLAG_BANKER
Definition UnitDefines.h:339

References HasNpcFlag(), and UNIT_NPC_FLAG_BANKER.

◆ IsBattleMaster()

bool Unit::IsBattleMaster ( ) const
inline

◆ isBeingLoaded()

virtual bool Unit::isBeingLoaded ( ) const
inlinevirtual

Reimplemented in Pet, and Player.

708{ return false;}

Referenced by Player::SetMover().

◆ isBlockCritical()

bool Unit::isBlockCritical ( )
3325{
3327 return true;
3328 return false;
3329}
@ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
Definition SpellAuraDefines.h:316

References GetTotalAuraModifier(), roll_chance_i(), and SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

Referenced by CalculateMeleeDamage(), and CalculateSpellDamageTaken().

◆ IsCharmed()

◆ IsCharmedOwnedByPlayerOrPlayer()

◆ IsClass()

◆ IsClientControlled()

bool Unit::IsClientControlled ( Player const *  exactClient = nullptr) const
17132{
17133 // Severvide method to check if unit is client controlled (optionally check for specific client in control)
17134
17135 // Applies only to player controlled units
17137 return false;
17138
17139 // These flags are meant to be used when server controls this unit, client control is taken away
17141 return false;
17142
17143 // If unit is possessed, it has lost original control...
17144 if (ObjectGuid const& guid = GetCharmerGUID())
17145 {
17146 // ... but if it is a possessing charm, then we have to check if some other player controls it
17147 if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && guid.IsPlayer())
17148 return (exactClient ? (exactClient->GetGUID() == guid) : true);
17149 return false;
17150 }
17151
17152 // By default: players have client control over themselves
17153 if (IsPlayer())
17154 return (exactClient ? (exactClient == this) : true);
17155 return false;
17156}
@ UNIT_FLAG_CONFUSED
Definition UnitDefines.h:279
@ UNIT_FLAG_DISABLE_MOVE
Definition UnitDefines.h:259
@ UNIT_FLAG_FLEEING
Definition UnitDefines.h:280

References GetCharmerGUID(), Object::GetGUID(), Object::HasFlag(), Object::IsPlayer(), UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_FLEEING, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_FLAG_POSSESSED.

Referenced by GetClientControlling(), KnockbackFrom(), MotionMaster::MoveKnockbackFrom(), SetCanFly(), SetDisableGravity(), SetFeatherFall(), SetHover(), SetSpeed(), and SetWaterWalking().

◆ IsCombatDisallowed()

bool Unit::IsCombatDisallowed ( ) const
inline
982{ return _isCombatDisallowed; }

References _isCombatDisallowed.

Referenced by CombatManager::CanBeginCombat().

◆ IsContestedGuard()

bool Unit::IsContestedGuard ( ) const
inline
1044 {
1045 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
1046 return entry->IsContestedGuardFaction();
1047
1048 return false;
1049 }

References GetFactionTemplateEntry().

Referenced by Acore::NearestVisibleDetectableContestedGuardUnitCheck::operator()().

◆ IsControllableGuardian()

bool Unit::IsControllableGuardian ( ) const
inline

◆ IsControlledByPlayer()

◆ IsCreatedByPlayer()

bool Unit::IsCreatedByPlayer ( ) const
inline
1325{ return m_CreatedByPlayer; }

References m_CreatedByPlayer.

Referenced by DealDamage().

◆ IsCritter()

◆ IsCrowdControlled()

◆ IsDamageReducedByArmor()

bool Unit::IsDamageReducedByArmor ( SpellSchoolMask  damageSchoolMask,
SpellInfo const *  spellInfo = nullptr,
uint8  effIndex = MAX_SPELL_EFFECTS 
)
static
2204{
2205 // only physical spells damage gets reduced by armor
2206 if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
2207 return false;
2208 if (spellInfo)
2209 {
2210 // there are spells with no specific attribute but they have "ignores armor" in tooltip
2211 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
2212 return false;
2213
2214 // bleeding effects are not reduced by armor
2215 if (effIndex != MAX_SPELL_EFFECTS)
2216 {
2217 if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
2218 spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
2219 if (spellInfo->GetEffectMechanicMask(effIndex) & (1ULL << MECHANIC_BLEED))
2220 return false;
2221 }
2222 }
2223 return true;
2224}
@ MECHANIC_BLEED
Definition SharedDefines.h:1328
@ SPELL_ATTR0_CU_IGNORE_ARMOR
Definition SpellInfo.h:192

References SpellInfo::Effects, SpellInfo::GetEffectMechanicMask(), SpellInfo::HasAttribute(), MAX_SPELL_EFFECTS, MECHANIC_BLEED, SPELL_ATTR0_CU_IGNORE_ARMOR, SPELL_AURA_PERIODIC_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ isDead()

bool Unit::isDead ( ) const
inline

References Corpse, Dead, and m_deathState.

Referenced by npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraDummy(), Player::HandleFall(), boss_malygos::HandleIntroSpeech(), npc_commandscript::HandleNpcShowLootCommand(), misc_commandscript::HandleRespawnCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), Creature::HasSpellFocus(), UnitAI::InitializeAI(), SmartAI::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), boss_sister_svalna::boss_sister_svalnaAI::InitializeAI(), npc_ulduar_mimiron_rocket::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), Player::isAllowedToLoot(), npc_anubisath_sentinel::aqsentinelAI::JustDied(), Player::OnGossipSelect(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Player::PrepareGossipMenu(), SmartScript::ProcessAction(), Player::RepopAtGraveyard(), npc_anubisath_sentinel::aqsentinelAI::Reset(), instance_molten_core::SetBossState(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().

◆ IsDuringRemoveFromWorld()

◆ isDying()

bool Unit::isDying ( ) const
inline
1813{ return (m_deathState == DeathState::JustDied); };

References JustDied, and m_deathState.

Referenced by Creature::IsInvisibleDueToDespawn().

◆ IsEngaged()

◆ IsEngagedBy()

bool Unit::IsEngagedBy ( Unit const *  who) const
inline

◆ IsFalling()

◆ IsFFAPvP()

bool Unit::IsFFAPvP ( ) const
inline

◆ IsFlying()

◆ IsFriendlyTo() [1/2]

bool Unit::IsFriendlyTo ( Unit const *  unit) const
7097{
7098 return GetReactionTo(unit) >= REP_FRIENDLY;
7099}

References GetReactionTo(), and REP_FRIENDLY.

Referenced by AuraApplication::_InitFlags(), Creature::_IsTargetAcceptable(), SpellInfo::ApplyAllSpellImmunitiesTo(), FollowerAI::AssistPlayerInCombatAgainst(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), CalcAbsorbResist(), Creature::CanAssistTo(), CombatManager::CanBeginCombat(), spell_dk_death_coil::CheckCast(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), Spell::CheckCast(), spell_pri_glyph_of_dispel_magic::CheckProc(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), Spell::EffectThreat(), Aura::HandleAuraSpecificMods(), WorldSession::HandleCastSpellOpcode(), spell_dk_death_coil::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pri_penance::HandleDummy(), BattlefieldWG::HandleKill(), Spell::HandleLaunchPhase(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), WorldSession::HandleSetSelectionOpcode(), IgnoresSchoolImmunityFromFriendlyCaster(), GameObject::IsAlwaysVisibleFor(), SpellClickInfo::IsFitToRequirements(), IsImmunedToSpellEffect(), WorldObject::IsValidAttackTarget(), npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetSpellFail(), SmartScript::ProcessEvent(), RemoveCharmedBy(), Player::SendLoot(), Acore::MessageDistDelivererToHostile::SendPacket(), and TotemAI::UpdateAI().

◆ IsFriendlyTo() [2/2]

bool WorldObject::IsFriendlyTo ( WorldObject const *  target) const
4005{
4006 return GetReactionTo(target) >= REP_FRIENDLY;
4007}

◆ isFrozen()

◆ IsFullHealth()

◆ IsGossip()

bool Unit::IsGossip ( ) const
inline
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:322

References HasNpcFlag(), and UNIT_NPC_FLAG_GOSSIP.

◆ IsGuardian()

◆ IsGuildMaster()

bool Unit::IsGuildMaster ( ) const
inline
@ UNIT_NPC_FLAG_PETITIONER
Definition UnitDefines.h:340

References HasNpcFlag(), and UNIT_NPC_FLAG_PETITIONER.

◆ IsHighestExclusiveAura()

bool Unit::IsHighestExclusiveAura ( Aura const *  aura,
bool  removeOtherAuraApplications = false 
)
4351{
4352 for (uint32 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
4353 if (AuraEffect const* aurEff = aura->GetEffect(i))
4354 if (!IsHighestExclusiveAuraEffect(aura->GetSpellInfo(), aurEff->GetAuraType(), aurEff->GetAmount(), aura->GetEffectMask(), removeOtherAuraApplications))
4355 return false;
4356
4357 return true;
4358}
bool IsHighestExclusiveAuraEffect(SpellInfo const *spellInfo, AuraType auraType, int32 effectAmount, uint8 auraEffectMask, bool removeOtherAuraApplications=false)
Definition Unit.cpp:4360

References Aura::GetEffect(), Aura::GetEffectMask(), Aura::GetSpellInfo(), IsHighestExclusiveAuraEffect(), and MAX_SPELL_EFFECTS.

Referenced by _RemoveNoStackAurasDueToAura().

◆ IsHighestExclusiveAuraEffect()

bool Unit::IsHighestExclusiveAuraEffect ( SpellInfo const *  spellInfo,
AuraType  auraType,
int32  effectAmount,
uint8  auraEffectMask,
bool  removeOtherAuraApplications = false 
)
4361{
4362 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
4363 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end();)
4364 {
4365 AuraEffect const* existingAurEff = (*itr);
4366 ++itr;
4367
4368 if (sSpellMgr->CheckSpellGroupStackRules(spellInfo, existingAurEff->GetSpellInfo()) == SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST)
4369 {
4370 int32 diff = abs(effectAmount) - abs(existingAurEff->GetAmount());
4371 if (!diff)
4372 for (int32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4373 diff += int32((auraEffectMask & (1 << i)) >> i) - int32((existingAurEff->GetBase()->GetEffectMask() & (1 << i)) >> i);
4374
4375 if (!diff && spellInfo->GetFirstRankSpell()->Id != existingAurEff->GetSpellInfo()->GetFirstRankSpell()->Id)
4376 {
4377 int32 newDuration = spellInfo->GetMaxDuration();
4378 int32 existingDuration = existingAurEff->GetBase()->GetMaxDuration();
4379 if (newDuration == -1 && existingDuration != -1)
4380 diff = 1;
4381 else if (newDuration != -1 && existingDuration == -1)
4382 diff = -1;
4383 else
4384 diff = newDuration - existingDuration;
4385 }
4386
4387 if (diff > 0)
4388 {
4389 Aura const* base = existingAurEff->GetBase();
4390 // no removing of area auras from the original owner, as that completely cancels them
4391 if (removeOtherAuraApplications && (!base->IsArea() || base->GetOwner() != this))
4392 {
4393 if (AuraApplication* aurApp = existingAurEff->GetBase()->GetApplicationOfTarget(GetGUID()))
4394 {
4395 bool hasMoreThanOneEffect = base->HasMoreThanOneEffectForType(auraType);
4396 uint32 removedAuras = m_removedAurasCount;
4397 RemoveAura(aurApp);
4398 if (hasMoreThanOneEffect || m_removedAurasCount > removedAuras)
4399 itr = auras.begin();
4400 }
4401 }
4402 }
4403 else if (diff < 0)
4404 return false;
4405 }
4406 }
4407
4408 return true;
4409}
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST
Definition SpellMgr.h:366
bool HasMoreThanOneEffectForType(AuraType auraType) const
Definition SpellAuras.cpp:1128
bool IsArea() const
Definition SpellAuras.cpp:1138
SpellInfo const * GetFirstRankSpell() const
Definition SpellInfo.cpp:2951

References AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraEffect::GetBase(), Aura::GetEffectMask(), SpellInfo::GetFirstRankSpell(), Object::GetGUID(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), Aura::GetOwner(), AuraEffect::GetSpellInfo(), Aura::HasMoreThanOneEffectForType(), SpellInfo::Id, Aura::IsArea(), m_removedAurasCount, MAX_SPELL_EFFECTS, RemoveAura(), SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST, and sSpellMgr.

Referenced by IsHighestExclusiveAura().

◆ IsHostileTo() [1/2]

◆ IsHostileTo() [2/2]

bool WorldObject::IsHostileTo ( WorldObject const *  target) const
4000{
4001 return GetReactionTo(target) <= REP_HOSTILE;
4002}

◆ IsHostileToPlayers()

bool Unit::IsHostileToPlayers ( ) const
7102{
7103 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
7104 if (!my_faction || !my_faction->faction)
7105 return false;
7106
7107 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
7108 if (raw_faction && raw_faction->reputationListID >= 0)
7109 return false;
7110
7111 return my_faction->IsHostileToPlayers();
7112}
int32 reputationListID
Definition DBCStructure.h:945
uint32 faction
Definition DBCStructure.h:977
bool IsHostileToPlayers() const
Definition DBCStructure.h:1017

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsHostileToPlayers(), FactionEntry::reputationListID, and sFactionStore.

◆ IsHovering()

bool Unit::IsHovering ( ) const
inline

◆ IsHunterPet()

◆ IsImmobilizedState()

◆ IsImmunedToAuraPeriodicTick()

bool Unit::IsImmunedToAuraPeriodicTick ( Unit const *  caster,
SpellInfo const *  spellInfo 
) const
9794{
9795 if (!spellInfo)
9796 return false;
9797
9798 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9799 return false;
9800
9801 SpellSchoolMask schoolMask = SpellSchoolMask(spellInfo->GetSchoolMask());
9802 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9803 return false;
9804
9805 auto hasImmunity = [&](SpellImmuneContainer const& container)
9806 {
9807 uint32 schoolImmunityMask = 0;
9808 for (auto const& [immunitySchoolMask, immunityAuraId] : container)
9809 {
9810 SpellInfo const* immuneAuraInfo = sSpellMgr->GetSpellInfo(immunityAuraId);
9811 if (IgnoresSchoolImmunityFromFriendlyCaster(caster, immunityAuraId, immuneAuraInfo))
9812 continue;
9813
9814 schoolImmunityMask |= immunitySchoolMask;
9815 }
9816
9817 // We need to be immune to all types
9818 return (schoolImmunityMask & schoolMask) == schoolMask;
9819 };
9820
9821 // If m_immuneToSchool type contain this school type, IMMUNE periodic tick.
9822 if (hasImmunity(m_spellImmune[IMMUNITY_SCHOOL]))
9823 return true;
9824
9825 return false;
9826}
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition SharedDefines.h:470

References SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), IgnoresSchoolImmunityFromFriendlyCaster(), IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by Spell::EffectEnergize(), Spell::EffectHealMaxHealth(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ IsImmunedToDamage() [1/2]

bool Unit::IsImmunedToDamage ( SpellSchoolMask  schoolMask) const
9711{
9712 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9713 return false;
9714
9715 // If m_immuneToSchool type contains all requested schools, IMMUNE damage.
9717 for (auto const& itr : schoolList)
9718 if (IsImmuneMaskFully(SpellSchoolMask(itr.first), schoolMask))
9719 return true;
9720
9721 // If m_immuneToDamage type contains all requested schools, IMMUNE damage.
9723 return std::ranges::any_of(damageList, [schoolMask](auto const& immune)
9724 {
9725 return Unit::IsImmuneMaskFully(SpellSchoolMask(immune.first), schoolMask);
9726 });
9727}
static bool IsImmuneMaskFully(SpellSchoolMask immuneMask, SpellSchoolMask schoolMask)
Definition Unit.h:1663

References IMMUNITY_DAMAGE, IMMUNITY_SCHOOL, IsImmuneMaskFully(), m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by boss_gurtogg_bloodboil::CanAIAttack(), DealDamageShieldDamage(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), IsImmunedToDamageOrSchool(), ThreatReference::ShouldBeSuppressed(), and WorldObject::SpellHitResult().

◆ IsImmunedToDamage() [2/2]

bool Unit::IsImmunedToDamage ( Unit const *  caster,
SpellInfo const *  spellInfo 
) const
9730{
9731 if (!spellInfo)
9732 return false;
9733
9734 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9735 return false;
9736
9737 SpellSchoolMask schoolMask = SpellSchoolMask(spellInfo->GetSchoolMask());
9738 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9739 return false;
9740
9741 auto hasImmunity = [&](SpellImmuneContainer const& container)
9742 {
9743 uint32 schoolImmunityMask = 0;
9744 for (auto const& [immunitySchoolMask, immunityAuraId] : container)
9745 {
9746 SpellInfo const* immuneAuraInfo = sSpellMgr->GetSpellInfo(immunityAuraId);
9747 if (IgnoresSchoolImmunityFromFriendlyCaster(caster, immunityAuraId, immuneAuraInfo))
9748 continue;
9749
9750 if (immuneAuraInfo && spellInfo->CanPierceImmuneAura(immuneAuraInfo))
9751 continue;
9752
9753 schoolImmunityMask |= immunitySchoolMask;
9754 }
9755
9756 // We need to be immune to all types
9757 return (schoolImmunityMask & schoolMask) == schoolMask;
9758 };
9759
9760 // If m_immuneToSchool type contain this school type, IMMUNE damage.
9761 if (hasImmunity(m_spellImmune[IMMUNITY_SCHOOL]))
9762 return true;
9763
9764 // If m_immuneToDamage type contain magic, IMMUNE damage.
9765 if (hasImmunity(m_spellImmune[IMMUNITY_DAMAGE]))
9766 return true;
9767
9768 return false;
9769}

References SpellInfo::CanPierceImmuneAura(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), IgnoresSchoolImmunityFromFriendlyCaster(), IMMUNITY_DAMAGE, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToDamageOrSchool()

bool Unit::IsImmunedToDamageOrSchool ( SpellSchoolMask  schoolMask) const
9786{
9787 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9788 return false;
9789
9790 return IsImmunedToDamage(schoolMask) || IsImmunedToSchool(schoolMask);
9791}
bool IsImmunedToSchool(SpellSchoolMask schoolMask) const
Definition Unit.cpp:9771

References IsImmunedToDamage(), IsImmunedToSchool(), and SPELL_SCHOOL_MASK_NONE.

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), DealDamage(), Player::HandleFall(), SindragosaIceTombCheck::operator()(), LastPhaseIceTombTargetSelector::operator()(), and npc_darnavan::npc_darnavanAI::UpdateAI().

◆ IsImmunedToSchool()

bool Unit::IsImmunedToSchool ( SpellSchoolMask  schoolMask) const
9772{
9773 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
9774 return false;
9775
9776 // Check IMMUNITY_SCHOOL: returns true if ALL schools in the mask are covered by at least one immunity
9777 // (e.g., Anti-Magic Shell provides school immunity to all magic schools)
9779 return std::ranges::any_of(schoolList, [schoolMask](auto const& immune)
9780 {
9781 return (immune.first & schoolMask) == schoolMask;
9782 });
9783}

References IMMUNITY_SCHOOL, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by IsImmunedToDamageOrSchool().

◆ IsImmunedToSpell() [1/4]

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
virtual

Reimplemented in Creature.

9905{
9906 if (!spellInfo)
9907 return false;
9908
9909 // the spell caster can be a gameobject - immunities are only ignored for friendly unit casters
9910 Unit const* spellCaster = spell ? spell->GetCaster()->ToUnit() : nullptr;
9911 SpellSchoolMask spellSchoolMask = spell ? spell->GetSpellSchoolMask() : spellInfo->GetSchoolMask();
9912 return IsImmunedToSpell(spellInfo, spellCaster, spellSchoolMask);
9913}

References Spell::GetCaster(), SpellInfo::GetSchoolMask(), Spell::GetSpellSchoolMask(), IsImmunedToSpell(), and Object::ToUnit().

Referenced by AddAura(), Spell::DoSpellHitOnUnit(), IsImmunedToSpell(), Creature::IsImmunedToSpell(), IsImmunedToSpell(), boss_talon_king_ikiss::JustEngagedWith(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), WorldObject::SpellHitResult(), and WorldObject::SpellHitResult().

◆ IsImmunedToSpell() [2/4]

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
uint32  effectMask,
Unit const *  caster = nullptr 
)
916{
917 if (!spellInfo)
918 return false;
919
920 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
921 return false;
922
923 bool immuneToAllEffects = true;
924 bool hasCheckedEffect = false;
925
926 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
927 {
928 if (!(effectMask & (1u << i)))
929 continue;
930
931 if (!spellInfo->Effects[i].IsEffect())
932 continue;
933
934 hasCheckedEffect = true;
935
936 if (IsImmunedToSpellEffect(spellInfo, i, caster))
937 {
938 if (spellInfo->HasAttribute(SPELL_ATTR4_NO_PARTIAL_IMMUNITY))
939 return true;
940
941 continue;
942 }
943
944 immuneToAllEffects = false;
945 break;
946 }
947
948 if (hasCheckedEffect && immuneToAllEffects)
949 return true;
950
951 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES) && HasSchoolImmunityForMask(spellInfo->GetSchoolMask(), caster, spellInfo))
952 return true;
953
954 return false;
955}
@ SPELL_ATTR4_NO_PARTIAL_IMMUNITY
Definition SharedDefines.h:529
bool HasSchoolImmunityForMask(SpellSchoolMask schoolMask, Unit const *caster, SpellInfo const *spellInfo) const
Definition Unit.cpp:9683

References EFFECT_0, SpellInfo::Effects, SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSchoolImmunityForMask(), HasSpiritOfRedemptionAura(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_ATTR4_NO_PARTIAL_IMMUNITY.

◆ IsImmunedToSpell() [3/4]

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Unit const *  caster 
)
9829{
9830 return IsImmunedToSpell(spellInfo, caster, spellInfo ? spellInfo->GetSchoolMask() : SPELL_SCHOOL_MASK_NONE);
9831}

References SpellInfo::GetSchoolMask(), IsImmunedToSpell(), and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToSpell() [4/4]

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Unit const *  caster,
SpellSchoolMask  spellSchoolMask 
)
9834{
9835 if (!spellInfo)
9836 return false;
9837
9838 // Single spell immunity.
9840 if (idList.count(spellInfo->Id) > 0)
9841 return true;
9842
9843 // xinef: my special immunity, if spellid is not on this list it means npc is immune
9845 if (!allowIdList.empty())
9846 {
9847 if (allowIdList.count(spellInfo->Id) == 0)
9848 return true;
9849 return false;
9850 }
9851
9852 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9853 return false;
9854
9855 if (uint32 dispel = spellInfo->Dispel)
9856 {
9858 if (dispelList.count(dispel) > 0)
9859 return true;
9860 }
9861
9862 // Spells that don't have effectMechanics.
9863 if (uint32 mechanic = spellInfo->Mechanic)
9864 {
9865 if (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY))
9866 {
9868 if (mechanicList.count(mechanic) > 0)
9869 return true;
9870 }
9871 }
9872
9873 bool immuneToAllEffects = true;
9874 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9875 {
9876 // State/effect immunities applied by aura expect full spell immunity
9877 // Ignore effects with mechanic, they are supposed to be checked separately
9878 if (!spellInfo->Effects[i].IsEffect())
9879 continue;
9880
9881 // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
9882 if (IsImmunedToSpellEffect(spellInfo, i, caster))
9883 {
9884 if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
9885 return true;
9886 continue;
9887 }
9888
9889 immuneToAllEffects = false;
9890 break;
9891 }
9892 if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
9893 return true;
9894
9895 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9896 {
9897 if (HasSchoolImmunityForMask(spellSchoolMask, caster, spellInfo))
9898 return true;
9899 }
9900
9901 return false;
9902}
@ IMMUNITY_ALLOW_ID
Definition SharedDefines.h:1405
@ IMMUNITY_ID
Definition SharedDefines.h:1404
@ IMMUNITY_MECHANIC
Definition SharedDefines.h:1403
@ IMMUNITY_DISPEL
Definition SharedDefines.h:1402
@ SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY
Definition SpellInfo.h:209

References SpellInfo::Dispel, SpellInfo::Effects, SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSchoolImmunityForMask(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_ALLOW_ID, IMMUNITY_DISPEL, IMMUNITY_ID, IMMUNITY_MECHANIC, IsImmunedToSpellEffect(), m_spellImmune, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_AURA_TRANSFORM.

◆ IsImmunedToSpellEffect()

bool Unit::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index,
WorldObject const *  caster = nullptr 
) const
virtual

Reimplemented in Creature, and Totem.

9916{
9917 if (!spellInfo || !spellInfo->Effects[index].IsEffect())
9918 return false;
9919
9920 // xinef: pet scaling auras
9921 if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
9922 return false;
9923
9924 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
9925 return false;
9926
9927 // Special-case handling for Vezax's Aura of Despair.
9928 static constexpr uint32 SPELL_AURA_OF_DESPAIR_1 = 62692;
9929 static constexpr uint32 SPELL_AURA_OF_DESPAIR_2 = 64848;
9930
9931 //If m_immuneToEffect type contain this effect type, IMMUNE effect.
9932 uint32 effect = spellInfo->Effects[index].Effect;
9934 for (SpellImmuneContainer::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
9935 {
9936 if (itr->first == effect && (itr->second != SPELL_AURA_OF_DESPAIR_1 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
9937 {
9938 return true;
9939 }
9940 }
9941
9942 if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
9943 {
9944 if (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY))
9945 {
9946 auto const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
9947 if (mechanicList.count(mechanic) > 0)
9948 return true;
9949 }
9950 }
9951
9952 if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
9953 {
9954 if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
9955 {
9957 for (SpellImmuneContainer::const_iterator itr = list.begin(); itr != list.end(); ++itr)
9958 {
9959 if (itr->first == aura && (itr->second != SPELL_AURA_OF_DESPAIR_2 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
9960 return true;
9961 }
9962
9963 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
9964 {
9965 // Check for immune to application of harmful magical effects
9967 {
9968 if (!(immuneAuraApply->GetMiscValue() & spellInfo->GetSchoolMask())) // Check school
9969 continue;
9970
9971 if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || (caster && !IsFriendlyTo(caster))) // Harmful
9972 return true;
9973 }
9974 }
9975 }
9976 }
9977
9978 return false;
9979}
@ SPELL_ATTR3_ALWAYS_HIT
Definition SharedDefines.h:499
@ IMMUNITY_STATE
Definition SharedDefines.h:1399
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1398
@ SPELL_ATTR4_OWNER_POWER_SCALING
Definition SharedDefines.h:543
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition SpellAuraDefines.h:330
@ SPELL_AURA_OF_DESPAIR_2
Definition boss_general_vezax.cpp:46
@ SPELL_AURA_OF_DESPAIR_1
Definition boss_general_vezax.cpp:45
bool CanRestoreMana(SpellInfo const *spellInfo) const
Definition Unit.cpp:17016

References CanRestoreMana(), SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, IsFriendlyTo(), m_spellImmune, POWER_MANA, SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_OWNER_POWER_SCALING, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, SPELL_AURA_OF_DESPAIR_1, and SPELL_AURA_OF_DESPAIR_2.

Referenced by AddAura(), Spell::AddUnitTarget(), Spell::DoSpellHitOnUnit(), spell_dk_death_grip::HandleBaseDummy(), IsImmunedToSpell(), IsImmunedToSpell(), and Creature::IsImmunedToSpellEffect().

◆ IsImmuneMaskFully()

static bool Unit::IsImmuneMaskFully ( SpellSchoolMask  immuneMask,
SpellSchoolMask  schoolMask 
)
inlinestatic
1663{ return (immuneMask & schoolMask) == schoolMask; }

Referenced by IsImmunedToDamage(), TEST(), TEST(), and TEST().

◆ IsImmuneToAll()

bool Unit::IsImmuneToAll ( ) const
inline
939{ return IsImmuneToPC() && IsImmuneToNPC(); }

References IsImmuneToNPC(), and IsImmuneToPC().

◆ IsImmuneToNPC()

◆ IsImmuneToPC()

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature const *  c) const
4166{
4167 if (c->GetMapId() == MAP_THE_RING_OF_VALOR)
4168 {
4169 // skip transport check, check for being below floor level
4170 if (this->GetPositionZ() < 28.0f)
4171 return false;
4172 if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap())
4173 if (Battleground* bg = bgMap->GetBG())
4174 if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time
4175 return false;
4176 }
4177 else if (c->GetMapId() == MAP_ICECROWN_CITADEL)
4178 {
4179 // if static transport doesn't match - return false
4180 if (c->GetTransport() != this->GetTransport() && ((c->GetTransport() && c->GetTransport()->IsStaticTransport()) || (this->GetTransport() && this->GetTransport()->IsStaticTransport())))
4181 return false;
4182
4183 // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
4184 if (c->GetOwnerGUID().IsPlayer() && !c->CanFly())
4185 {
4186 if (c->GetTransport() != this->GetTransport())
4187 return false;
4188 if (this->GetTransport())
4189 {
4190 if (c->GetPositionY() < 2033.0f)
4191 {
4192 if (this->GetPositionY() > 2033.0f)
4193 return false;
4194 }
4195 else if (c->GetPositionY() < 2438.0f)
4196 {
4197 if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f)
4198 return false;
4199 }
4200 else if (this->GetPositionY() < 2438.0f)
4201 return false;
4202 }
4203 }
4204 }
4205 else
4206 {
4207 // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away
4208 if (c->GetTransport() != this->GetTransport())
4209 return false;
4210 }
4211
4212 LiquidStatus liquidStatus = GetLiquidData().Status;
4213 bool isInWater = (liquidStatus & MAP_LIQUID_STATUS_IN_CONTACT) != 0;
4214
4215 // In water or jumping in water
4216 if (isInWater || (liquidStatus == LIQUID_MAP_ABOVE_WATER && (IsFalling() || (ToPlayer() && ToPlayer()->IsFalling()))))
4217 {
4218 return c->CanEnterWater();
4219 }
4220 else
4221 {
4222 return c->CanWalk() || c->CanFly();
4223 }
4224}
@ MAP_THE_RING_OF_VALOR
Definition AreaDefines.h:265
@ MAP_ICECROWN_CITADEL
Definition AreaDefines.h:269
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition GridTerrainData.h:32
LiquidStatus
Definition GridTerrainData.h:190
@ LIQUID_MAP_ABOVE_WATER
Definition GridTerrainData.h:192
Definition Map.h:761
BattlegroundMap * ToBattlegroundMap()
Definition Map.h:393
bool IsFalling() const
Definition Unit.cpp:15651
LiquidData const & GetLiquidData() const
Definition Object.cpp:3211
LiquidStatus Status
Definition GridTerrainData.h:206

References Creature::CanEnterWater(), Creature::CanFly(), Creature::CanWalk(), WorldObject::GetLiquidData(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetOwnerGUID(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), IsFalling(), ObjectGuid::IsPlayer(), GameObject::IsStaticTransport(), LIQUID_MAP_ABOVE_WATER, MAP_ICECROWN_CITADEL, MAP_LIQUID_STATUS_IN_CONTACT, MAP_THE_RING_OF_VALOR, LiquidData::Status, Map::ToBattlegroundMap(), and Object::ToPlayer().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), ChaseMovementGenerator< T >::DoUpdate(), FollowerAI::MoveInLineOfSight(), and npc_escortAI::MoveInLineOfSight().

◆ isInBackInMap()

bool Unit::isInBackInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4161{
4162 return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI - arc, target);
4163}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

Referenced by npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight().

◆ IsInCombat()

bool Unit::IsInCombat ( ) const
inline

References HasUnitFlag(), and UNIT_FLAG_IN_COMBAT.

Referenced by BossAI::_CheckHealthAfterCast(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), npc_argent_captainAI::CanAIAttack(), Player::CanEquipItem(), Creature::CanPeriodicallyCallForAssistance(), ToCloud9GrpcHandler::CanPlayerTeleportToBattleground(), npc_rocknot::CanStartLovePotionEvent(), Player::CanUnequipItem(), boss_high_nethermancer_zerevor::CastDampenMagicIfPossible(), spell_hun_disengage::CheckCast(), Spell::CheckCast(), spell_ulduar_teleporter::CheckRequirement(), SpellInfo::CheckTarget(), instance_blackrock_depths::CheckTombReset(), ClearInCombat(), npc_simone::npc_simoneAI::CorpseRemoved(), Map::CreatureRelocation(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), npc_rocknot::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_felblood_kaelthas::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), instance_trial_of_the_crusader::DoCheckDedicatedInsanity(), Spell::DoSpellHitOnUnit(), Spell::EffectActivateRune(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), Player::EquipItem(), CastRunesEvent::Execute(), GetVelocity(), spell_apothecary_lingering_fumes::HandleAfterCast(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), debug_commandscript::HandleDebugCombatListCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), spell_dred_raptor_call::HandleDummy(), spell_mc_play_dead_aura::HandleEffectRemove(), WorldSession::HandleEquipmentSetUse(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_chapter5_return_to_capital::HandleHit(), boss_malygos::HandleIntroSpeech(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), spell_putricide_mutated_transformation::HandleSummon(), WorldSession::HandleSummonResponseOpcode(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleUseItemOpcode(), npc_pet_mage_mirror_image::InitializeAI(), IsEngaged(), Creature::IsUpdateNeeded(), npc_highlord_darion_mograine::JustSummoned(), boss_anubrekhan::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), Pet::LoseHappiness(), CreatureGroup::MemberEvaded(), CreatureAI::MoveInLineOfSight(), boss_muru::MoveInLineOfSight(), boss_eye_of_cthun::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), boss_alar::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), CreatureAI::OnCharmed(), SmartAI::OnCharmed(), icecrown_citadel_teleport::OnGossipSelect(), at_frozen_throne_teleport::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), npc_scarlet_ghoul::OwnerAttackedBy(), boss_kologarn::PassengerBoarded(), SmartScript::ProcessEvent(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), boss_kiljaeden::Reset(), spell_item_crazy_alchemists_potion::SecondaryEffect(), instance_naxxramas::SetBossState(), boss_grand_warlock_nethekurse::SetData(), SetSpeed(), npc_expedition_commander::sGossipSelect(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SpellHit(), Spell::SummonGuardian(), lfg::LFGMgr::TeleportPlayer(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Update(), DistractMovementGenerator::Update(), TotemAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scarlet_ghoul::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_hodir::UpdateAI(), boss_mimiron::UpdateAI(), npc_expedition_engineer::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), PassiveAI::UpdateAI(), PetAI::UpdateAI(), Player::UpdateContestedPvP(), Creature::UpdateEntry(), boss_bjarngrim::UpdateEscortAI(), InstanceScript::UpdateMinionState(), CombatManager::UpdateOwnerCombatState(), SmartAI::UpdatePath(), Player::UpdatePotionCooldown(), CreatureAI::UpdateVictim(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsInCombatWith()

bool Unit::IsInCombatWith ( Unit const *  who) const
16829{
16830 if (!who)
16831 return false;
16832 return GetCombatManager().IsInCombatWith(who);
16833}
bool IsInCombatWith(ObjectGuid const &who) const
Definition CombatManager.cpp:263

References GetCombatManager(), and CombatManager::IsInCombatWith().

Referenced by _IsValidAttackTarget(), npc_pet_dk_army_of_the_dead::CanAIAttack(), TemporaryThreatModifierEvent::Execute(), IsEngagedBy(), and Acore::NearestAttackableUnitInObjectRangeCheck::operator()().

◆ IsInDisallowedMountForm()

bool Unit::IsInDisallowedMountForm ( ) const
17052{
17053 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
17054 {
17055 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
17056 {
17057 return false;
17058 }
17059 }
17060
17061 if (ShapeshiftForm form = GetShapeshiftForm())
17062 {
17063 SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.LookupEntry(form);
17064 if (!shapeshift)
17065 {
17066 return true;
17067 }
17068
17069 if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE))
17070 {
17071 return true;
17072 }
17073 }
17074
17076 {
17077 return false;
17078 }
17079
17080 CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
17081 if (!display)
17082 {
17083 return true;
17084 }
17085
17087 if (!displayExtra)
17088 {
17089 return true;
17090 }
17091
17092 CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
17093 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
17094
17095 if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
17096 {
17097 if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
17098 {
17099 return true;
17100 }
17101 }
17102
17103 return false;
17104}
@ CHRRACES_FLAGS_CAN_MOUNT
Definition DBCStructure.h:702
@ CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT
Definition DBCStructure.h:798
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition SharedDefines.h:394
@ SHAPESHIFT_FLAG_STANCE
Definition UnitDefines.h:107
uint32 getTransForm() const
Definition Unit.h:1990
bool HasFlag(ChrRacesFlags flag) const
Definition DBCStructure.h:727
uint32 ExtendedDisplayInfoID
Definition DBCStructure.h:752
uint32 DisplayRaceID
Definition DBCStructure.h:768
bool HasFlag(CreatureModelDataFlags flag) const
Definition DBCStructure.h:831
uint32 flags1
Definition DBCStructure.h:1858

References CHRRACES_FLAGS_CAN_MOUNT, CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT, CreatureDisplayInfoExtraEntry::DisplayRaceID, CreatureDisplayInfoEntry::ExtendedDisplayInfoID, SpellShapeshiftFormEntry::flags1, GetDisplayId(), GetNativeDisplayId(), GetShapeshiftForm(), getTransForm(), ChrRacesEntry::HasFlag(), CreatureModelDataEntry::HasFlag(), CreatureDisplayInfoEntry::ModelId, sChrRacesStore, sCreatureDisplayInfoExtraStore, sCreatureDisplayInfoStore, sCreatureModelDataStore, SHAPESHIFT_FLAG_STANCE, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, sSpellMgr, and sSpellShapeshiftFormStore.

Referenced by Player::ActivateTaxiPathTo(), npc_toc5_player_vehicle::BeforeSpellClick(), Spell::CheckCast(), Player::ContinueTaxiFlight(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_q13010_jokkum_summon::HandleSummon(), and Player::ProcessDelayedOperations().

◆ IsInFeralForm()

bool Unit::IsInFeralForm ( ) const
inline
1983 {
1985 return form == FORM_CAT || form == FORM_BEAR || form == FORM_DIREBEAR || form == FORM_GHOSTWOLF; // Xinef: added shamans Ghost Wolf, should behave exactly like druid forms
1986 }
@ FORM_DIREBEAR
Definition UnitDefines.h:80
@ FORM_CAT
Definition UnitDefines.h:73
@ FORM_GHOSTWOLF
Definition UnitDefines.h:88
@ FORM_BEAR
Definition UnitDefines.h:77

References FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_GHOSTWOLF, and GetShapeshiftForm().

Referenced by Player::_ApplyWeaponDamage(), Player::CalculateMinMaxDamage(), spell_dru_survival_instincts::CheckCast(), Aura::GetProcEffectMask(), Player::GetWeaponForAttack(), GetWeaponSkillValue(), AuraEffect::HandleAuraModDisarm(), Player::UpdateAttackPowerAndDamage(), and Player::UpdateWeaponSkill().

◆ IsInFlight()

bool Unit::IsInFlight ( ) const
inline

References HasUnitState(), and UNIT_STATE_IN_FLIGHT.

Referenced by Player::CheckAreaExploreAndOutdoor(), Spell::CheckCast(), SpellInfo::CheckTarget(), CreatureUnitRelocationWorker(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectLeap(), Spell::EffectStuck(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), Player::GetNPCIfCanInteractWith(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), WorldSession::HandleHearthAndResurrect(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLogoutRequestOpcode(), Battlefield::HandlePlayerEnterZone(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), misc_commandscript::HandleUnstuckCommand(), Battlefield::InvitePlayerToWar(), Player::IsFalling(), Player::IsOutdoorPvPActive(), IsValidCombatTarget(), item_only_for_flight::OnUse(), WorldSession::ProcessMovementInfo(), Player::ProcessTerrainStatusUpdate(), SetStunned(), Acore::PlayerCommand::SummonOnlinePlayer(), Player::TeleportTo(), and Player::UpdatePvPState().

◆ isInFrontInMap()

bool Unit::isInFrontInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4156{
4157 return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
4158}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

◆ IsInnkeeper()

bool Unit::IsInnkeeper ( ) const
inline
@ UNIT_NPC_FLAG_INNKEEPER
Definition UnitDefines.h:338

References HasNpcFlag(), and UNIT_NPC_FLAG_INNKEEPER.

Referenced by npc_innkeeper::OnGossipHello().

◆ IsInPartyWith()

bool Unit::IsInPartyWith ( Unit const *  unit) const
14753{
14754 if (this == unit)
14755 return true;
14756
14757 Unit const* u1 = GetCharmerOrOwnerOrSelf();
14758 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
14759 if (u1 == u2)
14760 return true;
14761
14762 if (u1->IsPlayer() && u2->IsPlayer())
14763 return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
14764 // Xinef: we assume that npcs with the same faction are in party
14765 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
14766 return u1->GetFaction() == u2->GetFaction();
14767 // Xinef: creature type_flag should work for party check only if player group is not a raid
14770 return true;
14771 else
14772 return false;
14773}
bool isRaidGroup() const
Definition Group.cpp:2513
bool IsInSameGroupWith(Player const *p) const
Definition Player.cpp:2342

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Player::GetGroup(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameGroupWith(), Object::IsPlayer(), Group::isRaidGroup(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by SpellInfo::CheckExplicitTarget(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ IsInPreDeathAuraTick()

bool Unit::IsInPreDeathAuraTick ( ) const
inline
1809{ return m_inPreDeathAuraTick; }
bool m_inPreDeathAuraTick
Definition Unit.h:2176

References m_inPreDeathAuraTick.

Referenced by CalcAbsorbResist(), DealDamage(), and Spell::prepare().

◆ IsInRaidWith()

bool Unit::IsInRaidWith ( Unit const *  unit) const
14776{
14777 if (this == unit)
14778 return true;
14779
14780 Unit const* u1 = GetCharmerOrOwnerOrSelf();
14781 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
14782 if (u1 == u2)
14783 return true;
14784
14785 if (u1->IsPlayer() && u2->IsPlayer())
14786 return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
14787 // Xinef: we assume that npcs with the same faction are in party
14788 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
14789 return u1->GetFaction() == u2->GetFaction();
14792 return true;
14793 else
14794 return false;
14795}

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameRaidWith(), Object::IsPlayer(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by Corpse::BuildValuesUpdate(), SpellInfo::CheckExplicitTarget(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), GetReactionTo(), WorldSession::HandleLootMasterGiveOpcode(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), and PatchValuesUpdate().

◆ IsInSanctuary()

bool Unit::IsInSanctuary ( ) const
inline

◆ IsInWater()

◆ IsLevitating()

◆ IsMounted()

◆ IsMovementPreventedByCasting()

bool Unit::IsMovementPreventedByCasting ( ) const
virtual

Reimplemented in Creature.

4112{
4113 // can always move when not casting
4115 {
4116 return false;
4117 }
4118
4119 // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
4121 {
4122 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
4123 {
4124 if (spell->GetSpellInfo()->IsActionAllowedChannel())
4125 {
4126 return false;
4127 }
4128 }
4129 }
4130
4131 // prohibit movement for all other spell casts
4132 return true;
4133}

References CURRENT_CHANNELED_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by TimedFleeingMovementGenerator::Update().

◆ isMoving()

◆ IsNeutralToAll()

bool Unit::IsNeutralToAll ( ) const
7115{
7116 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
7117 if (!my_faction || !my_faction->faction)
7118 return true;
7119
7120 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
7121 if (raw_faction && raw_faction->reputationListID >= 0)
7122 return false;
7123
7124 return my_faction->IsNeutralToAll();
7125}
bool IsNeutralToAll() const
Definition DBCStructure.h:1020

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsNeutralToAll(), FactionEntry::reputationListID, and sFactionStore.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), AggressorAI::Permissible(), and ReactorAI::Permissible().

◆ IsNonMeleeSpellCast()

bool Unit::IsNonMeleeSpellCast ( bool  withDelayed,
bool  skipChanneled = false,
bool  skipAutorepeat = false,
bool  isAutoshoot = false,
bool  skipInstant = true 
) const
4043{
4044 // We don't do loop here to explicitly show that melee spell is excluded.
4045 // Maybe later some special spells will be excluded too.
4046
4047 // generic spells are cast when they are not finished and not delayed
4050 (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
4051 {
4052 if (!skipInstant || m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
4053 {
4054 if (!isAutoshoot || !m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4055 return true;
4056 }
4057 }
4058 // channeled spells may be delayed, but they are still considered cast
4059 if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
4061 {
4062 if (!isAutoshoot || !m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4063 return true;
4064 }
4065 // autorepeat spells may be finished or delayed, but they are still considered cast
4066 if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
4067 return true;
4068
4069 return false;
4070}
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition SharedDefines.h:461

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, m_currentSpells, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_DELAYED, and SPELL_STATE_FINISHED.

Referenced by Spell::_cast(), _UpdateAutoRepeatSpell(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), Player::CanEquipItem(), Player::CanExecutePendingSpellCastRequest(), CombatStop(), npc_molten_golem::DamageTaken(), ScriptedAI::DoCastSpell(), Spell::EffectKnockBack(), Spell::finish(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleLootOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), isSpellBlocked(), boss_shade_of_aran::JustEngagedWith(), boss_pandemonius::JustEngagedWith(), MeleeSpellHitResult(), Spell::prepare(), SmartScript::ProcessEvent(), RollMeleeOutcomeAgainst(), setDeathState(), StopAttackFaction(), boss_netherspite::SwitchToPortalPhase(), Player::TeleportTo(), TotemAI::UpdateAI(), npc_chesspiece::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_vh_teleportation_portal::UpdateAI(), npc_warmage_violetstand::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ IsOnVehicle()

◆ IsPet()

bool Unit::IsPet ( ) const
inline
803{ return m_unitTypeMask & UNIT_MASK_PET; }
@ UNIT_MASK_PET
Definition UnitDefines.h:163

References m_unitTypeMask, and UNIT_MASK_PET.

Referenced by Spell::AddUnitTarget(), Creature::AllLootRemovedFromCorpse(), Creature::AtDisengage(), Creature::AtEngage(), BeforeVisibilityDestroy< Creature >(), Creature::CallAssistance(), Creature::CallForHelp(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), ThreatManager::CanHaveThreatList(), boss_renataki::boss_renatakiAI::CanSeeAlways(), Creature::CanSwim(), spell_warl_demonic_pact::CheckProc(), ClearInCombat(), Creature::CreateFromProto(), Player::CreatePet(), DealDamage(), MotionTransport::DelayedTeleportTransport(), ChaseMovementGenerator< T >::DispatchSplineToPosition(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectDismissPet(), Spell::EffectForceDeselect(), Spell::EffectRenamePet(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectTameCreature(), Acore::XP::Gain(), Creature::GetAggroRange(), GetCastingTimeForBonus(), GetCombatRatingReduction(), GetCreatePowers(), GetNextRandomRaidMemberOrPet(), GetRandomContactPoint(), GetVelocity(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleFeignDeath(), modify_commandscript::HandleModifyTalentCommand(), AuraEffect::HandleModPossessPet(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcShowLootCommand(), npc_commandscript::HandleNpcTameCommand(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), WorldSession::HandlePetRename(), WorldSession::HandlePetSetAction(), misc_commandscript::HandleRespawnCommand(), Creature::InitEntry(), TempSummon::InitStats(), Guardian::InitStatsForLevel(), DisableMgr::IsDisabledFor(), Creature::isElite(), Minion::IsGuardianPet(), Player::isHonorOrXPTarget(), Creature::isWorldBoss(), npc_underbat::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), Kill(), spell_hun_target_self_and_pet::Load(), WorldObject::ModSpellCastTime(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::MoveInLineOfSight(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::MoveInLineOfSight(), Acore::MostHPMissingGroupInRange::operator()(), PetAI::ReceiveEmote(), RollMeleeOutcomeAgainst(), FactorySelector::SelectAI(), Creature::SelectLevel(), WorldSession::SendPetNameQuery(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetCharm(), SetHealth(), SetMinion(), Creature::SetObjectScale(), setPowerType(), SpellDamageBonusDone(), SpellPctDamageModsDone(), PetAI::StartChase(), Spell::SummonGuardian(), ToPet(), TempSummon::UnSummon(), Update(), boss_vaelastrasz::UpdateAI(), boss_hazzarah::UpdateAI(), PetAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdateAuraForGroup(), Creature::UpdateEntry(), Creature::UpdateMoveInLineOfSightState(), UpdatePetCombatState(), UpdateSpeed(), and UpdateSplinePosition().

◆ IsPetAura()

bool Unit::IsPetAura ( Aura const *  aura)
13441{
13442 Unit* owner = GetOwner();
13443
13444 if (!owner || !owner->IsPlayer())
13445 return false;
13446
13447 // if the owner has that pet aura, return true
13448 for (PetAura const* petAura : owner->m_petAuras)
13449 if (petAura->GetAura(GetEntry()) == aura->GetId())
13450 return true;
13451
13452 return false;
13453}
Definition SpellMgr.h:469
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5675

References Object::GetEntry(), Aura::GetId(), GetOwner(), Object::IsPlayer(), and m_petAuras.

Referenced by Pet::_SaveAuras(), and Spell::EffectSummonPet().

◆ IsPetInCombat()

bool Unit::IsPetInCombat ( ) const
inline

◆ IsPolymorphed()

bool Unit::IsPolymorphed ( ) const
12833{
12834 uint32 transformId = getTransForm();
12835 if (!transformId)
12836 return false;
12837
12838 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
12839 if (!spellInfo)
12840 return false;
12841
12842 return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
12843}
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:161
SpellSpecificType GetSpellSpecific() const
Definition SpellInfo.cpp:2093

References SpellInfo::GetSpellSpecific(), getTransForm(), SPELL_SPECIFIC_MAGE_POLYMORPH, and sSpellMgr.

Referenced by Attack(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), and Creature::Update().

◆ isPossessed()

◆ isPossessedByPlayer()

bool Unit::isPossessedByPlayer ( ) const
inline

◆ isPossessing() [1/2]

bool Unit::isPossessing ( ) const
inline
1331 {
1332 if (Unit* u = GetCharm())
1333 return u->isPossessed();
1334 else
1335 return false;
1336 }

References GetCharm().

Referenced by WorldSession::HandleCastSpellOpcode(), and misc_commandscript::HandleUnbindSightCommand().

◆ isPossessing() [2/2]

bool Unit::isPossessing ( Unit *  u) const
inline
1337{ return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessed() const
Definition Unit.h:1328

References GetCharmGUID(), Object::GetGUID(), and isPossessed().

◆ IsPvP()

◆ IsQuestGiver()

◆ IsRooted()

◆ IsScriptOverriden()

AuraEffect * Unit::IsScriptOverriden ( SpellInfo const *  spell,
int32  script 
) const
5927{
5929 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5930 {
5931 if ((*i)->GetMiscValue() == script)
5932 if ((*i)->IsAffectedOnSpell(spell))
5933 return (*i);
5934 }
5935 return nullptr;
5936}
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175

References GetAuraEffectsByType(), and SPELL_AURA_OVERRIDE_CLASS_SCRIPTS.

Referenced by Spell::CheckCast(), Spell::EffectWeaponDmg(), and AuraEffect::HandleAuraModShapeshift().

◆ IsServiceProvider()

bool Unit::IsServiceProvider ( ) const
inline

◆ IsSitState()

bool Unit::IsSitState ( ) const
12794{
12795 uint8 s = getStandState();
12796 return
12800}
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition UnitDefines.h:41
@ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR
Definition UnitDefines.h:40
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition UnitDefines.h:39
@ UNIT_STAND_STATE_SIT_CHAIR
Definition UnitDefines.h:37

References getStandState(), UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_CHAIR, UNIT_STAND_STATE_SIT_HIGH_CHAIR, UNIT_STAND_STATE_SIT_LOW_CHAIR, and UNIT_STAND_STATE_SIT_MEDIUM_CHAIR.

Referenced by _ApplyAura(), AttackerStateUpdate(), IsStandState(), Spell::prepare(), and SpellTakenCritChance().

◆ isSpellBlocked()

bool Unit::isSpellBlocked ( Unit *  victim,
SpellInfo const *  spellProto,
WeaponAttackType  attackType = BASE_ATTACK 
)
3299{
3300 // These spells can't be blocked
3301 if (spellProto && (spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE) || spellProto->HasAttribute(SPELL_ATTR3_ALWAYS_HIT)))
3302 return false;
3303
3304 if (victim->HasIgnoreHitDirectionAura() || victim->HasInArc(M_PI, this))
3305 {
3306 // Check creatures flags_extra for disable block
3307 if (victim->IsCreature() &&
3309 return false;
3310
3311 float blockChance = victim->GetUnitBlockChance();
3312 blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
3313
3314 // xinef: cant block while casting or while stunned
3315 if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3316 blockChance = 0.0f;
3317
3318 if (roll_chance_f(blockChance))
3319 return true;
3320 }
3321 return false;
3322}
@ CREATURE_FLAG_EXTRA_NO_BLOCK
Definition CreatureData.h:50
@ SPELL_ATTR0_NO_ACTIVE_DEFENSE
Definition SharedDefines.h:391
@ UNIT_STATE_CONTROLLED
Definition UnitDefines.h:218
bool HasIgnoreHitDirectionAura() const
Definition Unit.h:1831
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition Unit.cpp:3700
float GetUnitBlockChance() const
Definition Unit.cpp:3602

References CREATURE_FLAG_EXTRA_NO_BLOCK, GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), Creature::HasFlagsExtra(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), Object::IsCreature(), IsNonMeleeSpellCast(), roll_chance_f(), SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, Object::ToCreature(), and UNIT_STATE_CONTROLLED.

Referenced by CalculateSpellDamageTaken().

◆ IsSpiritGuide()

bool Unit::IsSpiritGuide ( ) const
inline

◆ IsSpiritHealer()

bool Unit::IsSpiritHealer ( ) const
inline

◆ IsSpiritService()

◆ IsStandState()

◆ IsStandUpOnMovementState()

◆ IsStopped()

bool Unit::IsStopped ( ) const
inline

◆ IsSummon()

bool Unit::IsSummon ( ) const
inline
@ UNIT_MASK_SUMMON
Definition UnitDefines.h:159

References m_unitTypeMask, and UNIT_MASK_SUMMON.

Referenced by Creature::CanPeriodicallyCallForAssistance(), spell_item_unsated_craving::CheckProc(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Spell::EffectScriptEffect(), boss_skeram::EnterEvadeMode(), npc_phantom_hallucination::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), Spell::finish(), GetAllMinionsByEntry(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), boss_skeram::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), boss_yoggsaron_influence_tentacle::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::JustDied(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), boss_skeram::JustEngagedWith(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), BattlefieldWG::OnCreatureCreate(), InstanceScript::OnCreatureCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnUnitDeath(), boss_freya_iron_root::ReleaseRootedPlayer(), RemoveAllControlled(), RemoveAllMinionsByEntry(), npc_stormforged_lieutenant::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), Creature::SaveRespawnTime(), Creature::SearchFormation(), Creature::SelectVictim(), npc_ulduar_flames_spread::SpellHit(), ToTempSummon(), ToTempSummon(), Creature::Update(), npc_valkyr_battle_maiden::UpdateAI(), boss_skeram::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_flash_freeze::UpdateAI(), npc_vh_void_sentry::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), and Player::VehicleSpellInitialize().

◆ isSwimming()

◆ IsTabardDesigner()

bool Unit::IsTabardDesigner ( ) const
inline

◆ isTargetableForAttack()

◆ IsTaxi()

bool Unit::IsTaxi ( ) const
inline

◆ IsThreatened()

bool Unit::IsThreatened ( ) const
16836{
16838}
bool IsThreatListEmpty(bool includeOffline=false) const
Definition ThreatManager.cpp:289

References ThreatManager::IsThreatListEmpty(), and m_threatManager.

◆ IsThreatenedBy()

bool Unit::IsThreatenedBy ( Unit const *  who) const
inline
972{ return who && m_threatManager.IsThreatenedBy(who, true); }
bool IsThreatenedBy(ObjectGuid const &who, bool includeOffline=false) const
Definition ThreatManager.cpp:299

References ThreatManager::IsThreatenedBy(), and m_threatManager.

Referenced by IsEngagedBy().

◆ IsTotem()

bool Unit::IsTotem ( ) const
inline

◆ IsTrainer()

◆ isTurning()

bool Unit::isTurning ( ) const
inline

◆ IsUnderLastManaUseEffect()

bool Unit::IsUnderLastManaUseEffect ( ) const

◆ IsUnderWater()

bool Unit::IsUnderWater ( ) const
virtual
4317{
4319}
@ LIQUID_MAP_UNDER_WATER
Definition GridTerrainData.h:195

References WorldObject::GetLiquidData(), LIQUID_MAP_UNDER_WATER, and LiquidData::Status.

◆ IsValidAssistTarget()

bool Unit::IsValidAssistTarget ( Unit const *  target) const
10704{
10705 return _IsValidAssistTarget(target, nullptr);
10706}
bool _IsValidAssistTarget(Unit const *target, SpellInfo const *bySpell) const
Definition Unit.cpp:10709

References _IsValidAssistTarget().

Referenced by SmartAI::AssistPlayerInCombatAgainst().

◆ IsValidAttackTarget()

bool Unit::IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell = nullptr 
) const
10554{
10555 return _IsValidAttackTarget(target, bySpell);
10556}

References _IsValidAttackTarget().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), npc_anubarak_spike::CanPursue(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), spell_bonfires_blessing::CheckProc(), SpellInfo::CheckTarget(), CreatureGroup::GetNewTargetForMember(), WorldSession::HandleAttackSwingOpcode(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), IsTargetableAtRange(), CreatureGroup::MemberEngagingTarget(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::MySelectNextTarget(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestHostileUnitCheck::operator()(), MalleableGooSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), npc_pet_dk_army_of_the_dead::OwnerAttacked(), npc_pet_dk_army_of_the_dead::OwnerAttackedBy(), Player::SelectCharmedAIGroupTarget(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), CreatureAI::SetGazeOn(), StopAttackingInvalidTarget(), SimpleCharmedAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_putricide_mutated_abomination::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_warbear_matriarch::UpdateAI(), npc_pet_dk_ebon_gargoyle::UpdateAI(), npc_pet_dk_ghoul::UpdateAI(), PossessedAI::UpdateAI(), npc_pet_dk_army_of_the_dead::UpdateAI(), Player::UpdateCharmedAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ IsVehicle()

bool Unit::IsVehicle ( ) const
inline

References m_unitTypeMask, and UNIT_MASK_VEHICLE.

Referenced by Battleground::AddCreature(), Creature::AddToWorld(), ApplyResilience(), CanHaveThreatList(), spell_wintergrasp_water::CheckCast(), Spell::CheckEffectTarget(), SpellInfo::CheckTarget(), Map::CreatureRelocation(), DealDamage(), DealMeleeDamage(), MotionTransport::DelayedTeleportTransport(), Spell::EffectDummy(), Spell::EffectKnockBack(), Spell::EffectSummonType(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), SmartScript::GetTargets(), GetVelocity(), AuraEffect::HandleAuraControlVehicle(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugSetVehicleIdCommand(), spell_q13280_13283_plant_battle_standard::HandleDummy(), BattlefieldWG::HandleKill(), BattlegroundIC::HandleKillUnit(), WorldSession::HandlePetActionHelper(), spell_q12919_gymers_throw::HandleScript(), spell_putricide_mutated_transformation::HandleSummon(), TempSummon::InitStats(), KillRewarder::KillRewarder(), spell_igb_overheat_aura::Load(), WorldObject::MagicSpellHitResult(), SmartAI::OnCharmed(), BattlefieldWG::OnUnitDeath(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), OutDebugInfo(), VehicleAI::Permissible(), Map::PlayerRelocation(), SmartScript::ProcessAction(), RemoveCharmedBy(), RemoveFromWorld(), SetCharmedBy(), SetOwnerGUID(), SetSpeed(), Player::StopCastingCharm(), Map::SummonCreature(), UpdateCharmAI(), Creature::UpdateEntry(), UpdateHeight(), UpdateOrientation(), and UpdateSpeed().

◆ IsVendor()

◆ IsVisible()

bool Unit::IsVisible ( ) const
inline
@ SEC_PLAYER
Definition Common.h:57
@ SERVERSIDE_VISIBILITY_GM
Definition SharedDefines.h:1261
T_VALUES GetValue(FLAG_TYPE flag) const
Definition Object.h:404

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::GetValue(), WorldObject::m_serverSideVisibility, SEC_PLAYER, and SERVERSIDE_VISIBILITY_GM.

Referenced by npc_ghostly_priest::AttackStart(), npc_phantom_mage::AttackStart(), npc_shadowy_mercenary::AttackStart(), npc_spectral_footman::AttackStart(), npc_tortured_rifleman::AttackStart(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::CanAIAttack(), boss_professor_putricide::boss_professor_putricideAI::CanAIAttack(), boss_sindragosa::boss_sindragosaAI::CanAIAttack(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), SpellInfo::CheckTarget(), AuraEffect::HandlePhase(), Player::IsVisibleGloballyFor(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), Acore::AllFriendlyCreaturesInGrid::operator()(), boss_sapphiron::boss_sapphironAI::Reset(), npc_pos_leader::npc_pos_leaderAI::SetData(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), and boss_vazruden_the_herald::UpdateAI().

◆ IsWalking()

◆ IsWithinBoundaryRadius()

bool Unit::IsWithinBoundaryRadius ( Unit const *  obj) const
829{
830 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
831 return false;
832
833 float objBoundaryRadius = std::max(obj->GetBoundaryRadius(), MIN_MELEE_REACH);
834
835 return IsInDist(obj, objBoundaryRadius);
836}
bool IsInDist(float x, float y, float z, float dist) const
Definition Position.h:221

References GetBoundaryRadius(), WorldObject::InSamePhase(), Position::IsInDist(), WorldObject::IsInMap(), and MIN_MELEE_REACH.

Referenced by Spell::CheckRange(), Acore::WorldObjectSpellConeTargetCheck::operator()(), Player::Update(), npc_putricide_mutated_abomination::UpdateAI(), and npc_warbear_matriarch::UpdateAI().

◆ IsWithinCombatRange()

bool Unit::IsWithinCombatRange ( Unit const *  obj,
float  dist2compare 
) const
775{
776 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
777 return false;
778
779 float dx = GetPositionX() - obj->GetPositionX();
780 float dy = GetPositionY() - obj->GetPositionY();
781 float dz = GetPositionZ() - obj->GetPositionZ();
782 float distsq = dx * dx + dy * dy + dz * dz;
783
784 float sizefactor = GetCombatReach() + obj->GetCombatReach();
785 float maxdist = dist2compare + sizefactor;
786
787 return distsq < maxdist * maxdist;
788}

References GetCombatReach(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by ArcherAI::AttackStart(), TurretAI::CanAIAttack(), Spell::CheckRange(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), spell_nightbane_fireball_barrage::FilterTargets(), SmartScript::GetTargets(), npc_underbat::JustEngagedWith(), DefaultTargetSelector::operator()(), SpellTargetSelector::operator()(), PowerUsersSelector::operator()(), MalleableGooSelector::operator()(), ArcherAI::UpdateAI(), and boss_flame_leviathan::UpdateAI().

◆ IsWithinMeleeRange()

bool Unit::IsWithinMeleeRange ( Unit const *  obj,
float  dist = 0.f 
) const
791{
792 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
793 return false;
794
795 float dx = GetPositionX() - obj->GetPositionX();
796 float dy = GetPositionY() - obj->GetPositionY();
797 float dz = GetPositionZ() - obj->GetPositionZ();
798 float distsq = dx * dx + dy * dy + dz * dz;
799
800 float maxdist = dist + GetMeleeRange(obj);
801
802 maxdist += GetLeewayBonusRange(obj);
803
804 return distsq < maxdist * maxdist;
805}
float GetLeewayBonusRange(Unit const *target) const
Definition Object.cpp:1777

References WorldObject::GetLeewayBonusRange(), GetMeleeRange(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_marli::_chargePlayer(), boss_swamplord_muselek::AttackStart(), boss_ouro::CanAIAttack(), boss_alar::CanAIAttack(), PetAI::CanAttack(), Spell::CheckRange(), SmartAI::DistanceYourself(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), spell_shazzrah_gate_dummy::FilterTargets(), boss_supremus::FindHatefulStrikeTarget(), boss_thaddius::boss_thaddiusAI::IsAnyPlayerInMeleeRange(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::IsVictimWithinMeleeRange(), npc_overlord_drakuru_betrayal::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_vem::JustEngagedWith(), CreatureAI::MoveCircleChecks(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), SpellTargetSelector::operator()(), MysticBuffetTargetFilter::operator()(), SmartScript::ProcessEvent(), ThreatManager::ReselectVictim(), npc_scrapbot::Reset(), npc_boombot::Reset(), npc_snobold_vassal::npc_snobold_vassalAI::ReturnToGormok(), spell_patchwerk_hateful_strike_primer::SelectTargets(), boss_murmur::ShouldCastResonance(), boss_quartermaster_zigris::SpellHitTarget(), npc_onyxian_whelp::TeleportIfVictimUnreachable(), Player::Update(), boss_quartermaster_zigris::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_skeram::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_bronjahm::UpdateAI(), boss_marwyn::UpdateAI(), npc_hor_lumbering_abomination::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_kologarn::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), PetAI::UpdateAI(), npc_dark_fiend::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::UpdateAI(), and SmartAI::UpdateMeleeStance().

◆ IsWithinRange()

bool Unit::IsWithinRange ( Unit const *  obj,
float  dist 
) const
814{
815 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
816 {
817 return false;
818 }
819
820 auto dx = GetPositionX() - obj->GetPositionX();
821 auto dy = GetPositionY() - obj->GetPositionY();
822 auto dz = GetPositionZ() - obj->GetPositionZ();
823 auto distsq = dx * dx + dy * dy + dz * dz;
824
825 return distsq <= dist * dist;
826}

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_swamplord_muselek::CanShootVictim(), Spell::CheckRange(), npc_sunblade_scout::JustEngagedWith(), and npc_amanishi_scout::JustEngagedWith().

◆ JumpTo() [1/2]

void Unit::JumpTo ( float  speedXY,
float  speedZ,
bool  forward = true 
)
15199{
15200 float angle = forward ? 0 : M_PI;
15201 if (IsCreature())
15202 GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
15203 else
15204 {
15205 float vcos = cos(angle + GetOrientation());
15206 float vsin = std::sin(angle + GetOrientation());
15207
15208 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
15209 data << GetPackGUID();
15210 data << uint32(0); // Sequence
15211 data << float(vcos); // x direction
15212 data << float(vsin); // y direction
15213 data << float(speedXY); // Horizontal speed
15214 data << float(-speedZ); // Z Movement speed (vertical)
15215
15216 ToPlayer()->SendDirectMessage(&data);
15217 }
15218}
void MoveJumpTo(float angle, float speedXY, float speedZ)
The unit will jump in a specific direction.
Definition MotionMaster.cpp:659
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5896
@ SMSG_MOVE_KNOCK_BACK
Definition Opcodes.h:269

References GetMotionMaster(), Position::GetOrientation(), Object::GetPackGUID(), Object::IsCreature(), MotionMaster::MoveJumpTo(), Player::SendDirectMessage(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by Spell::EffectLeapBack().

◆ JumpTo() [2/2]

void Unit::JumpTo ( WorldObject *  obj,
float  speedZ 
)
15221{
15222 float x, y, z;
15223 obj->GetContactPoint(this, x, y, z);
15224 float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
15225 GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
15226}
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition MotionMaster.h:257
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition Object.cpp:2875

References WorldObject::GetContactPoint(), Position::GetExactDist2d(), GetMotionMaster(), and MotionMaster::MoveJump().

◆ Kill()

void Unit::Kill ( Unit *  killer,
Unit *  victim,
bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
static
Todo:
: do instance binding anyway if the charmer/owner is offline
13668{
13669 // Prevent killing unit twice (and giving reward from kill twice)
13670 if (!victim->GetHealth())
13671 return;
13672
13673 if (killer && !killer->IsInMap(victim))
13674 killer = nullptr;
13675
13676 // find player: owner of controlled `this` or `this` itself maybe
13677 Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr;
13678 Creature* creature = victim->ToCreature();
13679
13680 bool isRewardAllowed = true;
13681 if (creature)
13682 {
13683 isRewardAllowed = (creature->IsDamageEnoughForLootingAndReward() && !creature->IsLootRewardDisabled());
13684 if (!isRewardAllowed)
13685 creature->SetLootRecipient(nullptr);
13686 }
13687
13688 // pussywizard: remade this if section (player is on the same map
13689 if (isRewardAllowed && creature)
13690 {
13691 Player* lr = creature->GetLootRecipient();
13692 if (lr && lr->IsInMap(creature))
13693 player = creature->GetLootRecipient();
13694 else if (Group* lrg = creature->GetLootRecipientGroup())
13695 for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next())
13696 if (Player* member = itr->GetSource())
13697 if (member->IsAtLootRewardDistance(creature))
13698 {
13699 player = member;
13700 break;
13701 }
13702 }
13703
13704 // Exploit fix
13705 if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
13706 isRewardAllowed = false;
13707
13708 // Reward player, his pets, and group/raid members
13709 // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
13710 if (isRewardAllowed && player && player != victim)
13711 {
13712 WorldPacket data(SMSG_PARTYKILLLOG, (8 + 8)); // send event PARTY_KILL
13713 data << player->GetGUID(); // player with killing blow
13714 data << victim->GetGUID(); // victim
13715
13716 Player* looter = player;
13717 Group* group = player->GetGroup();
13718 bool hasLooterGuid = false;
13719
13720 if (group)
13721 {
13722 group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
13723
13724 if (creature)
13725 {
13726 group->UpdateLooterGuid(creature, true);
13727 if (group->GetLooterGuid() && group->GetLootMethod() != FREE_FOR_ALL)
13728 {
13729 looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
13730 if (looter)
13731 {
13732 hasLooterGuid = true;
13733 creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
13734 }
13735 }
13736 }
13737 }
13738 else
13739 {
13740 player->SendDirectMessage(&data);
13741
13742 if (creature)
13743 {
13744 WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
13745 data2 << creature->GetGUID();
13746 data2 << uint8(0); // unk1
13747 data2 << uint8(0); // no group looter
13748 player->SendMessageToSet(&data2, true);
13749 }
13750 }
13751
13752 // Generate loot before updating looter
13753 if (creature)
13754 {
13755 Loot* loot = &creature->loot;
13756 loot->clear();
13757
13758 if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
13759 loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode(), creature);
13760
13761 if (creature->GetLootMode())
13763
13764 if (group)
13765 {
13766 if (hasLooterGuid)
13767 group->SendLooter(creature, looter);
13768 else
13769 group->SendLooter(creature, nullptr);
13770
13771 // Update round robin looter only if the creature had loot
13772 if (!creature->loot.empty())
13773 group->UpdateLooterGuid(creature);
13774 }
13775 }
13776
13777 player->RewardPlayerAndGroupAtKill(victim, false);
13778 }
13779
13780 // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
13781 // Spell context is not passed to avoid the killing spell's triggered status from suppressing nested proc events
13782 if (killer && (killer->IsPet() || killer->IsTotem()))
13783 if (Unit* owner = killer->GetOwner())
13784 {
13785 Unit::ProcSkillsAndAuras(owner, victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, nullptr, nullptr, -1, nullptr);
13786 sScriptMgr->OnPlayerCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
13787 }
13788
13789 if (killer != victim)
13790 {
13791 Unit::ProcSkillsAndAuras(killer, victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, nullptr, nullptr, -1, nullptr);
13792 }
13793
13794 // Proc auras on death - must be before aura/combat remove
13795 Unit::ProcSkillsAndAuras(victim, nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, nullptr, nullptr, -1, nullptr);
13796
13797 // update get killing blow achievements, must be done before setDeathState to be able to require auras on target
13798 // and before Spirit of Redemption as it also removes auras
13799 if (killer)
13800 if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
13801 killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
13802
13803 // Spirit of Redemption
13804 // if talent known but not triggered (check priest class for speedup check)
13805 bool spiritOfRedemption = false;
13807 {
13808 if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
13809 {
13810 // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
13811 if (victim->HasSpiritOfRedemptionAura() || victim->HasAura(27827))
13812 {
13813 /*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
13814 victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
13815 victim->GetPositionY(), victim->GetPositionZ());
13816
13817 ACE_Stack_Trace trace(0, 50);
13818 LOG_INFO("misc", "TRACE: {}\n\n", trace);*/
13819 }
13820 else
13821 {
13822 // save value before aura remove
13823 uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
13824 if (!ressSpellId)
13825 ressSpellId = victim->ToPlayer()->GetResurrectionSpellId();
13826
13827 //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
13828 victim->RemoveAllAurasOnDeath();
13829
13830 // Stop attacks - units in pvp combat with us keep a full pvp timeout, as on a real death
13832 victim->CombatStop(false, /*mutualPvP*/ true, /*keepPvPForOthers*/ true);
13833
13834 // restore for use at real death
13835 victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
13836
13837 // FORM_SPIRITOFREDEMPTION and related auras
13838 victim->CastSpell(victim, 27827, true, nullptr, aurEff);
13839 spiritOfRedemption = true;
13840 }
13841 }
13842 }
13843
13844 if (!spiritOfRedemption)
13845 {
13846 LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
13848 }
13849
13850 // Inform pets (if any) when player kills target)
13851 // MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
13852 // selection will get stuck on same target and break pet react state
13853 if (player)
13854 {
13855 Pet* pet = player->GetPet();
13856 if (pet && pet->IsAlive() && pet->isControlled())
13857 pet->AI()->KilledUnit(victim);
13858 }
13859
13860 // 10% durability loss on death
13861 // clean InHateListOf
13862 if (Player* plrVictim = victim->ToPlayer())
13863 {
13864 // remember victim PvP death for corpse type and corpse reclaim delay
13865 // at original death (not at SpiritOfRedemtionTalent timeout)
13866 plrVictim->SetPvPDeath(player != nullptr);
13867
13868 // only if not player and not controlled by player pet. And not at BG
13869 if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
13870 {
13871 LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f);
13872 plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH) / 100.0f, false);
13873 // durability lost message
13874 plrVictim->SendDurabilityLoss();
13875 }
13876 // Call KilledUnit for creatures
13877 if (killer && killer->IsCreature() && killer->IsAIEnabled)
13878 killer->ToCreature()->AI()->KilledUnit(victim);
13879
13880 // last damage from non duel opponent or opponent controlled creature
13881 if (plrVictim->duel)
13882 {
13883 plrVictim->duel->Opponent->CombatStopWithPets(true);
13884 plrVictim->CombatStopWithPets(true);
13885 plrVictim->DuelComplete(DUEL_INTERRUPTED);
13886 }
13887 }
13888 else // creature died
13889 {
13890 LOG_DEBUG("entities.unit", "DealDamageNotPlayer");
13891
13892 if (!creature->IsPet() && creature->GetLootMode() > 0)
13893 {
13894 // must be after setDeathState which resets dynamic flags
13895 if (!creature->loot.isLooted())
13896 {
13898 }
13899 else
13900 {
13901 creature->AllLootRemovedFromCorpse();
13902 }
13903 }
13904
13905 // Call KilledUnit for creatures, this needs to be called after the lootable flag is set
13906 if (killer && killer->IsCreature() && killer->IsAIEnabled)
13907 killer->ToCreature()->AI()->KilledUnit(victim);
13908
13909 // Call creature just died function
13910 if (CreatureAI* ai = creature->AI())
13911 {
13912 ai->JustDied(killer);
13913 }
13914
13915 if (TempSummon* summon = creature->ToTempSummon())
13916 {
13917 if (WorldObject* summoner = summon->GetSummoner())
13918 {
13919 if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
13920 {
13921 summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
13922 }
13923 else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
13924 {
13925 summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
13926 }
13927 }
13928 }
13929
13930 if (player)
13931 sScriptMgr->OnPlayerCreatureKillCredit(player, creature);
13932
13933 // Dungeon specific stuff, only applies to players killing creatures
13934 if (creature->GetInstanceId())
13935 {
13936 Map* instanceMap = creature->GetMap();
13937 //Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
13939
13940 if (instanceMap->IsDungeon() && player)
13941 if (instanceMap->IsRaidOrHeroicDungeon())
13943 instanceMap->ToInstanceMap()->PermBindAllPlayers();
13944 }
13945 }
13946
13947 // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
13948 // handle player kill only if not suicide (spirit of redemption for example)
13949 if (player && killer != victim)
13950 {
13951 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
13952 pvp->HandleKill(player, victim);
13953
13954 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
13955 bf->HandleKill(player, victim);
13956 }
13957
13958 //if (victim->IsPlayer())
13959 // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
13960 // pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
13961
13962 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
13963 if (player)
13964 if (Battleground* bg = player->GetBattleground())
13965 {
13966 if (victim->IsPlayer())
13967 bg->HandleKillPlayer(victim->ToPlayer(), player);
13968 else
13969 bg->HandleKillUnit(victim->ToCreature(), player);
13970 }
13971
13972 // achievement stuff
13973 if (killer && victim->IsPlayer())
13974 {
13975 if (killer->IsCreature())
13977 else if (victim != killer && killer->IsPlayer())
13979 }
13980
13981 // Hook for OnPVPKill Event
13982 if (killer)
13983 {
13984 if (Player* killerPlr = killer->ToPlayer())
13985 {
13986 if (Player* killedPlr = victim->ToPlayer())
13987 sScriptMgr->OnPlayerPVPKill(killerPlr, killedPlr);
13988 else if (Creature* killedCre = victim->ToCreature())
13989 sScriptMgr->OnPlayerCreatureKill(killerPlr, killedCre);
13990 }
13991 else if (Creature* killerCre = killer->ToCreature())
13992 {
13993 if (Player* killed = victim->ToPlayer())
13994 sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
13995 }
13996 }
13997
13998 sScriptMgr->OnUnitDeath(victim, killer);
13999}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:79
@ CREATURE_FLAG_EXTRA_INSTANCE_BIND
Definition CreatureData.h:46
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
Definition DBCEnums.h:138
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE
Definition DBCEnums.h:137
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition DBCEnums.h:170
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
@ FREE_FOR_ALL
Definition LootMgr.h:58
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition Player.h:473
@ UNIT_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3354
@ DUEL_INTERRUPTED
Definition SharedDefines.h:3868
@ CLASS_PRIEST
Definition SharedDefines.h:130
@ PROC_EX_NONE
Definition SpellMgr.h:198
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146
@ PROC_FLAG_KILL
Definition SpellMgr.h:111
@ PLAYER_SELF_RES_SPELL
Definition UpdateFields.h:370
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition WorldConfig.h:494
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition WorldConfig.h:25
Definition Battlefield.h:196
void RestartPvPCombatTimers()
Definition CombatManager.cpp:338
virtual void KilledUnit(Unit *)
Definition CreatureAI.h:149
Loot loot
Definition Creature.h:231
uint16 GetLootMode() const
Definition Creature.h:245
void AllLootRemovedFromCorpse()
Definition Creature.cpp:3200
bool IsLootRewardDisabled() const
Definition Creature.h:381
Player * GetLootRecipient() const
Definition Creature.cpp:1309
bool IsDamageEnoughForLootingAndReward() const
Definition Creature.cpp:3931
Group * GetLootRecipientGroup() const
Definition Creature.cpp:1316
GroupReference * next()
Definition GroupReference.h:36
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition Group.cpp:1992
uint8 GetMemberGroup(ObjectGuid guid) const
Definition Group.cpp:2626
ObjectGuid GetLooterGuid() const
Definition Group.cpp:2563
LootMethod GetLootMethod() const
Definition Group.cpp:2558
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition Group.cpp:2103
void SendLooter(Creature *creature, Player *pLooter)
Definition Group.cpp:1114
void PermBindAllPlayers()
Definition Map.cpp:2280
Definition Map.h:168
bool IsRaidOrHeroicDungeon() const
Definition Map.h:302
InstanceMap * ToInstanceMap()
Definition Map.h:390
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:131
Definition OutdoorPvP.h:188
TeamId GetTeamId(bool original=false) const
Definition Player.h:2140
Pet * GetPet() const
Definition Player.cpp:9201
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12513
uint32 GetResurrectionSpellId()
Definition Player.cpp:13001
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:12850
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition Player.cpp:13115
void RemoveAllAurasOnDeath()
Definition Unit.cpp:5440
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5644
uint32 GetInstanceId() const
Definition Object.h:520
uint32 GetZoneId() const
Definition Object.cpp:3178
@ SMSG_PARTYKILLLOG
Definition Opcodes.h:531
@ SMSG_LOOT_LIST
Definition Opcodes.h:1047
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:269
uint32 mingold
Definition CreatureData.h:227
uint32 maxgold
Definition CreatureData.h:228
uint32 lootid
Definition CreatureData.h:220
Definition LootMgr.h:313
bool empty() const
Definition LootMgr.h:367
bool isLooted() const
Definition LootMgr.h:368
void clear()
Definition LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition LootMgr.cpp:808
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition LootMgr.cpp:540

References ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, Creature::AI(), Creature::AllLootRemovedFromCorpse(), Group::BroadcastPacket(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_PRIEST, Loot::clear(), CombatStop(), CONFIG_DURABILITY_LOSS_IN_PVP, CREATURE_FLAG_EXTRA_INSTANCE_BIND, DUEL_INTERRUPTED, Loot::empty(), Loot::FillLoot(), ObjectAccessor::FindPlayer(), FREE_FOR_ALL, Loot::generateMoneyLoot(), GetAuraEffectDummy(), Player::GetBattleground(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCombatManager(), Creature::GetCreatureTemplate(), Object::GetEntry(), Player::GetGroup(), Object::GetGUID(), GetHealth(), WorldObject::GetInstanceId(), Group::GetLooterGuid(), Group::GetLootMethod(), Creature::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), WorldObject::GetMap(), Group::GetMemberGroup(), Player::GetOutdoorPvP(), GetOwner(), GetOwnerGUID(), Player::GetPet(), Player::GetResurrectionSpellId(), Player::GetTeamId(), Object::GetUInt32Value(), WorldObject::GetZoneId(), HasAura(), Creature::HasFlagsExtra(), Player::HasPlayerFlag(), HasSpiritOfRedemptionAura(), Player::InBattleground(), IsAIEnabled, IsAlive(), IsClass(), Pet::isControlled(), Object::IsCreature(), Creature::IsDamageEnoughForLootingAndReward(), Map::IsDungeon(), WorldObject::IsInMap(), Loot::isLooted(), Creature::IsLootRewardDisabled(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), Map::IsRaidOrHeroicDungeon(), IsTotem(), JustDied, CreatureAI::KilledUnit(), LOG_DEBUG, Creature::loot, CreatureTemplate::lootid, LootTemplates_Creature, CreatureTemplate::maxgold, CreatureTemplate::mingold, GroupReference::next(), InstanceMap::PermBindAllPlayers(), PLAYER_FLAGS_IS_OUT_OF_BOUNDS, PLAYER_SELF_RES_SPELL, PROC_EX_NONE, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_NONE, ProcSkillsAndAuras(), RATE_DURABILITY_LOSS_ON_DEATH, RemoveAllAurasOnDeath(), CombatManager::RestartPvPCombatTimers(), Player::RewardPlayerAndGroupAtKill(), sBattlefieldMgr, Player::SendDirectMessage(), Group::SendLooter(), Player::SendMessageToSet(), setDeathState(), Object::SetDynamicFlag(), Creature::SetLootRecipient(), SetUInt32Value(), SMSG_LOOT_LIST, SMSG_PARTYKILLLOG, sScriptMgr, sWorld, Object::ToCreature(), Map::ToInstanceMap(), Object::ToPlayer(), ToTempSummon(), UNIT_DYNFLAG_LOOTABLE, Player::UpdateAchievementCriteria(), and Group::UpdateLooterGuid().

Referenced by boss_headless_horseman_head::DamageTaken(), boss_viscidus::DamageTaken(), boss_yoggsaron_brain::DamageTaken(), DealDamage(), boss_jedoga_shadowseeker::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_illidari_council::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), DeathEvent::Execute(), BattlegroundIC::HandleCapturedNodes(), misc_commandscript::HandleDieCommand(), spell_ooze_zap_channel_end::HandleDummy(), spell_pos_rimefang_frost_nova::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_yogg_saron_titanic_storm::HandleDummyEffect(), spell_item_rocket_chicken::HandleDummyTick(), spell_ulduar_arachnopod_damaged_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_teron_gorefiend_spiritual_vengeance::HandleEffectRemove(), spell_chapter2_persuasive_strike::HandleHit(), spell_voa_overcharge_aura::HandlePeriodicDummy(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_ignis_brittle_aura::HandleProc(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_leotheras_clear_consuming_madness::HandleScriptEffect(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_sister_svalna::boss_sister_svalnaAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), boss_ahune::JustDied(), npc_frozen_core::JustDied(), boss_twinemperorsAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), instance_nexus::instance_nexus_InstanceMapScript::KillAllFrayers(), KillSelf(), boss_buru::ManipulateEggs(), npc_burning_spirit::MovementInform(), spell_q12779_an_end_to_all_things_devour_aura::OnRemove(), spell_yogg_saron_insane_aura::OnRemove(), WretchedGhoulCleaner::operator()(), npc_ulduar_leviathan_mkii::PassengerBoarded(), SmartScript::ProcessAction(), instance_halls_of_reflection::RandomizeCompositionsAndShow(), boss_xt002::SetData(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_trial_of_the_crusader::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), SimpleCharmedAI::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::UpdateAI(), npc_vh_teleportation_portal::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ KillSelf()

void Unit::KillSelf ( bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
inline
1252{ Kill(this, this, durabilityLoss, attackType, spellProto, spell); };

References Kill().

Referenced by boss_yoggsaron_guardian_of_ys::DamageTaken(), boss_yoggsaron::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_kiljaeden::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::DoAction(), boss_illidari_council::DoAction(), npc_raging_flames::FixateRandomTarget(), spell_forgiveness_dummy_visual::HandleDummy(), spell_chapter2_persuasive_strike::HandleHit(), npc_rancid_mushroom::InitializeAI(), boss_warlord_kalithresh::JustDied(), npc_koltira_deathweaver::MovementInform(), npc_wild_wyrm::MovementInform(), npc_pet_gen_plump_turkey::MovementInform(), npc_announcer_toc5::MovementInform(), boss_glob_of_viscidus::MovementInform(), SmartScript::ProcessAction(), npc_singularity::Reset(), boss_archimonde::Reset(), boss_kologarn_pit_kill_bunny::Reset(), npc_target_dummy::Reset(), npc_necropolis_health::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), npc_necrotic_shard::SpellHit(), boss_victor_nefarius::SummonedCreatureDies(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDies(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::SummonedCreatureDies(), boss_vazruden_the_herald::SummonedCreatureDies(), npc_warden_mellichar::npc_warden_mellicharAI::SummonedCreatureDies(), npc_brewfest_super_brew_trigger::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_vh_void_sentry::UpdateAI(), and npc_frost_tomb::UpdateAI().

◆ KnockbackFrom()

void Unit::KnockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)
15090{
15091 Player* player = ToPlayer();
15092 if (!player)
15093 {
15094 if (Unit* charmer = GetCharmer())
15095 {
15096 player = charmer->ToPlayer();
15097 if (player && player->m_mover != this)
15098 player = nullptr;
15099 }
15100 }
15101
15102 // While feared/confused the client has no control over the unit,
15103 // so a SMSG_MOVE_KNOCK_BACK would be ignored or immediately overridden by the server
15104 // side fleeing/confused splines. Perform the knockback server side instead; the
15105 // fleeing/confused movement generator resumes once this spline is finalized
15106 if (!player || !IsClientControlled())
15107 GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
15108 else
15109 {
15110 float vcos, vsin;
15111 GetSinCos(x, y, vsin, vcos);
15112
15113 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
15114 data << GetPackGUID();
15115 data << player->GetSession()->GetOrderCounter(); // movement counter
15116 data << float(vcos); // x direction
15117 data << float(vsin); // y direction
15118 data << float(speedXY); // Horizontal speed
15119 data << float(-speedZ); // Z Movement speed (vertical)
15120
15121 player->SendDirectMessage(&data);
15122 player->GetSession()->IncrementOrderCounter();
15123
15124 player->SetCanKnockback(true);
15125 }
15126}
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, bool allowClientControlled=false)
Definition MotionMaster.cpp:620
SafeUnitPointer m_mover
Definition Player.h:2377
void SetCanKnockback(bool value)
Definition Player.h:2546
WorldSession * GetSession() const
Definition Player.h:2032
uint32 GetOrderCounter() const
Definition WorldSession.h:688
void IncrementOrderCounter()
Definition WorldSession.h:689
void GetSinCos(float x, float y, float &vsin, float &vcos) const
Definition Position.cpp:99

References GetCharmer(), GetMotionMaster(), WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetSession(), Position::GetSinCos(), WorldSession::IncrementOrderCounter(), IsClientControlled(), Player::m_mover, MotionMaster::MoveKnockbackFrom(), Player::SendDirectMessage(), Player::SetCanKnockback(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by _ExitVehicle(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), Spell::EffectKnockBack(), spell_warhead_detonate::HandleDummy(), npc_vekjik::OnGossipSelect(), and npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI().

◆ MeleeDamageBonusDone()

uint32 Unit::MeleeDamageBonusDone ( Unit *  pVictim,
uint32  damage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
9982{
9983 if (!victim || pdamage == 0)
9984 return 0;
9985
9986 if (IsCreature())
9987 {
9988 // Dancing Rune Weapon...
9989 if (GetEntry() == 27893)
9990 {
9991 if (Unit* owner = GetOwner())
9992 return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto, damageSchoolMask) / 2;
9993 }
9994 }
9995
9996 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
9997
9998 // Done fixed damage bonus auras
9999 int32 DoneFlatBenefit = 0;
10000
10001 // ..done
10002 DoneFlatBenefit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, creatureTypeMask);
10003
10004 // ..done
10005 // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
10006
10007 // ..done (base at attack power for marked target and base at attack power for creature type)
10008 int32 APbonus = 0;
10009
10010 if (attType == RANGED_ATTACK)
10011 {
10012 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
10013
10014 // ..done (base at attack power and creature type)
10016 }
10017 else
10018 {
10019 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
10020
10021 // ..done (base at attack power and creature type)
10023 }
10024
10025 if (APbonus != 0) // Can be negative
10026 {
10027 bool normalized = false;
10028 if (spellProto)
10029 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
10030 if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
10031 {
10032 normalized = true;
10033 break;
10034 }
10035 DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
10036 }
10037
10038 // Done total percent damage auras
10039 float DoneTotalMod = 1.0f;
10040
10041 // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
10042 if (!(damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL))
10043 {
10044 // Some spells don't benefit from pct done mods
10045 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [spellProto, this, damageSchoolMask](AuraEffect const* aurEff)
10046 {
10047 if (!spellProto || (spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)))
10048 {
10049 if ((aurEff->GetMiscValue() & damageSchoolMask))
10050 {
10051 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
10052 return true;
10053 else if (!aurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && (aurEff->GetSpellInfo()->EquippedItemSubClassMask == 0))
10054 return true;
10055 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
10056 return true;
10057 }
10058 }
10059 return false;
10060 });
10061 }
10062
10063 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, [creatureTypeMask, spellProto, this](AuraEffect const* aurEff)
10064 {
10065 return (creatureTypeMask & aurEff->GetMiscValue() && (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)));
10066 });
10067
10068 // bonus against aurastate
10069 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim, spellProto, this](AuraEffect const* aurEff)
10070 {
10071 return (victim->HasAuraState(AuraStateType(aurEff->GetMiscValue())) && (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, false)));
10072 });
10073
10074 // done scripted mod (take it from owner)
10075 Unit* owner = GetOwner() ? GetOwner() : this;
10076 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
10077 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
10078 {
10079 if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
10080 continue;
10081
10082 if (!(*i)->IsAffectedOnSpell(spellProto))
10083 continue;
10084
10085 switch ((*i)->GetMiscValue())
10086 {
10087 // Tundra Stalker
10088 // Merciless Combat
10089 case 7277:
10090 {
10091 // Merciless Combat
10092 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
10093 {
10094 if (!victim->HealthAbovePct(35))
10095 AddPct(DoneTotalMod, (*i)->GetAmount());
10096 }
10097 // Tundra Stalker
10098 else
10099 {
10100 // Frost Fever (target debuff)
10101 if (victim->HasAura(55095))
10102 AddPct(DoneTotalMod, (*i)->GetAmount());
10103 }
10104 break;
10105 }
10106 // Rage of Rivendare
10107 case 7293:
10108 {
10109 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
10110 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
10111 break;
10112 }
10113 // Marked for Death
10114 case 7598:
10115 case 7599:
10116 case 7600:
10117 case 7601:
10118 case 7602:
10119 {
10120 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
10121 AddPct(DoneTotalMod, (*i)->GetAmount());
10122 break;
10123 }
10124 // Dirty Deeds
10125 case 6427:
10126 case 6428:
10127 {
10128 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
10129 {
10130 // effect 0 has expected value but in negative state
10131 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
10132 AddPct(DoneTotalMod, bonus);
10133 }
10134 break;
10135 }
10136 }
10137 }
10138
10139 // Custom scripted damage
10140 if (spellProto)
10141 switch (spellProto->SpellFamilyName)
10142 {
10144 // Glacier Rot
10145 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
10147 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
10148 AddPct(DoneTotalMod, aurEff->GetAmount());
10149 break;
10150 }
10151
10152 // Some spells don't benefit from done mods
10153 if (spellProto)
10154 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
10155 {
10156 DoneFlatBenefit = 0;
10157 DoneTotalMod = 1.0f;
10158 }
10159
10160 float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
10161
10162 // apply spellmod to Done damage
10163 if (spellProto)
10164 if (Player* modOwner = GetSpellModOwner())
10165 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
10166
10167 // bonus result can be negative
10168 return uint32(std::max(tmpDamage, 0.0f));
10169}
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition SharedDefines.h:887
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition SharedDefines.h:510
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3793
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3799
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition SharedDefines.h:1293
@ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:165
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
Definition SpellAuraDefines.h:231
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:194
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE
Definition SpellAuraDefines.h:366
@ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Definition SpellAuraDefines.h:122
@ SPELLMOD_DAMAGE
Definition SpellDefines.h:84
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition Unit.cpp:13322
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1454

References SpellInfo::Effects, GetAPMultiplier(), GetCreatureTypeMask(), Object::GetEntry(), GetOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), Object::IsCreature(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_SCHOOL_MASK_NORMAL, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeDamageBonusTaken()

uint32 Unit::MeleeDamageBonusTaken ( Unit *  attacker,
uint32  pdamage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
10172{
10173 if (pdamage == 0)
10174 return 0;
10175
10176 int32 TakenFlatBenefit = 0;
10177
10178 // ..taken
10179 TakenFlatBenefit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, damageSchoolMask);
10180
10181 if (attType != RANGED_ATTACK)
10183 else
10185
10186 // Taken total percent damage auras
10187 float TakenTotalMod = 1.0f;
10188
10190
10191 // .. taken pct (special attacks)
10192 if (spellProto)
10193 {
10194 // From caster spells
10195 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [attacker, spellProto](AuraEffect const* aurEff)
10196 {
10197 return attacker->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectedOnSpell(spellProto);
10198 });
10199
10200 // Mod damage from spell mechanic
10201 uint64 mechanicMask = spellProto->GetAllEffectsMechanicMask();
10202
10203 // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
10204 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
10205 mechanicMask |= (1ULL << MECHANIC_BLEED);
10206
10207 if (mechanicMask)
10208 {
10209 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, [mechanicMask](AuraEffect const* aurEff) -> bool
10210 {
10211 if (mechanicMask & (1ULL << (aurEff->GetMiscValue())))
10212 return true;
10213 return false;
10214 });
10215 }
10216 }
10217
10218 TakenTotalMod = processDummyAuras(TakenTotalMod);
10219
10220 // .. taken pct: class scripts
10221 /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
10222 for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
10223 {
10224 switch ((*i)->GetMiscValue())
10225 {
10226 }
10227 }*/
10228
10229 if (attType != RANGED_ATTACK)
10230 {
10232 }
10233 else
10234 {
10236 }
10237
10238 // No positive taken bonus, custom attr
10239 if (spellProto)
10240 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
10241 {
10242 TakenFlatBenefit = 0;
10243 TakenTotalMod = 1.0f;
10244 }
10245
10246 // Sanctified Wrath (bypass damage reduction)
10247 if (TakenTotalMod < 1.0f && attacker->HasIgnoreTargetResistModifiersAura())
10248 {
10249 float damageModifier = 1.0f - TakenTotalMod;
10251 if (aurEff->GetMiscValue() & damageSchoolMask)
10252 AddPct(damageModifier, -aurEff->GetAmount());
10253
10254 TakenTotalMod = 1.0f - damageModifier;
10255 }
10256
10257 float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
10258
10259 // bonus result can be negative
10260 return uint32(std::max(tmpDamage, 0.0f));
10261}
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3791
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN
Definition SpellAuraDefines.h:176
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition SpellAuraDefines.h:150
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN
Definition SpellAuraDefines.h:188
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:189
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition SpellAuraDefines.h:77
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition SpellAuraDefines.h:334
@ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
Definition SpellAuraDefines.h:318
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:177
@ SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS
Definition SpellInfo.h:198
float processDummyAuras(float TakenTotalMod) const
Definition Unit.cpp:8830
bool HasIgnoreTargetResistModifiersAura() const
Definition Unit.h:1847

References AddPct(), SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistModifiersAura(), AuraEffect::IsAffectedOnSpell(), MECHANIC_BLEED, processDummyAuras(), RANGED_ATTACK, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST_MODIFIERS, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeSpellHitResult()

SpellMissInfo Unit::MeleeSpellHitResult ( Unit *  victim,
SpellInfo const *  spell 
)
overridevirtual

Reimplemented from WorldObject.

3353{
3354 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3355 // resist and deflect chances
3356 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3357 return SPELL_MISS_NONE;
3358
3359 WeaponAttackType attType = BASE_ATTACK;
3360
3361 // Check damage class instead of attack type to correctly handle judgements
3362 // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class
3363 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
3364 attType = RANGED_ATTACK;
3365
3366 int32 attackerWeaponSkill;
3367 // skill value for these spells (for example judgements) is 5* level
3368 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
3369 attackerWeaponSkill = GetLevel() * 5;
3370 // bonus from skills is 0.04% per skill Diff
3371 else
3372 attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
3373
3374 int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
3375
3376 uint32 roll = urand (0, 10000);
3377
3378 uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spellInfo->Id) * 100.0f);
3379 // Roll miss
3380 uint32 tmp = missChance;
3381 if (roll < tmp)
3382 return SPELL_MISS_MISS;
3383
3384 bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE);
3385 bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY);
3386 bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED) && !spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE);
3387
3388 // Same spells cannot be parry/dodge
3389 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3390 return SPELL_MISS_NONE;
3391
3392 // Chance resist mechanic
3393 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3394 tmp += resist_chance;
3395 if (roll < tmp)
3396 return SPELL_MISS_RESIST;
3397
3398 // Ranged attacks can only miss, resist and deflect
3399 if (attType == RANGED_ATTACK)
3400 {
3401 // only if in front
3402 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
3403 {
3404 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3405 tmp += deflect_chance;
3406 if (roll < tmp)
3407 return SPELL_MISS_DEFLECT;
3408 }
3409
3410 canDodge = false;
3411 canParry = false;
3412 }
3413
3414 // Check for attack from behind
3415 // xinef: if from behind or spell requires cast from behind
3416 if (!victim->HasInArc(M_PI, this))
3417 {
3418 if (!victim->HasIgnoreHitDirectionAura() || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
3419 {
3420 // Can`t dodge from behind in PvP (but its possible in PvE)
3421 if (victim->IsPlayer())
3422 {
3423 canDodge = false;
3424 }
3425
3426 // Can`t parry or block
3427 canParry = false;
3428 canBlock = false;
3429 }
3430 }
3431
3432 // Check creatures flags_extra for disable parry
3433 if (victim->IsCreature())
3434 {
3435 uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
3436 // Xinef: no dodge flag
3437 if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE)
3438 canDodge = false;
3439 if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
3440 canParry = false;
3441 // Check creatures flags_extra for disable block
3442 if (flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK)
3443 canBlock = false;
3444 }
3445 // Ignore combat result aura
3447 for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
3448 {
3449 if (!(*i)->IsAffectedOnSpell(spellInfo))
3450 continue;
3451 switch ((*i)->GetMiscValue())
3452 {
3453 case MELEE_HIT_DODGE:
3454 canDodge = false;
3455 break;
3456 case MELEE_HIT_BLOCK:
3457 canBlock = false;
3458 break;
3459 case MELEE_HIT_PARRY:
3460 canParry = false;
3461 break;
3462 default:
3463 LOG_DEBUG("entities.unit", "Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", (*i)->GetId(), (*i)->GetMiscValue());
3464 break;
3465 }
3466 }
3467
3468 if (canDodge)
3469 {
3470 // Roll dodge
3471 int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
3472 // Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3474 dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3475 // Reduce dodge chance by attacker expertise rating
3476 if (IsPlayer())
3477 dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3478 else
3480
3481 // xinef: cant dodge while casting or while stunned
3482 if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3483 dodgeChance = 0;
3484
3485 tmp += dodgeChance;
3486 if (roll < tmp)
3487 return SPELL_MISS_DODGE;
3488 }
3489
3490 if (canParry)
3491 {
3492 // Roll parry
3493 int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
3494 // Reduce parry chance by attacker expertise rating
3495 if (IsPlayer())
3496 parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3497 else
3499
3500 // xinef: cant parry while casting or while stunned
3501 if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3502 parryChance = 0;
3503
3504 tmp += parryChance;
3505 if (roll < tmp)
3506 return SPELL_MISS_PARRY;
3507 }
3508
3509 if (canBlock)
3510 {
3511 int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
3512
3513 // xinef: cant block while casting or while stunned
3514 if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3515 blockChance = 0;
3516
3517 tmp += blockChance;
3518 if (roll < tmp)
3519 return SPELL_MISS_BLOCK;
3520 }
3521
3522 return SPELL_MISS_NONE;
3523}
@ CREATURE_FLAG_EXTRA_NO_PARRY
Definition CreatureData.h:48
@ CREATURE_FLAG_EXTRA_NO_DODGE
Definition CreatureData.h:69
@ SPELL_ATTR7_NO_ATTACK_PARRY
Definition SharedDefines.h:653
@ SPELL_ATTR7_NO_ATTACK_DODGE
Definition SharedDefines.h:652
@ SPELL_ATTR3_COMPLETELY_BLOCKED
Definition SharedDefines.h:484
@ SPELL_MISS_PARRY
Definition SharedDefines.h:1527
@ SPELL_MISS_DODGE
Definition SharedDefines.h:1526
@ SPELL_MISS_NONE
Definition SharedDefines.h:1523
@ SPELL_MISS_RESIST
Definition SharedDefines.h:1525
@ SPELL_MISS_MISS
Definition SharedDefines.h:1524
@ SPELL_MISS_BLOCK
Definition SharedDefines.h:1528
@ SPELL_MISS_DEFLECT
Definition SharedDefines.h:1532
@ SPELL_AURA_MOD_EXPERTISE
Definition SpellAuraDefines.h:303
@ SPELL_AURA_IGNORE_COMBAT_RESULT
Definition SpellAuraDefines.h:265
@ SPELL_AURA_MOD_ENEMY_DODGE
Definition SpellAuraDefines.h:314
@ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
Definition SpellAuraDefines.h:311
@ SPELL_ATTR0_CU_DIRECT_DAMAGE
Definition SpellInfo.h:185
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition SpellInfo.h:194
WeaponAttackType
Definition Unit.h:222
float GetUnitDodgeChance() const
Definition Unit.cpp:3540
int32 GetMechanicResistChance(SpellInfo const *spell)
Definition Unit.cpp:3331
float GetUnitParryChance() const
Definition Unit.cpp:3557
float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
Definition Unit.cpp:14966
uint32 flags_extra
Definition CreatureData.h:241

References BASE_ATTACK, CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, SpellInfo::DmgClass, CreatureTemplate::flags_extra, GetAuraEffectsByType(), Creature::GetCreatureTemplate(), GetLevel(), GetMaxSkillValueForLevel(), GetMechanicResistChance(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetUnitBlockChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, Object::IsCreature(), IsNonMeleeSpellCast(), Object::IsPlayer(), SpellInfo::IsRangedWeaponSpell(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_DODGE, MELEE_HIT_PARRY, MeleeSpellMissChance(), RANGED_ATTACK, SPELL_ATTR0_CU_DIRECT_DAMAGE, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR3_COMPLETELY_BLOCKED, SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_COMBAT_RESULT, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, SPELL_DAMAGE_CLASS_RANGED, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_RESIST, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, UNIT_STATE_STUNNED, urand(), and VICTIMSTATE_DODGE.

◆ MeleeSpellMissChance()

float Unit::MeleeSpellMissChance ( Unit const *  victim,
WeaponAttackType  attType,
int32  skillDiff,
uint32  spellId 
) const
14967{
14968 SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
14969 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
14970 {
14971 return 0.0f;
14972 }
14973
14974 //calculate miss chance
14975 float missChance = victim->GetUnitMissChance(attType);
14976
14977 // Check if dual wielding, add additional miss penalty - when mainhand has on next swing spell, offhand doesnt suffer penalty
14978 if (!spellId && (attType != RANGED_ATTACK) && HasOffhandWeaponForAttack() && (!m_currentSpells[CURRENT_MELEE_SPELL] || !m_currentSpells[CURRENT_MELEE_SPELL]->IsNextMeleeSwingSpell()))
14979 {
14980 missChance += 19;
14981 }
14982
14983 // bonus from skills is 0.04%
14984 //miss_chance -= skillDiff * 0.04f;
14985 int32 diff = -skillDiff;
14986 if (victim->IsPlayer())
14987 missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
14988 else
14989 missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
14990
14991 // Calculate hit chance
14992 float hitChance = 100.0f;
14993
14994 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
14995 if (spellId)
14996 {
14997 if (Player* modOwner = GetSpellModOwner())
14998 modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
14999 }
15000
15001 missChance -= hitChance - 100.0f;
15002
15003 if (attType == RANGED_ATTACK)
15004 missChance -= m_modRangedHitChance;
15005 else
15006 missChance -= m_modMeleeHitChance;
15007
15008 // Limit miss chance from 0 to 60%
15009 if (missChance < 0.0f)
15010 return 0.0f;
15011 if (missChance > 60.0f)
15012 return 60.0f;
15013 return missChance;
15014}
@ SPELL_ATTR7_NO_ATTACK_MISS
Definition SharedDefines.h:654
@ SPELLMOD_RESIST_MISS_CHANCE
Definition SpellDefines.h:100

References CURRENT_MELEE_SPELL, GetSpellModOwner(), GetUnitMissChance(), SpellInfo::HasAttribute(), HasOffhandWeaponForAttack(), Object::IsPlayer(), m_currentSpells, m_modMeleeHitChance, m_modRangedHitChance, RANGED_ATTACK, SPELL_ATTR7_NO_ATTACK_MISS, SPELLMOD_RESIST_MISS_CHANCE, and sSpellMgr.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ ModifyAuraState()

void Unit::ModifyAuraState ( AuraStateType  flag,
bool  apply 
)
7432{
7433 if (apply)
7434 {
7435 if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
7436 {
7437 SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7438 Unit::AuraMap& tAuras = GetOwnedAuras();
7439 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
7440 {
7441 if ((*itr).second->IsRemoved())
7442 continue;
7443
7444 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
7445 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
7446 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true);
7447 }
7448 }
7449 }
7450 else
7451 {
7452 if (HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
7453 {
7454 RemoveFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
7455
7456 if (flag != AURA_STATE_ENRAGE) // enrage aura state triggering continues auras
7457 {
7458 Unit::AuraMap& tAuras = GetOwnedAuras();
7459 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
7460 {
7461 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
7462 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
7463 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false);
7464 }
7465 }
7466 }
7467 }
7468}
@ AURA_STATE_ENRAGE
Definition SharedDefines.h:1297
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:836
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:851
boost::container::flat_multimap< uint32, Aura * > AuraMap
Definition Unit.h:675
AuraMap & GetOwnedAuras()
Definition Unit.h:1390

References AURA_EFFECT_HANDLE_REAL, AURA_STATE_ENRAGE, Object::GetGUID(), GetOwnedAuras(), Object::HasFlag(), Object::RemoveFlag(), Object::SetFlag(), and UNIT_FIELD_AURASTATE.

Referenced by _ApplyAura(), _UnapplyAura(), ClearAllReactives(), Spell::finish(), debug_commandscript::HandleDebugSetAuraStateCommand(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), ProcSkillsAndReactives(), Update(), and UpdateReactives().

◆ ModifyHealth()

int32 Unit::ModifyHealth ( int32  val)
10801{
10802 int32 gain = 0;
10803
10804 if (dVal == 0)
10805 return 0;
10806
10807 int32 curHealth = (int32)GetHealth();
10808
10809 int32 val = dVal + curHealth;
10810 if (val <= 0)
10811 {
10812 SetHealth(0);
10813 return -curHealth;
10814 }
10815
10816 int32 maxHealth = (int32)GetMaxHealth();
10817
10818 if (val < maxHealth)
10819 {
10820 SetHealth(val);
10821 gain = val - curHealth;
10822 }
10823 else if (curHealth != maxHealth)
10824 {
10825 SetHealth(maxHealth);
10826 gain = maxHealth - curHealth;
10827 }
10828
10829 return gain;
10830}

References GetHealth(), GetMaxHealth(), and SetHealth().

Referenced by DealDamage(), DealHeal(), boss_ichoron::DoAction(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), boss_hadronox::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::RegenerateHealth(), Player::RegenerateHealth(), npc_injured_patient::npc_injured_patientAI::Reset(), boss_xt002::SetData(), Spell::TakePower(), Aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ ModifyPower()

int32 Unit::ModifyPower ( Powers  power,
int32  val,
bool  withPowerUpdate = true 
)
10859{
10860 if (dVal == 0)
10861 return 0;
10862
10863 int32 gain = 0;
10864
10865 int32 curPower = (int32)GetPower(power);
10866
10867 int32 val = dVal + curPower;
10868 if (val <= 0)
10869 {
10870 SetPower(power, 0, withPowerUpdate);
10871 return -curPower;
10872 }
10873
10874 int32 maxPower = (int32)GetMaxPower(power);
10875
10876 if (val < maxPower)
10877 {
10878 SetPower(power, val, withPowerUpdate);
10879 gain = val - curPower;
10880 }
10881 else if (curPower != maxPower)
10882 {
10883 SetPower(power, maxPower, withPowerUpdate);
10884 gain = maxPower - curPower;
10885 }
10886
10887 if (GetAI())
10888 {
10889 GetAI()->OnPowerUpdate(power, gain, dVal, curPower);
10890 }
10891
10892 return gain;
10893}
virtual void OnPowerUpdate(Powers, int32, int32, uint32)
Called when the creature power updates.
Definition UnitAI.h:382
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12124

References GetAI(), GetMaxPower(), GetPower(), UnitAI::OnPowerUpdate(), and SetPower().

Referenced by CalcAbsorbResist(), spell_igb_cannon_blast::CalculatePower(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), EnergizeBySpell(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_kelthuzad_detonate_mana_aura::HandleScript(), boss_pathaleon_the_calculator::JustEngagedWith(), boss_curator::JustEngagedWith(), Pet::LoseHappiness(), Creature::Regenerate(), RewardRage(), Pet::setDeathState(), Spell::TakePower(), Spell::TakeRunePower(), Aura::Update(), and boss_faction_championsAI::UpdateAI().

◆ MonsterMoveWithSpeed()

void Unit::MonsterMoveWithSpeed ( float  x,
float  y,
float  z,
float  speed 
)
657{
658 Movement::MoveSplineInit init(this);
659 init.MoveTo(x, y, z);
660 init.SetVelocity(speed);
661 init.Launch();
662}

References Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetVelocity().

◆ Mount()

void Unit::Mount ( uint32  mount,
uint32  vehicleId = 0,
uint32  creatureEntry = 0 
)
10320{
10321 if (mount)
10323
10325
10326 if (Player* player = ToPlayer())
10327 {
10328 sScriptMgr->AnticheatSetUnderACKmount(player);
10329
10330 // mount as a vehicle
10331 if (VehicleId)
10332 {
10333 if (CreateVehicleKit(VehicleId, creatureEntry))
10334 {
10335 GetVehicleKit()->Reset();
10336
10337 // Send others that we now have a vehicle
10339 data << GetPackGUID();
10340 data << uint32(VehicleId);
10341 SendMessageToSet(&data, true);
10342
10344 player->SendDirectMessage(&data);
10345
10346 // mounts can also have accessories
10348 }
10349 }
10350
10351 // unsummon pet
10352 Pet* pet = player->GetPet();
10353 if (pet)
10354 {
10356 // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
10357 if (bg && bg->isArena())
10359 else
10360 player->UnsummonPetTemporaryIfAny();
10361 }
10362
10363 // xinef: if we have charmed npc, stun him also
10364 if (Unit* charm = player->GetCharm())
10365 if (charm->IsCreature())
10366 charm->SetUnitFlag(UNIT_FLAG_STUNNED);
10367
10368 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
10369 data << GetPackGUID();
10370 data << player->GetSession()->GetOrderCounter(); // movement counter
10371 data << player->GetCollisionHeight();
10372 player->SendDirectMessage(&data);
10373 player->GetSession()->IncrementOrderCounter();
10374 }
10375
10377}
@ AURA_INTERRUPT_FLAG_MOUNT
Definition SpellDefines.h:68
bool isArena() const
Definition Battleground.h:413
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:14693
void Reset(bool evading=false)
Definition Vehicle.cpp:143
void InstallAllAccessories(bool evading)
Definition Vehicle.cpp:101

References AURA_INTERRUPT_FLAG_MOUNT, CreateVehicleKit(), Player::GetBattleground(), GetCharm(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), Vehicle::InstallAllAccessories(), Battleground::isArena(), RemoveAurasWithInterruptFlags(), Vehicle::Reset(), WorldObject::SendMessageToSet(), SetUInt32Value(), SetUnitFlag(), SMSG_MOVE_SET_COLLISION_HGT, SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, and UNIT_FLAG_STUNNED.

Referenced by AuraEffect::HandleAuraMounted(), spell_mount_check_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyMountCommand(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::InitializeAI(), boss_captain_skarloc::InitializeAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::JustRespawned(), Creature::LoadCreaturesAddon(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), npc_koltira_deathweaver::MovementInform(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), and WorldSession::SendDoFlight().

◆ NearTeleportTo() [1/2]

void Unit::NearTeleportTo ( float  x,
float  y,
float  z,
float  orientation,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
15684{
15685 DisableSpline();
15686 if (IsPlayer())
15687 ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0));
15688 else
15689 {
15690 Position pos = {x, y, z, orientation};
15691 SendTeleportPacket(pos);
15692 UpdatePosition(x, y, z, orientation, true);
15695 }
15696}
@ TELE_TO_WITH_PET
Definition Player.h:821
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition Player.h:820
@ TELE_TO_SPELL
Definition Player.h:819
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:817
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:818
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:816
void ReinitializeMovement()
Definition MotionMaster.cpp:1079
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1404
void SendTeleportPacket(Position &pos)
Definition Unit.cpp:15705
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:15076
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:15724

References DisableSpline(), WorldLocation::GetMapId(), GetMotionMaster(), Object::IsPlayer(), MotionMaster::ReinitializeMovement(), SendTeleportPacket(), TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, Player::TeleportTo(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdatePosition().

◆ NearTeleportTo() [2/2]

void Unit::NearTeleportTo ( Position &  pos,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
15679{
15680 NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), casting, vehicleTeleport, withPet, removeTransport);
15681}
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:15678

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and NearTeleportTo().

Referenced by boss_viscidus::DamageTaken(), npc_madrigosa::DoAction(), npc_akama_illidan::DoAction(), Spell::EffectLeap(), Spell::EffectResurrectPet(), Spell::EffectStuck(), Spell::EffectSummonPet(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), npc_giant_claw_tentacle::Emerge(), boss_yoggsaron_sara::EnterEvadeMode(), UnitAI::EvadeTimerExpired(), UtherBatteredHiltEvent::Execute(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), spell_moroes_vanish::HandleDummy(), spell_class_call_handler::HandleOnHitRogue(), npc_echo_of_medivh::HandlePieceJustDied(), BattlegroundBE::HandlePlayerUnderMap(), BattlegroundDS::HandlePlayerUnderMap(), BattlegroundNA::HandlePlayerUnderMap(), BattlegroundRL::HandlePlayerUnderMap(), BattlegroundRV::HandlePlayerUnderMap(), npc_pet_mage_mirror_image::InitializeAI(), npc_raging_spirit::npc_raging_spiritAI::IsSummonedBy(), boss_urom::boss_uromAI::JustDied(), boss_stormcaller_brundir::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_grandmaster_vorpil::JustEngagedWith(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), NearTeleportTo(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_chesspiece::OnCharmed(), npc_cos_chromie_start::OnGossipSelect(), npc_mistress_nagmara::Reset(), npc_rocknot::Reset(), npc_chesspiece::Reset(), boss_gothik::boss_gothikAI::Reset(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreSaurfangEventNpc(), Map::ScriptsProcess(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), npc_nerubian_burrower::SpellHitTarget(), npc_pos_leader_second::npc_pos_leader_secondAI::SpellHitTarget(), boss_cyanigosa::SpellHitTarget(), BossAI::TeleportCheaters(), brann_bronzebeard::TeleportTo(), BattlegroundRV::TeleportUnitToNewZ(), Vehicle::TeleportVehicle(), npc_doomfire_spirit::TryTeleportInDirection(), boss_rend_blackhand::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_thorim_sif::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_minigob_manabonk::UpdateAI().

◆ OutDebugInfo()

void Unit::OutDebugInfo ( ) const
15888{
15889 LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
15890 LOG_INFO("entities.unit", "GUID {}, name {}", GetGUID().ToString(), GetName());
15891 LOG_INFO("entities.unit", "OwnerGUID {}, MinionGUID {}, CharmerGUID {}, CharmedGUID {}",
15893 LOG_INFO("entities.unit", "In world {}, unit type mask {}", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
15894 if (IsInWorld())
15895 LOG_INFO("entities.unit", "Mapid {}", GetMapId());
15896
15897 LOG_INFO("entities.unit", "Summon Slot: ");
15898 for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
15899 LOG_INFO("entities.unit", "{}, ", m_SummonSlot[i].ToString());
15900 LOG_INFO("server.loading", " ");
15901
15902 LOG_INFO("entities.unit", "Controlled List: ");
15903 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
15904 LOG_INFO("entities.unit", "{}, ", (*itr)->GetGUID().ToString());
15905 LOG_INFO("server.loading", " ");
15906
15907 LOG_INFO("entities.unit", "Aura List: ");
15908 for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
15909 LOG_INFO("entities.unit", "{}, ", itr->first);
15910 LOG_INFO("server.loading", " ");
15911
15912 if (IsVehicle())
15913 {
15914 LOG_INFO("entities.unit", "Passenger List: ");
15915 for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
15916 if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
15917 LOG_INFO("entities.unit", "{}, ", passenger->GetGUID().ToString());
15918 LOG_INFO("server.loading", " ");
15919 }
15920
15921 if (GetVehicle())
15922 LOG_INFO("entities.unit", "On vehicle {}.", GetVehicleBase()->GetEntry());
15923}
Seats
Definition boss_flame_leviathan.cpp:171
SeatMap Seats
Definition Vehicle.h:60

References GetCharmerGUID(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), GetMinionGUID(), WorldObject::GetName(), GetOwnerGUID(), ObjectAccessor::GetUnit(), GetVehicle(), GetVehicleBase(), GetVehicleKit(), Object::IsInWorld(), IsVehicle(), LOG_ERROR, LOG_INFO, m_appliedAuras, m_Controlled, m_SummonSlot, m_unitTypeMask, MAX_SUMMON_SLOT, Vehicle::Seats, and Position::ToString().

Referenced by SetMinion().

◆ PatchValuesUpdate()

void Unit::PatchValuesUpdate ( ByteBuffer &  valuesUpdateBuf,
BuildValuesCachePosPointers &  posPointers,
Player *  target 
)
private
16634{
16635 Creature const* creature = ToCreature();
16636
16637 // UNIT_NPC_FLAGS
16638 if (creature && posPointers.UnitNPCFlagsPos >= 0)
16639 {
16640 uint32 appendValue = m_uint32Values[UNIT_NPC_FLAGS];
16641
16642 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
16643 appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
16644
16645 if (!target->CanSeeSpellClickOn(creature))
16646 appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
16647
16648 if (!target->CanSeeVendor(creature))
16649 {
16650 appendValue &= ~UNIT_NPC_FLAG_REPAIR;
16651 appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK;
16652 }
16653
16654 if (!target->CanSeeTrainer(creature))
16655 appendValue &= ~UNIT_NPC_FLAG_TRAINER;
16656
16657 valuesUpdateBuf.put(posPointers.UnitNPCFlagsPos, appendValue);
16658 }
16659
16660 // UNIT_FIELD_AURASTATE
16661 if (posPointers.UnitFieldAuraStatePos >= 0)
16662 valuesUpdateBuf.put(posPointers.UnitFieldAuraStatePos, uint32(BuildAuraStateUpdateForTarget(target)));
16663
16664 // UNIT_FIELD_FLAGS
16665 if (posPointers.UnitFieldFlagsPos >= 0)
16666 {
16667 uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
16668 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
16669 appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
16670
16671 valuesUpdateBuf.put(posPointers.UnitFieldFlagsPos, appendValue);
16672 }
16673
16674 // UNIT_FIELD_DISPLAYID
16675 // Use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures.
16676 if (posPointers.UnitFieldDisplayPos >= 0)
16677 {
16679 if (creature)
16680 {
16681 CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
16682
16683 // this also applies for transform auras
16684 if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
16685 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
16686 if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
16687 if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
16688 {
16689 cinfo = transformInfo;
16690 break;
16691 }
16692
16694 {
16695 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
16696 displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID;
16697 else
16698 displayId = cinfo->GetFirstInvisibleModel()->CreatureDisplayID;
16699 }
16700 }
16701
16702 valuesUpdateBuf.put(posPointers.UnitFieldDisplayPos, uint32(displayId));
16703 }
16704
16705 // UNIT_DYNAMIC_FLAGS
16706 // Hide lootable animation for unallowed players.
16707 if (posPointers.UnitDynamicFlagsPos >= 0)
16708 {
16710
16711 if (creature)
16712 {
16713 if (creature->hasLootRecipient())
16714 {
16715 dynamicFlags |= UNIT_DYNFLAG_TAPPED;
16716 if (creature->isTappedBy(target))
16717 dynamicFlags |= UNIT_DYNFLAG_TAPPED_BY_PLAYER;
16718 }
16719
16720 if (!target->isAllowedToLoot(creature))
16721 dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
16722 }
16723
16724 // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
16725 if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
16727 dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
16728
16729 valuesUpdateBuf.put(posPointers.UnitDynamicFlagsPos, dynamicFlags);
16730 }
16731
16732 // UNIT_FIELD_BYTES_2
16733 if (posPointers.UnitFieldBytes2Pos >= 0)
16734 {
16735 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
16736 {
16738 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
16739 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
16740 // Allow targetting opposite faction in party when enabled in config
16741 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8))); // this flag is at uint8 offset 1 !!
16742 }// pussywizard / Callmephil
16743 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
16744 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
16745 {
16746 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & 0xFFFFF2FF)); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
16747 }
16748 }
16749
16750 // UNIT_FIELD_FACTIONTEMPLATE
16751 if (posPointers.UnitFieldFactionTemplatePos >= 0)
16752 {
16753 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
16754 {
16756 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
16757 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
16758 // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
16759 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
16760 }// pussywizard / Callmephil
16761 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
16762 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
16763 {
16764 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
16765 }
16766 else if (target->IsGMSpectator() && IsControlledByPlayer())
16767 {
16768 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
16769 }
16770 }
16771
16772 sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
16773}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition CreatureData.h:53
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3355
@ CONFIG_INSTANT_TAXI
Definition WorldConfig.h:354
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition WorldConfig.h:35
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
bool isTappedBy(Player const *player) const
Definition Creature.cpp:1384
bool isAllowedToLoot(Creature const *creature)
Definition PlayerStorage.cpp:5747
bool CanSeeTrainer(Creature const *creature) const
Definition Player.cpp:14852
bool CanSeeVendor(Creature const *creature) const
Definition Player.cpp:14836
bool IsGMSpectator() const
Definition Player.h:1183
bool IsSpectator() const
Definition Player.h:2622
bool CanSeeSpellClickOn(Creature const *creature) const
Definition Player.cpp:14736
uint32 BuildAuraStateUpdateForTarget(Unit *target) const
Definition Unit.cpp:7470
bool IsGMAccount() const
Definition WorldSession.cpp:221
int32 UnitFieldFlagsPos
Definition UnitUtils.h:99
int32 UnitFieldDisplayPos
Definition UnitUtils.h:100
int32 UnitDynamicFlagsPos
Definition UnitUtils.h:101
int32 UnitFieldAuraStatePos
Definition UnitUtils.h:98
int32 UnitFieldFactionTemplatePos
Definition UnitUtils.h:103
int32 UnitFieldBytes2Pos
Definition UnitUtils.h:102
int32 UnitNPCFlagsPos
Definition UnitUtils.h:97
uint32 CreatureDisplayID
Definition CreatureData.h:180
CreatureModel const * GetFirstInvisibleModel() const
Definition Creature.cpp:160
CreatureModel const * GetFirstVisibleModel() const
Definition Creature.cpp:170
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition DBCStructure.h:987

References BuildAuraStateUpdateForTarget(), Player::CanSeeSpellClickOn(), Player::CanSeeTrainer(), Player::CanSeeVendor(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CONFIG_INSTANT_TAXI, CREATURE_FLAG_EXTRA_TRIGGER, CreatureModel::CreatureDisplayID, WorldObject::FindMap(), Creature::GetCreatureTemplate(), GetFaction(), GetFactionTemplateEntry(), CreatureTemplate::GetFirstInvisibleModel(), CreatureTemplate::GetFirstVisibleModel(), Object::GetGUID(), Player::GetSession(), getTransForm(), HasAuraTypeWithCaster(), CreatureTemplate::HasFlagsExtra(), Creature::hasLootRecipient(), Player::isAllowedToLoot(), Map::IsBattleArena(), IsControlledByPlayer(), FactionTemplateEntry::IsFriendlyTo(), Player::IsGameMaster(), WorldSession::IsGMAccount(), Player::IsGMSpectator(), IsInRaidWith(), Player::IsSpectator(), Creature::isTappedBy(), Object::m_uint32Values, MAX_SPELL_EFFECTS, ByteBuffer::put(), sObjectMgr, SPELL_AURA_MOD_STALKED, SPELL_AURA_TRANSFORM, sScriptMgr, sSpellMgr, sWorld, Object::ToCreature(), UNIT_BYTE2_FLAG_SANCTUARY, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, and BuildValuesCachePosPointers::UnitNPCFlagsPos.

Referenced by BuildValuesUpdate().

◆ PauseMovement()

void Unit::PauseMovement ( uint32  timer = 0,
uint8  slot = 0 
)
virtual

Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.

12745{
12746 if (slot >= MAX_MOTION_SLOT)
12747 return;
12748
12749 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
12750 movementGenerator->Pause(timer);
12751
12752 StopMoving();
12753}
@ MAX_MOTION_SLOT
Definition MotionMaster.h:67
Definition MovementGenerator.h:28
void StopMoving()
Definition Unit.cpp:12725

References GetMotionMaster(), MAX_MOTION_SLOT, and StopMoving().

Referenced by spell_chapter5_return_to_capital::HandleHit(), Creature::PauseMovementForInteraction(), boss_shade_of_aran::SetGUID(), npc_acherus_necromancer::UpdateAI(), npc_gothik_the_harvester::UpdateAI(), and npc_mistress_nagmara::WaypointReached().

◆ PetSpellFail()

void Unit::PetSpellFail ( SpellInfo const *  spellInfo,
Unit *  target,
uint32  result 
)
16009{
16010 CharmInfo* charmInfo = GetCharmInfo();
16011 if (!charmInfo || !IsCreature())
16012 return;
16013
16014 if ((sDisableMgr->IsPathfindingEnabled(GetMap()) || result != SPELL_FAILED_LINE_OF_SIGHT) && target)
16015 {
16016 if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE))
16017 if (Unit* owner = GetOwner())
16018 {
16019 if (spellInfo->IsPositive() && IsFriendlyTo(target))
16020 {
16021 AttackStop();
16022 charmInfo->SetIsAtStay(false);
16023 charmInfo->SetIsCommandAttack(true);
16024 charmInfo->SetIsReturning(false);
16025 charmInfo->SetIsFollowing(false);
16026
16027 GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
16028 }
16029 else if (owner->IsValidAttackTarget(target))
16030 {
16031 AttackStop();
16032 charmInfo->SetIsAtStay(false);
16033 charmInfo->SetIsCommandAttack(true);
16034 charmInfo->SetIsReturning(false);
16035 charmInfo->SetIsFollowing(false);
16036
16037 if (!ToCreature()->HasReactState(REACT_PASSIVE))
16038 ToCreature()->AI()->AttackStart(target);
16039 else
16040 GetMotionMaster()->MoveChase(target);
16041 }
16042 }
16043
16044 // can be extended in future
16045 if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE)
16046 {
16047 charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id);
16048 charmInfo->SetForcedTargetGUID(target->GetGUID());
16049 }
16050 else
16051 {
16052 charmInfo->SetForcedSpell(0);
16054 }
16055 }
16056}
#define sDisableMgr
Definition DisableMgr.h:88
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
@ SPELL_FAILED_OUT_OF_RANGE
Definition SharedDefines.h:1034
@ SPELL_FAILED_LINE_OF_SIGHT
Definition SharedDefines.h:984
@ REACT_PASSIVE
Definition Unit.h:574
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:316
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:448
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:29
void SetIsAtStay(bool val)
Definition CharmInfo.cpp:355
void SetIsFollowing(bool val)
Definition CharmInfo.cpp:365
void SetIsReturning(bool val)
Definition CharmInfo.cpp:375
void SetForcedSpell(uint32 id)
Definition CharmInfo.h:177
void SetForcedTargetGUID(ObjectGuid guid=ObjectGuid::Empty)
Definition CharmInfo.h:179
void SetIsCommandAttack(bool val)
Definition CharmInfo.cpp:293

References Creature::AI(), UnitAI::AttackStart(), AttackStop(), ObjectGuid::Empty, GetCharmInfo(), Object::GetGUID(), WorldObject::GetMap(), GetMotionMaster(), GetOwner(), SpellInfo::Id, Object::IsCreature(), IsFriendlyTo(), SpellInfo::IsPositive(), MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, rand_norm(), REACT_PASSIVE, sDisableMgr, CharmInfo::SetForcedSpell(), CharmInfo::SetForcedTargetGUID(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsFollowing(), CharmInfo::SetIsReturning(), SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_OUT_OF_RANGE, and Object::ToCreature().

Referenced by WorldSession::HandlePetActionHelper(), and WorldSession::HandlePetCastSpellOpcode().

◆ processDummyAuras()

float Unit::processDummyAuras ( float  TakenTotalMod) const
private
8831{
8832 // note: old code coming from TC, just extracted here to remove the code duplication + solve potential crash
8833 // see: https://github.com/TrinityCore/TrinityCore/commit/c85710e148d75450baedf6632b9ca6fd40b4148e
8834
8835 // .. taken pct: dummy auras
8836 auto const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
8837 for (auto i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
8838 {
8839 if (!(*i) || !(*i)->GetSpellInfo())
8840 {
8841 continue;
8842 }
8843
8844 if (auto spellIconId = (*i)->GetSpellInfo()->SpellIconID)
8845 {
8846 switch (spellIconId)
8847 {
8848 // Cheat Death
8849 case 2109:
8850 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
8851 {
8852 // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
8853 // is 22.5% critical strike damage reduction, or 444 resilience.
8854 // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
8855 float mod = -1.0f * GetMeleeCritDamageReduction(400);
8856 AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
8857 }
8858 break;
8859 }
8860 }
8861 }
8862 return TakenTotalMod;
8863}

References AddPct(), GetAuraEffectsByType(), GetMeleeCritDamageReduction(), SPELL_AURA_DUMMY, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ ProcessPositionDataChanged()

void Unit::ProcessPositionDataChanged ( PositionFullTerrainStatus const &  data)
overridevirtual

Reimplemented from WorldObject.

4227{
4230}
virtual void ProcessTerrainStatusUpdate()
Definition Unit.cpp:4232
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
Definition Object.cpp:1197

References WorldObject::ProcessPositionDataChanged(), and ProcessTerrainStatusUpdate().

Referenced by Creature::Create().

◆ ProcessTerrainStatusUpdate()

void Unit::ProcessTerrainStatusUpdate ( )
virtual

Reimplemented in Player.

4233{
4234 if (IsCreature())
4236
4237 if (IsFlying() || (!IsControlledByPlayer()))
4238 return;
4239
4240 LiquidData const& liquidData = GetLiquidData();
4241
4242 // remove appropriate auras if we are swimming/not swimming respectively - exact mirror of client logic
4243 if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING && (liquidData.Level - GetPositionZ()) > GetCollisionHeight() * 0.75f) // Shallow water at ~75% of collision height)
4245 else
4247
4248 // liquid aura handling
4249 LiquidTypeEntry const* curLiquid = nullptr;
4250 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING))
4251 curLiquid = sLiquidTypeStore.LookupEntry(liquidData.Entry);
4252
4253 if (curLiquid != _lastLiquid)
4254 {
4257
4258 // Set _lastLiquid before casting liquid spell to avoid infinite loops
4259 _lastLiquid = curLiquid;
4260
4262 if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
4263 CastSpell(this, curLiquid->SpellId, true);
4264 }
4265}
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition SpellDefines.h:58
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition SpellDefines.h:59
void UpdateMovementFlags()
Definition Creature.cpp:3528
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4962
bool IsFlying() const
Definition Unit.h:1733
Definition GridTerrainData.h:199
float Level
Definition GridTerrainData.h:204
uint32 Entry
Definition GridTerrainData.h:202
Definition DBCStructure.h:1319
uint32 SpellId
Definition DBCStructure.h:1325

References _lastLiquid, AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, CastSpell(), LiquidData::Entry, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCollisionHeight(), WorldObject::GetLiquidData(), Position::GetPositionZ(), IsControlledByPlayer(), Object::IsCreature(), IsFlying(), Player::IsGameMaster(), LiquidData::Level, MAP_LIQUID_STATUS_SWIMMING, RemoveAurasDueToSpell(), RemoveAurasWithInterruptFlags(), sLiquidTypeStore, LiquidTypeEntry::SpellId, LiquidData::Status, Object::ToCreature(), and Creature::UpdateMovementFlags().

Referenced by ProcessPositionDataChanged(), and Player::ProcessTerrainStatusUpdate().

◆ ProcSkillsAndAuras()

void Unit::ProcSkillsAndAuras ( Unit *  actor,
Unit *  victim,
uint32  procAttacker,
uint32  procVictim,
uint32  procEx,
uint32  amount,
WeaponAttackType  attType = BASE_ATTACK,
SpellInfo const *  procSpellInfo = nullptr,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo *  damageInfo = nullptr,
HealInfo *  healInfo = nullptr,
uint32  procPhase = 2 
)
static
6608{
6609 // Handle skills and reactives for actor
6610 if (procAttacker && actor)
6611 actor->ProcSkillsAndReactives(false, victim, procAttacker, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6612
6613 // Handle skills and reactives for victim
6614 if (victim && victim->IsAlive() && procVictim)
6615 victim->ProcSkillsAndReactives(true, actor, procVictim, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6616
6617 // Handle aura procs via new proc system (TriggerAurasProcOnEvent)
6618 if (actor)
6619 {
6620 // Calculate spellTypeMask based on phase and actual damage/heal info
6622 if (procPhase == PROC_SPELL_PHASE_CAST || procPhase == PROC_SPELL_PHASE_FINISH)
6623 {
6624 // At CAST phase, no damage/heal has occurred yet - use MASK_ALL to allow
6625 // procs that check for damage/heal type based on spell info (like Backlash)
6626 // At FINISH phase, damageInfo may be null but spell did do damage - use MASK_ALL
6627 // to match TrinityCore behavior (see TC Spell.cpp PROC_SPELL_PHASE_FINISH call)
6629 }
6630 else if (healInfo && healInfo->GetHeal())
6632 else if (damageInfo && (damageInfo->GetDamage() || damageInfo->GetAbsorb()))
6634 else if (procSpellInfo)
6636
6637 actor->TriggerAurasProcOnEvent(nullptr, nullptr, victim, procAttacker, procVictim, spellTypeMask, procPhase, procExtra, const_cast<Spell*>(procSpell), damageInfo, healInfo);
6638 }
6639}
static uint32 spellTypeMask[TOTAL_AURAS]
Definition SpellMgr.cpp:1979
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:240
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:242
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:239
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition SpellMgr.h:241
@ PROC_SPELL_PHASE_FINISH
Definition SpellMgr.h:250
@ PROC_SPELL_PHASE_CAST
Definition SpellMgr.h:248
uint32 GetAbsorb() const
Definition Unit.h:382
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
Definition Unit.cpp:12585

References DamageInfo::GetAbsorb(), DamageInfo::GetDamage(), HealInfo::GetHeal(), IsAlive(), PROC_SPELL_PHASE_CAST, PROC_SPELL_PHASE_FINISH, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_TYPE_HEAL, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_TYPE_NO_DMG_HEAL, ProcSkillsAndReactives(), spellTypeMask, and TriggerAurasProcOnEvent().

Referenced by Spell::_cast(), Spell::_handle_finish_phase(), AttackerStateUpdate(), Spell::DoAllEffectOnTarget(), ReflectEvent::Execute(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and Kill().

◆ ProcSkillsAndReactives()

void Unit::ProcSkillsAndReactives ( bool  isVictim,
Unit *  target,
uint32  procFlag,
uint32  procExtra,
WeaponAttackType  attType,
SpellInfo const *  procSpellInfo,
uint32  damage,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo *  damageInfo = nullptr,
HealInfo *  healInfo = nullptr,
uint32  procPhase = 2 
)
12460{
12461 // Player is loaded now - do not allow passive spell casts to proc
12462 if (IsPlayer() && ToPlayer()->GetSession()->PlayerLoading())
12463 return;
12464 // For melee/ranged based attack need update skills and set some Aura states if victim present
12465 if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT)
12466 {
12467 // Xinef: Shaman in ghost wolf form cant proc anything melee based
12468 if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF)
12469 return;
12470
12471 // Update skills here for players
12472 // only when you are not fighting other players or their pets/totems (pvp)
12473 if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
12474 {
12475 // On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
12477 {
12478 ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
12479 }
12480 // Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
12481 else if (isVictim && procExtra & (PROC_EX_BLOCK))
12482 {
12483 ToPlayer()->UpdateCombatSkills(target, attType, true);
12484 }
12485 }
12486 // If exist crit/parry/dodge/block need update aura state (for victim and attacker)
12488 {
12489 // for victim
12490 if (isVictim)
12491 {
12492 // if victim and dodge attack
12493 if (procExtra & PROC_EX_DODGE)
12494 {
12495 // Update AURA_STATE on dodge
12496 if (!IsClass(CLASS_ROGUE, CLASS_CONTEXT_ABILITY_REACTIVE)) // skip Rogue Riposte
12497 {
12500 }
12501 }
12502 // if victim and parry attack
12503 if (procExtra & PROC_EX_PARRY)
12504 {
12505 // For Hunters only Counterattack (skip Mongoose bite)
12507 {
12510 }
12511 else
12512 {
12515 }
12516 }
12517 // if and victim block attack
12518 if (procExtra & PROC_EX_BLOCK)
12519 {
12522 }
12523 }
12524 else // For attacker
12525 {
12526 // Overpower on victim dodge
12527 if (procExtra & PROC_EX_DODGE)
12528 {
12530 {
12531 AddComboPoints(target, 1);
12533 }
12534 }
12535
12536 // Wolverine Bite
12537 if ((procExtra & PROC_HIT_CRITICAL) && IsHunterPet())
12538 {
12539 AddComboPoints(target, 1);
12541 }
12542 }
12543 }
12544 }
12545 // Aura procs are now handled by TriggerAurasProcOnEvent called from ProcSkillsAndAuras
12546}
@ CLASS_ROGUE
Definition SharedDefines.h:129
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:258
#define MELEE_BASED_TRIGGER_MASK
Definition SpellMgr.h:187
@ PROC_EX_DODGE
Definition SpellMgr.h:203
@ PROC_EX_BLOCK
Definition SpellMgr.h:205
@ PROC_EX_CRITICAL_HIT
Definition SpellMgr.h:200
@ PROC_EX_NORMAL_HIT
Definition SpellMgr.h:199
@ PROC_EX_MISS
Definition SpellMgr.h:201
@ PROC_EX_RESIST
Definition SpellMgr.h:202
@ PROC_EX_PARRY
Definition SpellMgr.h:204
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:249
@ REACTIVE_OVERPOWER
Definition Unit.h:629
@ REACTIVE_DEFENSE
Definition Unit.h:627
@ REACTIVE_HUNTER_PARRY
Definition Unit.h:628
@ REACTIVE_WOLVERINE_BITE
Definition Unit.h:630
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition PlayerUpdates.cpp:1050
bool IsHunterPet() const
Definition Unit.h:804
void StartReactiveTimer(ReactiveType reactive)
Definition Unit.h:1875

References AddComboPoints(), AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_ROGUE, CLASS_WARRIOR, FORM_GHOSTWOLF, GetShapeshiftForm(), IsCharmedOwnedByPlayerOrPlayer(), IsClass(), IsHunterPet(), Object::IsPlayer(), Spell::m_weaponItem, MELEE_BASED_TRIGGER_MASK, ModifyAuraState(), PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_MISS, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, REACTIVE_WOLVERINE_BITE, StartReactiveTimer(), Object::ToPlayer(), and Player::UpdateCombatSkills().

Referenced by CalcAbsorbResist(), and ProcSkillsAndAuras().

◆ ProhibitSpellSchool()

virtual void Unit::ProhibitSpellSchool ( SpellSchoolMask  ,
uint32   
)
inlinevirtual

Reimplemented in Creature, and Player.

1601{ }

Referenced by Spell::EffectInterruptCast().

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )
inline
void propagateSpeedChange()
Definition MotionMaster.cpp:1065

References GetMotionMaster(), and MotionMaster::propagateSpeedChange().

Referenced by SetSpeed(), and SetWalk().

◆ RecalculateObjectScale()

void Unit::RecalculateObjectScale ( )
virtual
12846{
12848 float scale = _displayScale.value_or(GetNativeObjectScale()) + CalculatePct(1.0f, scaleAuras);
12849 float scaleMin = IsPlayer() ? 0.1f : 0.01f;
12850 SetObjectScale(std::max(scale, scaleMin));
12851}
@ SPELL_AURA_MOD_SCALE_2
Definition SpellAuraDefines.h:302
@ SPELL_AURA_MOD_SCALE
Definition SpellAuraDefines.h:124
virtual void SetObjectScale(float scale)
Definition Object.h:127
virtual float GetNativeObjectScale() const
Definition Unit.h:1994
std::optional< float > _displayScale
scale passed with the current display, empty = native scale
Definition Unit.h:2279

References _displayScale, CalculatePct(), GetNativeObjectScale(), GetTotalAuraModifier(), Object::IsPlayer(), Object::SetObjectScale(), SPELL_AURA_MOD_SCALE, and SPELL_AURA_MOD_SCALE_2.

Referenced by AuraEffect::HandleAuraModScale(), and SetDisplayId().

◆ RemoveAllAttackers()

void Unit::RemoveAllAttackers ( )

Remove all units in m_attackers list and send them AttackStop()

7419{
7420 while (!m_attackers.empty())
7421 {
7422 AttackerSet::iterator iter = m_attackers.begin();
7423 if (!(*iter)->AttackStop())
7424 {
7425 LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!");
7426 m_attackers.erase(iter);
7427 }
7428 }
7429}

References LOG_ERROR, and m_attackers.

Referenced by CombatStop(), spell_halion_twilight_phasing_aura::DropCombat(), boss_kaelthas::ExecuteMiddleEvent(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_attumen::SpellHit(), and npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI().

◆ RemoveAllAuras()

void Unit::RemoveAllAuras ( )
5411{
5412 // this may be a dead loop if some events on aura remove will continiously apply aura on remove
5413 // we want to have all auras removed, so use your brain when linking events
5414 while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
5415 {
5416 AuraApplicationMap::iterator aurAppIter;
5417 for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
5419
5420 AuraMap::iterator aurIter;
5421 for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
5422 RemoveOwnedAura(aurIter);
5423 }
5424}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by CleanupBeforeRemoveFromMap(), boss_muru::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_black_knight::DamageTaken(), boss_grand_champion::DamageTaken(), npc_frost_sphere::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_kiljaeden::DamageTaken(), boss_thorim::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_taldaram::DoAction(), boss_grand_champion::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_kalecgos::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron_cloud::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), boss_razorgore::DoChangePhase(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), boss_mimiron::EnterEvadeMode(), npc_ulduar_leviathan_mkii::EnterEvadeMode(), npc_ulduar_vx001::EnterEvadeMode(), npc_ulduar_aerial_command_unit::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), LichKingDeathEvent::Execute(), spell_herald_volzaj_insanity::HandleDummyEffect(), misc_commandscript::HandleUnAuraCommand(), boss_ick::boss_ickAI::JustDied(), boss_venoxis::JustDied(), boss_taldaram::JustEngagedWith(), boss_mimiron::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_commander_stoutbeard::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_steelbreaker::JustReachedHome(), boss_runemaster_molgeim::JustReachedHome(), boss_stormcaller_brundir::JustReachedHome(), boss_urom::boss_uromAI::LeaveCombat(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), boss_taldaram::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), spell_kaelthas_flame_strike::OnRemove(), PretendToDie(), boss_alar::PretendToDie(), Creature::RemoveCorpse(), boss_venoxis::Reset(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), npc_crystalline_frayer::Reset(), boss_bjarngrim::Reset(), boss_loken::Reset(), boss_hodir::Reset(), boss_yoggsaron_voice::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), Pet::SavePetToDB(), npc_harrison_jones::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_ulduar_flames_spread::SpellHit(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Submit(), npc_vaelastrasz_the_red::UpdateAI(), npc_madrigosa::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ RemoveAllAurasExceptType()

void Unit::RemoveAllAurasExceptType ( AuraType  type)
5485{
5486 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5487 {
5488 Aura const* aura = iter->second->GetBase();
5489 if (aura->GetSpellInfo()->HasAura(type))
5490 ++iter;
5491 else
5493 }
5494
5495 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5496 {
5497 Aura* aura = iter->second;
5498 if (aura->GetSpellInfo()->HasAura(type))
5499 ++iter;
5500 else
5502 }
5503}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), SpellInfo::HasAura(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), npc_frost_sphere::SpellHit(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ RemoveAllAurasOnDeath()

void Unit::RemoveAllAurasOnDeath ( )
5441{
5442 // used just after dieing to remove all visible auras
5443 // and disable the mods for the passive ones
5444 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5445 {
5446 Aura const* aura = iter->second->GetBase();
5449 else
5450 ++iter;
5451 }
5452
5453 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5454 {
5455 Aura* aura = iter->second;
5458 else
5459 ++iter;
5460 }
5461}
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
Definition SharedDefines.h:631
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
bool IsDeathPersistent() const
Definition SpellAuras.cpp:1153

References _UnapplyAura(), AURA_REMOVE_BY_DEATH, Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsDeathPersistent(), Aura::IsPassive(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), and SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD.

Referenced by spell_dk_death_pact::FilterTargets(), Kill(), Player::LoadFromDB(), and setDeathState().

◆ RemoveAllAurasRequiringDeadTarget()

void Unit::RemoveAllAurasRequiringDeadTarget ( )
5464{
5465 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5466 {
5467 Aura const* aura = iter->second->GetBase();
5468 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5470 else
5471 ++iter;
5472 }
5473
5474 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5475 {
5476 Aura* aura = iter->second;
5477 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5479 else
5480 ++iter;
5481 }
5482}
bool IsRequiringDeadTarget() const
Definition SpellInfo.cpp:1267

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), Aura::IsPassive(), SpellInfo::IsRequiringDeadTarget(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by Player::LoadFromDB().

◆ RemoveAllControlled()

void Unit::RemoveAllControlled ( bool  onDeath = false)
8026{
8027 // possessed pet and vehicle
8028 if (IsPlayer())
8030
8031 for (auto it = m_Controlled.begin(); it != m_Controlled.end();)
8032 {
8033 Unit* target = *it;
8034 ++it;
8035
8036 if (target->GetCharmerGUID() == GetGUID())
8037 {
8038 m_Controlled.erase(target);
8039 target->RemoveCharmAuras();
8040 }
8041 else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon())
8042 {
8043 // Keep Lightwell alive on owner death
8044 if (onDeath)
8045 if (TempSummon* ts = target->ToTempSummon())
8046 if (ts->m_Properties && ts->m_Properties->Type == SUMMON_TYPE_LIGHTWELL)
8047 continue;
8048
8049 if (!(onDeath && !IsPlayer() && target->IsGuardian()))
8050 target->ToTempSummon()->UnSummon();
8051 }
8052 else
8053 {
8054 LOG_ERROR("entities.unit", "Unit {} is trying to release unit {} which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
8055 m_Controlled.erase(target);
8056 }
8057 }
8058}
@ SUMMON_TYPE_LIGHTWELL
Definition SharedDefines.h:3538
void StopCastingCharm(Aura *except=nullptr)
Definition Player.cpp:9581
void RemoveCharmAuras()
Definition Unit.cpp:8140

References GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), IsGuardian(), Object::IsPlayer(), IsSummon(), LOG_ERROR, m_Controlled, RemoveCharmAuras(), Player::StopCastingCharm(), SUMMON_TYPE_LIGHTWELL, Object::ToPlayer(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ RemoveAllDynObjects()

void Unit::RemoveAllDynObjects ( )
6368{
6369 while (!m_dynObj.empty())
6370 m_dynObj.front()->Remove();
6371}

References m_dynObj.

Referenced by RemoveFromWorld(), Player::TeleportTo(), and npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI().

◆ RemoveAllFollowers()

void Unit::RemoveAllFollowers ( )
5405{
5406 while (!m_followingMe.empty())
5407 (*m_followingMe.begin())->SetTarget(nullptr);
5408}

References m_followingMe, and SetTarget().

Referenced by RemoveFromWorld(), and ~Unit().

◆ RemoveAllGameObjects()

void Unit::RemoveAllGameObjects ( )
6494{
6495 while(!m_gameObj.empty())
6496 {
6497 GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin());
6498 if (go)
6499 {
6501 go->SetRespawnTime(0);
6502 go->Delete();
6503 }
6504 m_gameObj.erase(m_gameObj.begin());
6505 }
6506}
void Delete()
Definition GameObject.cpp:1092
void SetRespawnTime(int32 respawn)
Definition GameObject.cpp:1404

References GameObject::Delete(), ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_gameObj, GameObject::SetOwnerGUID(), and GameObject::SetRespawnTime().

Referenced by CleanupBeforeRemoveFromMap(), npc_ice_tomb::npc_ice_tombAI::JustDied(), RemoveFromWorld(), npc_brewfest_super_brew_trigger::UpdateAI(), and boss_sapphiron::boss_sapphironAI::UpdateAI().

◆ RemoveAllMinionsByEntry()

void Unit::RemoveAllMinionsByEntry ( uint32  entry)
7798{
7799 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
7800 {
7801 Unit* unit = *itr;
7802 ++itr;
7803 if (unit->GetEntry() == entry && unit->IsCreature()
7804 && unit->ToCreature()->IsSummon()) // minion, actually
7805 unit->ToTempSummon()->UnSummon();
7806 // i think this is safe because i have never heard that a despawned minion will trigger a same minion
7807 }
7808}

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, Object::ToCreature(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Spell::EffectSummonType(), npc_nelson::npc_nelsonAI::Reset(), SetMinion(), and npc_nelson::npc_nelsonAI::UpdateAI().

◆ RemoveAppliedAuras() [1/2]

void Unit::RemoveAppliedAuras ( std::function< bool(AuraApplication const *)> const &  check)
4921{
4922 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
4923 {
4924 // RemoveAura no-ops on applications already mid-removal
4925 if (!iter->second->GetRemoveMode() && check(iter->second))
4926 {
4927 RemoveAura(iter);
4928 continue;
4929 }
4930 ++iter;
4931 }
4932}

References m_appliedAuras, and RemoveAura().

Referenced by _RemoveNoStackAurasDueToAura(), SpellInfo::ApplyAllSpellImmunitiesTo(), and RemoveArenaAuras().

◆ RemoveAppliedAuras() [2/2]

void Unit::RemoveAppliedAuras ( uint32  spellId,
std::function< bool(AuraApplication const *)> const &  check 
)
4948{
4949 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4950 {
4951 // RemoveAura no-ops on applications already mid-removal
4952 if (!iter->second->GetRemoveMode() && check(iter->second))
4953 {
4954 RemoveAura(iter);
4955 iter = m_appliedAuras.lower_bound(spellId);
4956 continue;
4957 }
4958 ++iter;
4959 }
4960}

References m_appliedAuras, and RemoveAura().

◆ RemoveAreaAurasDueToLeaveWorld()

void Unit::RemoveAreaAurasDueToLeaveWorld ( )
5372{
5373 // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
5374 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5375 {
5376 Aura* aura = iter->second;
5377 ++iter;
5378 Aura::ApplicationMap const& appMap = aura->GetApplicationMap();
5379 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr != appMap.end();)
5380 {
5381 AuraApplication* aurApp = itr->second;
5382 ++itr;
5383 Unit* target = aurApp->GetTarget();
5384 if (target == this)
5385 continue;
5386 target->RemoveAura(aurApp);
5387 // things linked on aura remove may apply new area aura - so start from the beginning
5388 iter = m_ownedAuras.begin();
5389 }
5390 }
5391
5392 // remove area auras owned by others
5393 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5394 {
5395 if (iter->second->GetBase()->GetOwner() != this)
5396 {
5397 RemoveAura(iter);
5398 }
5399 else
5400 ++iter;
5401 }
5402}
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:184
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:91

References Aura::GetApplicationMap(), AuraApplication::GetTarget(), m_appliedAuras, m_ownedAuras, and RemoveAura().

Referenced by RemoveFromWorld().

◆ RemoveArenaAuras()

void Unit::RemoveArenaAuras ( )
5427{
5428 // in join, remove positive buffs, on end, remove negative
5429 // used to remove positive visible auras in arenas
5430 RemoveAppliedAuras([](AuraApplication const* aurApp)
5431 {
5432 Aura const* aura = aurApp->GetBase();
5433 return (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_ALLOW_ENETRING_ARENA) // don't remove stances, shadowform, pally/hunter auras
5434 && !aura->IsPassive() // don't remove passive auras
5435 && (aurApp->IsPositive() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD))) || // not negative death persistent auras
5436 aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ENTERING_ARENA); // special marker, always remove
5437 });
5438}
@ SPELL_ATTR5_REMOVE_ENTERING_ARENA
Definition SharedDefines.h:557
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition SharedDefines.h:501
@ SPELL_ATTR4_ALLOW_ENETRING_ARENA
Definition SharedDefines.h:539
bool IsPositive() const
Definition SpellAuras.h:69

References AuraApplication::GetBase(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsPassive(), AuraApplication::IsPositive(), RemoveAppliedAuras(), SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD, SPELL_ATTR4_ALLOW_ENETRING_ARENA, and SPELL_ATTR5_REMOVE_ENTERING_ARENA.

Referenced by Battleground::AddPlayer().

◆ RemoveAura() [1/4]

void Unit::RemoveAura ( Aura *  aur,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4900{
4901 if (aura->IsRemoved())
4902 return;
4903 if (AuraApplication* aurApp = aura->GetApplicationOfTarget(GetGUID()))
4904 RemoveAura(aurApp, mode);
4905}

References Aura::GetApplicationOfTarget(), Object::GetGUID(), Aura::IsRemoved(), and RemoveAura().

◆ RemoveAura() [2/4]

void Unit::RemoveAura ( AuraApplication *  aurApp,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4857{
4858 // we've special situation here, RemoveAura called while during aura removal
4859 // this kind of call is needed only when aura effect removal handler
4860 // or event triggered by it expects to remove
4861 // not yet removed effects of an aura
4862 if (aurApp->GetRemoveMode())
4863 {
4864 // remove remaining effects of an aura
4865 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4866 {
4867 if (aurApp->HasEffect(itr))
4868 aurApp->_HandleEffect(itr, false);
4869 }
4870 return;
4871 }
4872 // no need to remove
4873 if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
4874 return;
4875
4876 uint32 spellId = aurApp->GetBase()->GetId();
4877 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4878
4879 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4880 {
4881 if (aurApp == iter->second)
4882 {
4883 // Prevent Arena Preparation aura from being removed by player actions
4884 // It's an invisibility spell so any interaction/spell cast etc. removes it.
4885 // Should only be removed by the arena script, once the match starts.
4887 {
4888 return;
4889 }
4890
4891 RemoveAura(iter, mode);
4892 return;
4893 }
4894 else
4895 ++iter;
4896 }
4897}
@ SPELL_AURA_ARENA_PREPARATION
Definition SpellAuraDefines.h:278

References AuraApplication::_HandleEffect(), Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), AuraApplication::GetRemoveMode(), AuraApplication::HasEffect(), Aura::HasEffectType(), Aura::IsRemoved(), m_appliedAuras, MAX_SPELL_EFFECTS, RemoveAura(), and SPELL_AURA_ARENA_PREPARATION.

◆ RemoveAura() [3/4]

void Unit::RemoveAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4824{
4825 AuraApplication* aurApp = i->second;
4826 // Do not remove aura which is already being removed
4827 if (aurApp->GetRemoveMode())
4828 return;
4829 Aura* aura = aurApp->GetBase();
4830 _UnapplyAura(i, mode);
4831 // Remove aura - for Area and Target auras
4832 if (aura->GetOwner() == this)
4833 aura->Remove(mode);
4834
4835 // Aura::Remove can cascade into m_appliedAuras mutations - reset again for the caller
4836 i = m_appliedAuras.begin();
4837}

References _UnapplyAura(), AuraApplication::GetBase(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), m_appliedAuras, and Aura::Remove().

Referenced by boss_marli::_schedulePhaseTroll(), ApplyEmpoweredStacks(), Player::CheckAreaExploreAndOutdoor(), boss_headless_horseman::DamageTaken(), npc_power_spark::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim::DamageTaken(), boss_victor_nefarius::DoAction(), npc_harrison_jones::DoAction(), boss_paletress::DoAction(), brann_bronzebeard::DoAction(), boss_razorscale::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_anubarak_trial::DoAction(), boss_vezax::DoAction(), boss_yoggsaron::DoAction(), boss_yoggsaron_crusher_tentacle::DoAction(), boss_yoggsaron_corruptor_tentacle::DoAction(), boss_yoggsaron_constrictor_tentacle::DoAction(), boss_ichoron::DoExplodeCompleted(), boss_hodir::DoHelperVictoryEmotes(), Player::DuelComplete(), Spell::EffectDispelMechanic(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::EffectTriggerSpell(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), GetDiseasesByCaster(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleBreakableCCAuraProc(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_valanar_kinetic_bomb_aura::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_bloodspore_haze::HandleEffectHit(), spell_midsummer_ribbon_pole::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_dk_presence::HandleEffectRemove(), spell_pal_blessing_of_sanctuary::HandleEffectRemove(), spell_sha_chain_heal::HandleHeal(), spell_sindragosa_frost_breath::HandleInfusion(), spell_warl_demonic_circle_summon::HandleRemove(), spell_putricide_eat_ooze::HandleScript(), spell_handover_reins::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), IsHighestExclusiveAuraEffect(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_jaraxxus::JustEngagedWith(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::JustEngagedWith(), npc_ulduar_snow_mound::MoveInLineOfSight(), boss_loken::OnAuraRemove(), spell_blood_queen_vampiric_bite::OnCast(), npc_toc5_player_vehicle::OnCharmed(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), npc_thrall_bfu::OnQuestReward(), spell_malygos_vortex_visual::OnRemove(), npc_toc5_player_vehicle::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), BattlefieldWG::PromotePlayer(), RemoveAppliedAuras(), RemoveAppliedAuras(), RemoveAreaAurasDueToLeaveWorld(), RemoveAura(), RemoveAura(), RemoveAura(), RemoveAurasByShapeShift(), RemoveAurasByType(), RemoveAurasDueToItemSpell(), RemoveAurasDueToSpell(), RemoveAurasWithAttribute(), RemoveAurasWithFamily(), RemoveAurasWithInterruptFlags(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), BattlegroundIC::RemovePlayer(), BattlegroundMap::RemovePlayerFromMap(), boss_bjarngrim::RemoveStanceAura(), boss_gyth::Reset(), boss_pyroguard_emberseer::Reset(), boss_victor_nefarius::Reset(), boss_marli::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), NPCStaveQuestAI::ResetState(), boss_sartharion::SendLavaWaves(), boss_anomalus::SetData(), boss_hodir::SmallIcicles(), boss_malygos::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_headless_horseman::SpellHit(), boss_viscidus::SpellHit(), spell_pal_hand_of_sacrifice_aura::Split(), boss_sartharion_shadron::SummonedCreatureDies(), boss_pyroguard_emberseer::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_viscidus::UpdateAI(), boss_anubarak_trial::UpdateAI(), npc_nerubian_burrower::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_thorims_hammer::UpdateAI(), boss_freya::UpdateAI(), boss_freya_elder_brightleaf::UpdateAI(), npc_ulduar_iron_construct::UpdateAI(), boss_razorscale::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), Spell::UpdateChanneledTargetList(), npc_hor_lich_king::WallCompleted(), and boss_bjarngrim::WaypointReached().

◆ RemoveAura() [4/4]

void Unit::RemoveAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4840{
4841 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4842 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4843 {
4844 Aura const* aura = iter->second->GetBase();
4845 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4846 && (!caster || aura->GetCasterGUID() == caster))
4847 {
4848 RemoveAura(iter, removeMode);
4849 return;
4850 }
4851 else
4852 ++iter;
4853 }
4854}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

◆ RemoveAuraFromStack()

void Unit::RemoveAuraFromStack ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4979{
4980 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4981 for (AuraMap::iterator iter = range.first; iter != range.second;)
4982 {
4983 Aura* aura = iter->second;
4984 if ((aura->GetType() == UNIT_AURA_TYPE)
4985 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4986 {
4987 aura->ModStackAmount(-1, removeMode);
4988 return;
4989 }
4990 else
4991 ++iter;
4992 }
4993}
@ UNIT_AURA_TYPE
Definition SpellAuraDefines.h:385
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition SpellAuras.cpp:1083
AuraObjectType GetType() const
Definition SpellAuras.cpp:438

References Aura::GetCasterGUID(), Aura::GetType(), m_ownedAuras, Aura::ModStackAmount(), and UNIT_AURA_TYPE.

Referenced by Spell::EffectSchoolDMG(), spell_putricide_gaseous_bloat_aura::HandleExtraEffect(), spell_oculus_evasive_maneuvers_aura::HandleProc(), spell_sha_tidal_force_dummy::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_item_restless_strength::HandleProc(), spell_item_unstable_power::HandleProc(), spell_item_brittle_armor::HandleScript(), spell_item_mercurial_shield::HandleScript(), spell_dispel_freed_soldier_debuff::HandleScriptEffect(), spell_item_deadly_precision::HandleStackDrop(), boss_selin_fireheart::JustEngagedWith(), boss_viscidus::SpellHit(), and Battlefield::TeamCastSpell().

◆ RemoveAurasByShapeShift()

void Unit::RemoveAurasByShapeShift ( )
5356{
5357 uint64 mechanic_mask = (1ULL << MECHANIC_SNARE) | (1ULL << MECHANIC_ROOT);
5358 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5359 {
5360 Aura const* aura = iter->second->GetBase();
5361 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
5363 {
5364 RemoveAura(iter);
5365 continue;
5366 }
5367 ++iter;
5368 }
5369}
@ MECHANIC_ROOT
Definition SharedDefines.h:1320
@ MECHANIC_SNARE
Definition SharedDefines.h:1324
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3788
@ SPELL_ATTR0_CU_AURA_CC
Definition SpellInfo.h:182
uint64 GetAllEffectsMechanicMask() const
Definition SpellInfo.cpp:1940

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), m_appliedAuras, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), SPELL_ATTR0_CU_AURA_CC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::HandleAuraModShapeshift().

◆ RemoveAurasByType()

void Unit::RemoveAurasByType ( AuraType  auraType,
ObjectGuid  casterGUID = ObjectGuid::Empty,
Aura *  except = nullptr,
bool  negative = true,
bool  positive = true 
)
5196{
5197 // simple check if list is empty
5198 if (m_modAuras[auraType].empty())
5199 return;
5200
5201 for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
5202 {
5203 Aura* aura = (*iter)->GetBase();
5205
5206 ++iter;
5207 if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5208 && ((negative && !aurApp->IsPositive()) || (positive && aurApp->IsPositive())))
5209 {
5210 uint32 removedAuras = m_removedAurasCount;
5211 RemoveAura(aurApp);
5212 if (m_removedAurasCount > removedAuras)
5213 iter = m_modAuras[auraType].begin();
5214 }
5215 }
5216}

References Aura::GetApplicationOfTarget(), Aura::GetCasterGUID(), Object::GetGUID(), AuraApplication::IsPositive(), m_modAuras, m_removedAurasCount, and RemoveAura().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), Attack(), npc_toc5_player_vehicle::BeforeSpellClick(), spell_gen_summon_tournament_mount::CheckIfLanceEquipped(), ClearComboPoints(), Player::ContinueTaxiFlight(), boss_kologarn_arms::DamageTaken(), Spell::DoSpellHitOnUnit(), Spell::EffectPowerBurn(), Spell::EffectTriggerSpell(), BattlegroundWS::EventPlayerClickedOnFlag(), ExitVehicle(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModStateImmunity(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_rog_vanish::HandleEffect(), spell_hydross_mark_of_hydross::HandleEffectApply(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleListStabledPetsOpcode(), WorldSession::HandleMoveWorldportAck(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_algalon_remove_phase_aura::HandlePeriodic(), WorldSession::HandlePetitionBuyOpcode(), spell_mage_glyph_of_icy_veins::HandleProc(), spell_mage_glyph_of_polymorph::HandleProc(), WorldSession::HandleQuestgiverHelloOpcode(), spell_gormok_jump_to_hand::HandleRemove(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSaveGuildEmblemOpcode(), spell_gen_mine_sweeper::HandleSchoolDMG(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), spell_q13010_jokkum_summon::HandleSummon(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::HandleUnstablePet(), boss_gurtogg_bloodboil::JustEngagedWith(), Player::LeaveBattleground(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), spell_gen_aura_service_uniform::OnApply(), Player::ProcessDelayedOperations(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Vehicle::RemoveAllPassengers(), RemoveBindSightAuras(), RemoveCharmAuras(), Battleground::RemovePlayerAtLeave(), WorldSession::SendDoFlight(), WorldSession::SendListInventory(), Player::SendLoot(), WorldSession::SendTrainerList(), SetCharmedBy(), Player::StopCastingCharm(), Player::TeleportTo(), GameObject::Use(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ RemoveAurasDueToItemSpell()

void Unit::RemoveAurasDueToItemSpell ( uint32  spellId,
ObjectGuid  castItemGuid 
)
5171{
5172 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5173 {
5174 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
5175 {
5176 RemoveAura(iter);
5177 iter = m_appliedAuras.lower_bound(spellId);
5178 }
5179 else
5180 ++iter;
5181 }
5182
5183 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
5184 {
5185 if (iter->second->GetCastItemGUID() == castItemGuid)
5186 {
5188 iter = m_ownedAuras.lower_bound(spellId);
5189 }
5190 else
5191 ++iter;
5192 }
5193}

References AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, RemoveAura(), and RemoveOwnedAura().

Referenced by Player::ApplyEnchantment(), and Player::ApplyEquipSpell().

◆ RemoveAurasDueToSpell()

void Unit::RemoveAurasDueToSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4963{
4964 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4965 {
4966 Aura const* aura = iter->second->GetBase();
4967 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4968 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4969 {
4970 RemoveAura(iter, removeMode);
4971 iter = m_appliedAuras.lower_bound(spellId);
4972 }
4973 else
4974 ++iter;
4975 }
4976}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

Referenced by Spell::_cast(), Player::_removeTalentAurasAndSpells(), Player::ActivateSpec(), Vehicle::AddPassenger(), spell_commander_sarannis_arcane_devastation::AfterApply(), spell_dru_feral_swiftness::AfterRemove(), spell_dru_savage_roar_aura::AfterRemove(), spell_dru_survival_instincts_aura::AfterRemove(), spell_item_thrallmar_and_honor_hold_favor::AfterRemove(), ApplyEmpoweredStacks(), Player::ApplyEquipSpell(), boss_hakkar::boss_hakkarAI::ApplyHakkarPowerStacks(), Player::ApplyItemObtainSpells(), boss_buru::ChaseNewVictim(), spell_eredar_twins_handle_touch::CheckCast(), boss_volazj::CheckPhaseMinions(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_burning_determination::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), Player::CleanupAfterTaxiFlight(), AuraEffect::CleanupTriggeredSpells(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), spell_ruby_sanctum_rallying_shout::CountAllies(), boss_baron_geddon::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), npc_wild_wyrm::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_buru::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_leotheras_the_blind::DemonTime(), WorldState::DispelAdalsSongOfBattle(), WorldState::DispelMagtheridonTeam(), npc_drakonid_spawner::DoAction(), npc_twilight_volunteer::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), npc_frozen_core::DoAction(), npc_kalecgos_kj::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), npc_pet_gen_argent_pony_bridle::DoAction(), boss_alar::DoDiveBomb(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::DoTriggersOnSpellHit(), Spell::EffectApplyGlyph(), Spell::EffectHeal(), Spell::EffectRemoveAura(), Spell::EffectSchoolDMG(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_zuljin::EnterPhase(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattleExperienceEvent::Execute(), SendEncounterUnit::Execute(), FrostBombExplosion::Execute(), AuraRemoveEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), spell_sindragosa_ice_tomb_trap_aura::ExtraRemoveEffect(), spell_mother_shahraz_fatal_attraction_dummy::FilterTargets(), spell_warr_improved_spell_reflection_trigger::FilterTargets(), lfg::LFGMgr::FinishDungeon(), spell_valkyr_essence_aura::HandleAfterApply(), spell_dru_berserk::HandleAfterCast(), spell_capacitus_polarity_charge_aura::HandleAfterRemove(), spell_amanitar_remove_mushroom_power::HandleApply(), spell_amanitar_potent_fungus::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_moroes_vanish::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_warhead_detonate::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyRemove(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_q12730_quenching_mist::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectRemove(), spell_serpentshrine_cavern_coilfang_water::HandleEffectRemove(), spell_q10769_dissension_amongst_the_ranks_aura::HandleEffectRemove(), boss_ragnaros::HandleEmerge(), spell_midsummer_fling_torch::HandleFinish(), gm_commandscript::HandleGMVisibleCommand(), group_commandscript::HandleGroupReviveCommand(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), spell_transitus_shield_beam_aura::HandleOnEffectRemove(), OPvPCapturePointZM_Graveyard::HandleOpenGo(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_algalon_remove_phase_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldState::HandlePlayerLeaveZone(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), OutdoorPvPNA::HandlePlayerLeaveZone(), OutdoorPvPSI::HandlePlayerLeaveZone(), OutdoorPvPTF::HandlePlayerLeaveZone(), OutdoorPvPZM::HandlePlayerLeaveZone(), spell_gen_consume::HandleProc(), spell_pri_t4_4p_bonus::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_warr_extra_proc::HandleProc(), spell_item_trinket_stack< StackSpell, TriggerSpell >::HandleProc(), spell_item_tiny_abomination_in_a_jar::HandleProc(), spell_item_tiny_abomination_in_a_jar_hero::HandleProc(), spell_putricide_gaseous_bloat_aura::HandleProc(), spell_icc_harvest_blight_specimen::HandleQuestComplete(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleRemove(), spell_dru_enrage::HandleRemove(), spell_pal_divine_intervention::HandleRemove(), spell_pal_avenging_wrath::HandleRemove(), spell_rog_killing_spree_aura::HandleRemove(), spell_warr_vigilance::HandleRemove(), WorldSession::HandleRemoveGlyph(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_putricide_clear_aura_effect_value::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_jump_remove_aura::HandleScript(), spell_icc_harvest_blight_specimen::HandleScript(), spell_anubarak_reset_cleanup::HandleScript(), spell_valkyr_clear_auras::HandleScript(), spell_festergut_pungent_blight::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_generic_remove_empowered_blood::HandleScript(), spell_eject_passenger_wild_wyrm::HandleScript(), spell_gen_cancel_aura::HandleScript(), spell_q10651_q10692_book_of_fel_names::HandleScript(), spell_q12641_death_comes_from_on_high_recall_eye::HandleScriptEffect(), spell_halion_clear_debuffs::HandleScriptEffect(), spell_q12823_remove_collapsing_cave_aura::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), spell_capacitus_polarity_charge::HandleTargets(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnFreezeCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), npc_underbog_mushroom::InitializeAI(), npc_demon_chain::JustDied(), boss_azuregos::boss_azuregosAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_zuljin::JustEngagedWith(), boss_doomwalker::JustEngagedWith(), boss_gruul::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_buru::JustEngagedWith(), boss_bronjahm::JustEngagedWith(), boss_gal_darah::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_flame_leviathan::JustReachedHome(), boss_tenris_mirkblood::KilledUnit(), boss_felblood_kaelthas::LapseAction(), npc_crystalline_frayer::LeaveSeedPod(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_felmyst::MovementInform(), npc_highlord_darion_mograine::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_halion_twilight_realm_aura::OnApply(), spell_halion_leave_twilight_realm_aura::OnApply(), spell_systems_shutdown_aura::OnApply(), npc_chesspiece::OnCharmed(), spell_claw_rage_aura::OnPeriodic(), spell_gen_curse_of_pain::OnPeriodic(), spell_hookshot_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript::OnPlayerLeave(), BattlefieldWG::OnPlayerLeaveZone(), lfg::LFGPlayerScript::OnPlayerMapChanged(), MidsummerPlayerScript::OnPlayerUpdateZone(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_combustion_consumption_aura::OnRemove(), spell_halion_leave_twilight_realm_aura::OnRemove(), spell_jormungars_paralytic_toxin_aura::OnRemove(), spell_icc_empowered_blood::OnRemove(), spell_icc_empowered_blood_3::OnRemove(), spell_algalon_phase_punch_aura::OnRemove(), spell_load_into_catapult_aura::OnRemove(), spell_dru_barkskin::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_hun_ascpect_of_the_viper::OnRemove(), spell_hun_viper_attack_speed::OnRemove(), spell_item_with_mount_speed::OnRemove(), spell_item_desperate_defense::OnRemove(), spell_item_shadowmourne::OnRemove(), spell_item_shadowmourne_soul_fragment::OnRemove(), spell_item_trinket_stack< StackSpell, TriggerSpell >::OnRemove(), spell_item_power_circle::OnRemove(), spell_item_tiny_abomination_in_a_jar::OnRemove(), spell_item_tiny_abomination_in_a_jar_hero::OnRemove(), spell_mage_combustion_proc::OnRemove(), spell_mage_fingers_of_frost::OnRemove(), spell_item_shadowmourne_soul_fragment::OnStackChange(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::PassengerBoarded(), npc_wild_wyrm::PassengerBoarded(), boss_yoggsaron_constrictor_tentacle::PassengerBoarded(), npc_preparations_for_war_vehicle::PassengerBoarded(), boss_jeklik::PathEndReached(), spell_quest_test_flight_charging::PerformKick(), spell_rog_stealth_buff_tracker< RemoveSpellId >::PeriodicTick(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), spell_gen_defend::RefreshVisualShields(), RemoveAurasDueToSpellByDispel(), BattlefieldWG::RemoveAurasFromPlayer(), boss_festergut::boss_festergutAI::RemoveBlight(), spell_warl_health_funnel::RemoveEffect(), RemoveGameObject(), spell_mage_frostfire_bolt::RemovePermafrost(), BattlegroundAV::RemovePlayer(), Battlefield::RemovePlayerFromResurrectQueue(), Battleground::RemovePlayerFromResurrectQueue(), boss_keristrasza::RemovePrison(), npc_anubarak_spike::RemoveSpeedAuras(), Pet::removeSpell(), Player::removeSpell(), spell_gen_eject_all_passengers::RemoveVehicleAuras(), spell_gen_defend::RemoveVisualShields(), boss_malchezaar::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), boss_kiljaeden::Reset(), boss_twilight_corrupter::Reset(), boss_nalorakk::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_thekal::Reset(), boss_cthun::Reset(), boss_viscidus::Reset(), boss_halion::boss_halionAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_freya_lifebinder::Reset(), boss_freya_summons::Reset(), boss_leotheras_the_blind::Reset(), boss_lethon::boss_lethonAI::Reset(), boss_taerar::boss_taerarAI::Reset(), npc_mistress_nagmara::ResetLovePotionEvent(), boss_high_botanist_freywinn::ResumeEncounter(), Player::ResurrectPlayer(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_magtheridon::ScheduleCombatEvents(), boss_supremus::SchedulePhase(), boss_the_lurker_below::SchedulerPhaseTwo(), boss_laj::ScheduleTasks(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), OPvPCapturePointZM_Graveyard::SetBeaconState(), boss_hydross_the_unstable::SetForm(), Player::SetGMVisible(), boss_mandokir::boss_mandokirAI::SetGUID(), Player::SetIsSpectator(), SetModelVisible(), Player::SetSkill(), BattlefieldWG::SetupBattlefield(), npc_aged_dying_ancient_kodo::sGossipHello(), npc_akama_shade::sGossipSelect(), boss_viscidus::SoftReset(), boss_ossirian::SpellHit(), npc_omen::npc_omenAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), advisor_baseAI::SpellHit(), boss_anub_arak::SpellHitTarget(), boss_moorabi::boss_moorabiAI::SpellHitTarget(), boss_ahune::Submerge(), npc_plague_cauldron_target::SummonedCreatureDespawn(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_cthun::SummonedCreatureDies(), npc_kiljaeden_controller::SummonedCreatureDies(), boss_anub_arak::SummonedCreatureDies(), boss_anzu::SummonedCreatureDies(), boss_viscidus::SummonedCreatureDies(), boss_terestian_illhoof::SummonKilrek(), Player::SummonPet(), boss_netherspite::SwitchToBanishPhase(), boss_netherspite::SwitchToPortalPhase(), Totem::UnSummon(), spell_black_temple_spell_absorption_aura::Update(), boss_ragnaros::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_moam::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_freya_healthy_spore::UpdateAI(), boss_mimiron::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_anzu::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_darting_hatchling::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ RemoveAurasDueToSpellByDispel()

void Unit::RemoveAurasDueToSpellByDispel ( uint32  spellId,
uint32  dispellerSpellId,
ObjectGuid  casterGUID,
Unit *  dispeller,
uint8  chargesRemoved = 1 
)
4996{
4997 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4998 for (AuraMap::iterator iter = range.first; iter != range.second;)
4999 {
5000 Aura* aura = iter->second;
5001 if (aura->GetCasterGUID() == casterGUID)
5002 {
5003 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
5004
5005 // Call OnDispel hook on AuraScript
5006 aura->CallScriptDispel(&dispelInfo);
5007
5009 aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
5010 else
5011 aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
5012
5013 // Call AfterDispel hook on AuraScript
5014 aura->CallScriptAfterDispel(&dispelInfo);
5015
5016 switch (aura->GetSpellInfo()->SpellFamilyName)
5017 {
5018 case SPELLFAMILY_HUNTER:
5019 {
5020 // Noxious Stings
5021 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000)
5022 {
5023 if (Unit* caster = aura->GetCaster())
5024 {
5025 if (AuraEffect* aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1))
5026 {
5027 if (Aura* noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster))
5028 {
5029 noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100);
5030 if (aura->GetUnitOwner())
5031 if (std::vector<int32> const* spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId())))
5032 for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
5033 aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr);
5034 }
5035 }
5036 }
5037 }
5038 break;
5039 }
5041 {
5042 // Icy Clutch, remove with Frost Fever
5043 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000)
5044 {
5045 if (AuraEffect* aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID))
5046 RemoveAurasDueToSpell(aureff->GetId());
5047 }
5048 }
5049 default:
5050 break;
5051 }
5052 return;
5053 }
5054 else
5055 ++iter;
5056 }
5057}
void CallScriptDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2515
Unit * GetUnitOwner() const
Definition SpellAuras.h:109
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition SpellAuras.cpp:296
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.cpp:1026
void CallScriptAfterDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2528
Definition Unit.h:310

References AURA_REMOVE_BY_ENEMY_SPELL, Aura::CallScriptAfterDispel(), Aura::CallScriptDispel(), GetAuraEffect(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetDuration(), Aura::GetEffectMask(), Aura::GetId(), DispelInfo::GetRemovedCharges(), Aura::GetSpellInfo(), Aura::GetUnitOwner(), SpellInfo::HasAttribute(), m_ownedAuras, Aura::ModCharges(), Aura::ModStackAmount(), RemoveAurasDueToSpell(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Aura::TryCreate().

Referenced by Spell::EffectDispel().

◆ RemoveAurasDueToSpellBySteal()

void Unit::RemoveAurasDueToSpellBySteal ( uint32  spellId,
ObjectGuid  casterGUID,
Unit *  stealer 
)
5060{
5061 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5062 for (AuraMap::iterator iter = range.first; iter != range.second;)
5063 {
5064 Aura* aura = iter->second;
5065 if (aura->GetCasterGUID() == casterGUID)
5066 {
5067 int32 damage[MAX_SPELL_EFFECTS];
5068 int32 baseDamage[MAX_SPELL_EFFECTS];
5069 uint8 effMask = 0;
5070 Unit* caster = aura->GetCaster();
5071 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5072 {
5073 if (aura->GetEffect(i))
5074 {
5075 baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
5076 // only one stack is stolen
5077 damage[i] = aura->GetEffect(i)->GetAmount() / aura->GetStackAmount();
5078 effMask |= (1 << i);
5079 }
5080 else
5081 {
5082 baseDamage[i] = 0;
5083 damage[i] = 0;
5084 }
5085 }
5086
5088 // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
5089 uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
5090
5091 // Stolen copies are cast by the stealer, so this also finds its own cast of the spell. Only add a stack or
5092 // charge to it: refreshing a non-stacking own cast (Ice Barrier, Arcane Intellect) would re-fill or shorten it
5093 Aura* oldAura = nullptr;
5094 if (stealCharge || aura->GetSpellInfo()->StackAmount > 1)
5095 oldAura = stealer->GetAura(aura->GetId(), stealer->GetGUID());
5096
5097 if (oldAura)
5098 {
5099 if (stealCharge)
5100 oldAura->ModCharges(1);
5101 else
5102 {
5103 uint8 const oldStackAmount = oldAura->GetStackAmount();
5104 int32 oldAmount[MAX_SPELL_EFFECTS] = { };
5105 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5106 if (AuraEffect* aurEff = oldAura->GetEffect(i))
5107 oldAmount[i] = aurEff->GetAmount();
5108
5109 oldAura->ModStackAmount(1);
5110
5111 // The stack change recalculated amounts and max duration with the stealer as caster, keep the
5112 // original caster's ones like a newly stolen copy does
5113 bool const stacked = oldAura->GetStackAmount() > oldStackAmount;
5114 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5115 if (AuraEffect* aurEff = oldAura->GetEffect(i))
5116 aurEff->ChangeAmount(oldAmount[i] + (stacked ? damage[i] : 0));
5117
5118 oldAura->SetMaxDuration(aura->GetMaxDuration());
5119 }
5120
5121 oldAura->SetDuration(int32(dur));
5122 }
5123 else
5124 {
5125 // single target state must be removed before aura creation to preserve existing single target aura
5126 if (aura->IsSingleTarget())
5127 aura->UnregisterSingleTarget();
5128
5129 // Xinef: if stealer has same aura
5130 Aura* curAura = stealer->GetAura(aura->GetId());
5131 if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
5132 if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, stealer->GetGUID()))
5133 {
5134 // created aura must not be single target aura,, so stealer won't loose it on recast
5135 if (newAura->IsSingleTarget())
5136 {
5137 newAura->UnregisterSingleTarget();
5138 // bring back single target aura status to the old aura
5139 aura->SetIsSingleTarget(true);
5140 caster->GetSingleCastAuras().push_back(aura);
5141 }
5142 // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
5143 // Keep the original caster's amounts: recalculating them with the stealer as caster would apply
5144 // the stealer's spell mods and bonuses (e.g. Magic Attunement on a stolen Dampen Magic)
5145 newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur),
5146 stealCharge ? 1 : aura->GetCharges(), 1, 0, &damage[0]);
5147
5148 // Reset periodic timers so stolen HoTs tick properly
5149 // For stolen auras we need fresh tick counters since no ticks have occurred yet
5150 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5151 if (AuraEffect* aurEff = newAura->GetEffect(i))
5152 aurEff->ResetPeriodic(true);
5153
5154 newAura->ApplyForTargets();
5155 }
5156 }
5157
5158 if (stealCharge)
5160 else
5162
5163 return;
5164 }
5165 else
5166 ++iter;
5167 }
5168}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
int32 GetBaseAmount() const
Definition SpellAuraEffects.h:57
void UnregisterSingleTarget()
Definition SpellAuras.cpp:1240
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:178
bool IsPermanent() const
Definition SpellAuras.h:141
uint32 StackAmount
Definition SpellInfo.h:395

References AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAura(), AuraEffect::GetBaseAmount(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetCharges(), Aura::GetDuration(), Aura::GetEffect(), Object::GetGUID(), Aura::GetId(), Aura::GetMaxDuration(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::GetStackAmount(), SpellInfo::HasAttribute(), IN_MILLISECONDS, Aura::IsPermanent(), Aura::IsSingleTarget(), m_ownedAuras, MAX_SPELL_EFFECTS, MINUTE, Aura::ModCharges(), Aura::ModStackAmount(), Aura::SetDuration(), Aura::SetIsSingleTarget(), Aura::SetMaxDuration(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SpellInfo::StackAmount, Aura::TryRefreshStackOrCreate(), and Aura::UnregisterSingleTarget().

Referenced by Spell::EffectStealBeneficialBuff().

◆ RemoveAurasWithAttribute()

void Unit::RemoveAurasWithAttribute ( uint32  flags)
5219{
5220 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5221 {
5222 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
5223 if (spell->Attributes & flags)
5224 RemoveAura(iter);
5225 else
5226 ++iter;
5227 }
5228}

References SpellInfo::Attributes, m_appliedAuras, and RemoveAura().

◆ RemoveAurasWithFamily()

void Unit::RemoveAurasWithFamily ( SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID 
)
5302{
5303 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5304 {
5305 Aura const* aura = iter->second->GetBase();
5306 if (!casterGUID || aura->GetCasterGUID() == casterGUID)
5307 {
5308 SpellInfo const* spell = aura->GetSpellInfo();
5309 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5310 {
5311 RemoveAura(iter);
5312 continue;
5313 }
5314 }
5315 ++iter;
5316 }
5317}

References Aura::GetCasterGUID(), Aura::GetSpellInfo(), flag96::HasFlag(), m_appliedAuras, RemoveAura(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by spell_warl_demonic_aegis::HandleAuraApply(), and Aura::HandleAuraSpecificMods().

◆ RemoveAurasWithInterruptFlags()

void Unit::RemoveAurasWithInterruptFlags ( uint32  flag,
uint32  except = 0,
bool  isAutoshot = false 
)
5267{
5268 if (!(m_interruptMask & flag))
5269 return;
5270
5271 // interrupt auras
5272 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
5273 {
5274 Aura* aura = (*iter)->GetBase();
5275 ++iter;
5276 if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
5277 {
5278 uint32 removedAuras = m_removedAurasCount;
5279 RemoveAura(aura);
5280 if (m_removedAurasCount > removedAuras + 1)
5281 iter = m_interruptableAuras.begin();
5282 }
5283 }
5284
5285 // interrupt channeled spell
5287 {
5288 if (spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->ChannelInterruptFlags & flag) && spell->m_spellInfo->Id != except)
5289 {
5290 // Do not interrupt if auto shot
5291 if (!(isAutoshot && spell->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)))
5292 {
5293 InterruptNonMeleeSpells(false, spell->m_spellInfo->Id);
5294 }
5295 }
5296 }
5297
5299}

References SpellInfo::AuraInterruptFlags, CURRENT_CHANNELED_SPELL, Aura::GetId(), Aura::GetSpellInfo(), InterruptNonMeleeSpells(), m_currentSpells, m_interruptableAuras, m_interruptMask, m_removedAurasCount, RemoveAura(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_CASTING, and UpdateInterruptMask().

Referenced by _EnterVehicle(), AtExitCombat(), AttackerStateUpdate(), AtTargetAttacked(), ClearInPetCombat(), DealDamage(), Dismount(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), spell_rog_killing_spree::FilterTargets(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModStealth(), AuraEffect::HandleModUnattackable(), WorldSession::HandleMoverRelocation(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePhase(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), Mount(), Spell::prepare(), WorldSession::ProcessMovementInfo(), ProcessTerrainStatusUpdate(), Player::SetInWater(), SetStandState(), Player::TeleportTo(), and UpdatePosition().

◆ RemoveAurasWithMechanic()

void Unit::RemoveAurasWithMechanic ( uint64  mechanic_mask,
AuraRemoveMode  removemode = AURA_REMOVE_BY_DEFAULT,
uint32  except = 0 
)
5339{
5340 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5341 {
5342 Aura const* aura = iter->second->GetBase();
5343 if (!except || aura->GetId() != except)
5344 {
5345 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
5346 {
5347 RemoveAura(iter, removemode);
5348 continue;
5349 }
5350 }
5351 ++iter;
5352 }
5353}

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetId(), Aura::GetSpellInfo(), m_appliedAuras, and RemoveAura().

Referenced by SpellInfo::ApplyAllSpellImmunitiesTo(), spell_rog_vanish_purge::HandleRootRemove(), spell_rog_vanish_purge::HandleSnareRemove(), and RemoveMovementImpairingAuras().

◆ RemoveBindSightAuras()

void Unit::RemoveBindSightAuras ( )
8136{
8138}
@ SPELL_AURA_BIND_SIGHT
Definition SpellAuraDefines.h:64

References RemoveAurasByType(), and SPELL_AURA_BIND_SIGHT.

Referenced by RemoveFromWorld().

◆ RemoveCharmAuras()

void Unit::RemoveCharmAuras ( )

◆ RemoveCharmedBy()

void Unit::RemoveCharmedBy ( Unit *  charmer)
14519{
14520 if (!IsCharmed())
14521 return;
14522
14523 if (!charmer)
14524 charmer = GetCharmer();
14525 if (charmer != GetCharmer()) // one aura overrides another?
14526 {
14527 // LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: {} true charmer: {} false charmer: {}",
14528 // GetGUID().ToString(), GetCharmerGUID().ToString(), charmer->GetGUID().ToString());
14529 // ABORT();
14530 return;
14531 }
14532
14533 CharmType type;
14535 type = CHARM_TYPE_POSSESS;
14536 else if (charmer && charmer->IsOnVehicle(this))
14537 type = CHARM_TYPE_VEHICLE;
14538 else
14539 type = CHARM_TYPE_CHARM;
14540
14541 if (_oldFactionId)
14542 {
14544 _oldFactionId = 0;
14545 }
14546 else
14548
14549 CastStop();
14550 AttackStop();
14551
14552 // xinef: do not break any controlled motion slot
14553 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
14554 {
14555 StopMoving();
14557 }
14558 // xinef: if we have any controlled movement, clear active and idle only
14559 else
14561
14563
14564 // xinef: remove stunned flag if owner was mounted
14567
14568 // If charmer still exists
14569 if (!charmer)
14570 return;
14571
14572 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
14573 ASSERT(type != CHARM_TYPE_VEHICLE || (IsCreature() && IsVehicle()));
14574
14575 // Vehicle should not attack its passenger after he exits the seat
14576 if (type != CHARM_TYPE_VEHICLE)
14577 LastCharmerGUID = charmer->GetGUID();
14578
14579 charmer->SetCharm(this, false);
14580
14582
14583 // End stale combat refs between now-friendly units after faction restore
14585
14586 Player* playerCharmer = charmer->ToPlayer();
14587 if (playerCharmer)
14588 {
14589 switch (type)
14590 {
14591 case CHARM_TYPE_VEHICLE:
14592 playerCharmer->SetClientControl(this, false);
14593 playerCharmer->SetClientControl(charmer, true); // verified
14596 break;
14597 case CHARM_TYPE_POSSESS:
14598 playerCharmer->SetClientControl(this, false);
14599 playerCharmer->SetClientControl(charmer, true); // verified
14604 break;
14605 case CHARM_TYPE_CHARM:
14607 {
14609 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
14610 {
14612 if (GetCharmInfo())
14613 GetCharmInfo()->SetPetNumber(0, true);
14614 else
14615 LOG_ERROR("entities.unit", "Aura::HandleModCharm: target={} has a charm aura but no charm info!", GetGUID().ToString());
14616 }
14617 }
14618 break;
14619 default:
14620 break;
14621 }
14622 }
14623
14624 if (Player* player = ToPlayer())
14625 {
14626 sScriptMgr->AnticheatSetUnderACKmount(player);
14627 }
14628
14629 // xinef: restore threat
14630 for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
14631 {
14632 if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first))
14633 if (!IsFriendlyTo(target))
14634 AddThreat(target, itr->second);
14635 }
14636
14637 _charmThreatInfo.clear();
14638
14639 if (Creature* creature = ToCreature())
14640 {
14641 // Vehicle should not attack its passenger after he exists the seat
14642 if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature))
14643 if (Attack(charmer, true))
14644 GetMotionMaster()->MoveChase(charmer);
14645
14646 // Creature will restore its old AI on next update
14647 if (creature->AI())
14648 creature->AI()->OnCharmed(false);
14649
14650 // Xinef: Remove movement flag flying
14652 }
14653 else
14654 {
14655 Player* targetPlayer = ToPlayer();
14656 targetPlayer->SetClientControl(this, true); // verified
14657
14658 // Re-sync only the speed types that changed during the charm.
14659 for (uint8 i = MOVE_WALK; i < MAX_MOVE_TYPE; ++i)
14661 SendSpeedToController(UnitMoveType(i), targetPlayer);
14662 }
14663
14664 // a guardian should always have charminfo
14665 if (playerCharmer && this != charmer->GetFirstControlled())
14666 playerCharmer->SendRemoveControlBar();
14667
14668 // xinef: Always delete charm info (restores react state)
14669 if (IsPlayer() || (IsCreature() && !ToCreature()->IsGuardian()))
14671}
CharmType
Definition CharmInfo.h:44
@ CHARM_TYPE_CHARM
Definition CharmInfo.h:45
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
@ CHARM_TYPE_VEHICLE
Definition CharmInfo.h:47
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:65
@ NULL_MOTION_TYPE
Definition MotionMaster.h:59
@ CREATURE_TYPE_DEMON
Definition SharedDefines.h:2624
@ CLASS_WARLOCK
Definition SharedDefines.h:134
@ CLASS_CONTEXT_PET_CHARM
Definition UnitDefines.h:244
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition UnitDefines.h:201
UnitMoveType
Definition UnitDefines.h:355
@ MOVE_WALK
Definition UnitDefines.h:356
void RevalidateCombat()
Definition CombatManager.cpp:353
void InitDefault()
Definition MotionMaster.cpp:90
void MovementExpired(bool reset=true)
Definition MotionMaster.h:207
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:748
void SendRemoveControlBar()
Definition Player.cpp:10033
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition Player.cpp:13243
void DeleteCharmInfo()
Definition Unit.cpp:12370
void RestoreFaction()
Definition Unit.cpp:14673
void SetCharm(Unit *target, bool apply)
Definition Unit.cpp:7810
float _charmStartSpeedRate[MAX_MOVE_TYPE]
Definition Unit.h:2210
void StopAttackingInvalidTarget()
Definition Unit.cpp:15856
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Interrupt the unit cast for all the current spells.
Definition Unit.cpp:1364
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:7127
CharmThreatMap _charmThreatInfo
Definition Unit.h:2223
Unit * GetFirstControlled() const
Definition Unit.cpp:8014
void SendSpeedToController(UnitMoveType mtype, Player *target) const
Definition Unit.cpp:11180
void RemoveUnitMovementFlag(uint32 f)
Definition Unit.h:779
ObjectGuid LastCharmerGUID
Definition Unit.h:2117
uint32 unit_class
Definition CreatureData.h:213

References _charmStartSpeedRate, _charmThreatInfo, _oldFactionId, AddThreat(), ASSERT, Attack(), AttackStop(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, CLASS_CONTEXT_PET_CHARM, CLASS_WARLOCK, ClearUnitState(), CREATURE_TYPE_DEMON, DeleteCharmInfo(), GetCharmer(), GetCharmInfo(), GetCombatManager(), Creature::GetCreatureTemplate(), GetFirstControlled(), Object::GetGUID(), Object::GetGUID(), GetMotionMaster(), ObjectAccessor::GetUnit(), HasUnitState(), MotionMaster::InitDefault(), IsAlive(), IsCharmed(), IsClass(), Object::IsCreature(), IsFriendlyTo(), IsGuardian(), IsOnVehicle(), Object::IsPlayer(), IsVehicle(), LastCharmerGUID, LOG_ERROR, m_speed_rate, MAX_MOVE_TYPE, MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOVE_WALK, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), MotionMaster::MovementExpiredOnSlot(), MOVEMENTFLAG_FLYING, NULL_MOTION_TYPE, RemoveUnitFlag(), RemoveUnitMovementFlag(), RestoreFaction(), CombatManager::RevalidateCombat(), Player::SendRemoveControlBar(), SendSpeedToController(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), sScriptMgr, StopAttackingInvalidTarget(), StopMoving(), Object::ToCreature(), Object::ToPlayer(), Position::ToString(), CreatureTemplate::type, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_FLAG_STUNNED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and UNIT_STATE_STUNNED.

Referenced by AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), npc_chesspiece::JustDied(), Puppet::RemoveFromWorld(), Vehicle::RemovePassenger(), and npc_chesspiece::sGossipSelect().

◆ RemoveComboPointHolder()

void Unit::RemoveComboPointHolder ( Unit *  unit)
inline
1038{ m_ComboPointHolders.erase(unit); }

References m_ComboPointHolders.

Referenced by AddComboPoints(), and ClearComboPoints().

◆ RemoveDynObject()

bool Unit::RemoveDynObject ( uint32  spellId)
6346{
6347 if (m_dynObj.empty())
6348 return false;
6349
6350 bool result = false;
6351 for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
6352 {
6353 DynamicObject* dynObj = *i;
6354 if (dynObj->GetSpellId() == spellId)
6355 {
6356 dynObj->Remove();
6357 i = m_dynObj.begin();
6358 result = true;
6359 }
6360 else
6361 ++i;
6362 }
6363
6364 return result;
6365}
void Remove()
Definition DynamicObject.cpp:180

References DynamicObject::GetSpellId(), m_dynObj, and DynamicObject::Remove().

Referenced by Spell::cancel(), Spell::EffectAddFarsight(), and spell_item_shifting_naaru_silver::OnBaseRemove().

◆ RemoveEvadeAuras()

void Unit::RemoveEvadeAuras ( )
5529{
5531 return;
5532
5533 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5534 {
5535 Aura const* aura = iter->second->GetBase();
5536 SpellInfo const* spellInfo = aura->GetSpellInfo();
5538 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5539 ++iter;
5540 else
5542 }
5543
5544 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5545 {
5546 Aura* aura = iter->second;
5547 SpellInfo const* spellInfo = aura->GetSpellInfo();
5549 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5550 ++iter;
5551 else
5553 }
5554}
@ SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT
Definition SharedDefines.h:432
@ SPELL_ATTR0_CU_IGNORE_EVADE
Definition SpellInfo.h:188

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, GetOwnerGUID(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), IsCharmedOwnedByPlayerOrPlayer(), Aura::IsPassive(), ObjectGuid::IsPlayer(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CLONE_CASTER, and SPELL_AURA_CONTROL_VEHICLE.

Referenced by CreatureAI::_EnterEvadeMode(), and npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode().

◆ RemoveExtraUnitMovementFlag()

void Unit::RemoveExtraUnitMovementFlag ( uint16  f)
inline

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

12241{
12242 // cleanup
12243 ASSERT(GetGUID());
12244
12245 if (IsInWorld())
12246 {
12248 if (IsAIEnabled)
12249 GetAI()->OnDespawn();
12250
12251 if (IsVehicle())
12253
12257
12260
12261 ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
12264
12266
12268
12269 if (GetCharmerGUID())
12270 {
12271 LOG_FATAL("entities.unit", "Unit {} has charmer guid when removed from world", GetEntry());
12272 ABORT();
12273 }
12274
12275 if (Unit* owner = GetOwner())
12276 {
12277 if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
12278 {
12280 owner->SetMinion((Minion*)this, false);
12281 LOG_INFO("entities.unit", "Unit {} is in controlled list of {} when removed from world", GetEntry(), owner->GetEntry());
12282 //ABORT();
12283 }
12284 }
12285
12288 }
12289}
virtual void OnDespawn()
Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing...
Definition UnitAI.h:361
void RemoveNotOwnSingleTargetAuras()
Definition Unit.cpp:5230
void UnsummonAllTotems(bool onDeath=false)
Definition Unit.cpp:8148
void RemoveAllDynObjects()
Definition Unit.cpp:6367
void RemoveAreaAurasDueToLeaveWorld()
Definition Unit.cpp:5371
void RemoveBindSightAuras()
Definition Unit.cpp:8135
void RemoveAllControlled(bool onDeath=false)
Definition Unit.cpp:8025
void RemoveFromWorld() override
Definition Object.cpp:1233

References ABORT, ASSERT, ExitVehicle(), GetAI(), GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwner(), HasUnitTypeMask(), IsAIEnabled, Object::IsInWorld(), IsVehicle(), LOG_FATAL, LOG_INFO, m_duringRemoveFromWorld, UnitAI::OnDespawn(), RemoveAllControlled(), RemoveAllDynObjects(), RemoveAllFollowers(), RemoveAllGameObjects(), RemoveAreaAurasDueToLeaveWorld(), RemoveBindSightAuras(), RemoveCharmAuras(), WorldObject::RemoveFromWorld(), RemoveNotOwnSingleTargetAuras(), RemoveVehicleKit(), UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UnsummonAllTotems().

Referenced by CleanupBeforeRemoveFromMap(), Creature::RemoveFromWorld(), Pet::RemoveFromWorld(), and Player::RemoveFromWorld().

◆ RemoveGameObject() [1/2]

void Unit::RemoveGameObject ( GameObject *  gameObj,
bool  del 
)
6402{
6403 if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
6404 return;
6405
6407
6408 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
6409 {
6410 if (m_ObjectSlot[i] == gameObj->GetGUID())
6411 {
6412 m_ObjectSlot[i].Clear();
6413 break;
6414 }
6415 }
6416
6417 // GO created by some spell
6418 if (uint32 spellid = gameObj->GetSpellId())
6419 {
6420 RemoveAurasDueToSpell(spellid);
6421
6422 if (IsPlayer())
6423 {
6424 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
6425 // Need activate spell use for owner
6426 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6427 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6428 ToPlayer()->SendCooldownEvent(createBySpell);
6429 }
6430 }
6431
6432 m_gameObj.remove(gameObj->GetGUID());
6433
6434 if (del)
6435 {
6436 gameObj->SetRespawnTime(0);
6437 gameObj->Delete();
6438 }
6439}
void Clear()
Definition ObjectGuid.h:141
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11339

References ObjectGuid::Clear(), GameObject::Delete(), ObjectGuid::Empty, Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, m_ObjectSlot, MAX_GAMEOBJECT_SLOT, RemoveAurasDueToSpell(), Player::SendCooldownEvent(), GameObject::SetOwnerGUID(), GameObject::SetRespawnTime(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::cancel(), Spell::EffectSummonObject(), gobject_commandscript::HandleGameObjectDeleteCommand(), spell_warl_demonic_circle_summon::HandleRemove(), boss_kologarn::JustDied(), boss_sapphiron::boss_sapphironAI::Reset(), and GameObject::Update().

◆ RemoveGameObject() [2/2]

void Unit::RemoveGameObject ( uint32  spellid,
bool  del 
)
6442{
6443 if (m_gameObj.empty())
6444 return;
6445
6446 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6447 {
6448 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6449 {
6450 if (spellid > 0 && go->GetSpellId() != spellid)
6451 {
6452 ++itr;
6453 continue;
6454 }
6455
6456 go->SetOwnerGUID(ObjectGuid::Empty);
6457 if (del)
6458 {
6459 go->SetRespawnTime(0);
6460 go->Delete();
6461 }
6462 }
6463 m_gameObj.erase(itr++);
6464 }
6465}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

◆ RemoveGameObjectsByType()

void Unit::RemoveGameObjectsByType ( GameobjectTypes  type,
bool  del 
)
6468{
6469 if (m_gameObj.empty())
6470 return;
6471
6472 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6473 {
6474 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6475 {
6476 if (go->GetGoType() != type)
6477 {
6478 ++itr;
6479 continue;
6480 }
6481
6482 go->SetOwnerGUID(ObjectGuid::Empty);
6483 if (del)
6484 {
6485 go->SetRespawnTime(0);
6486 go->Delete();
6487 }
6488 }
6489 m_gameObj.erase(itr++);
6490 }
6491}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Spell::EffectTransmitted().

◆ RemoveMovementImpairingAuras()

void Unit::RemoveMovementImpairingAuras ( bool  withRoot)
5320{
5321 if (withRoot)
5323
5324 // Snares
5325 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5326 {
5327 Aura const* aura = iter->second->GetBase();
5329 {
5330 RemoveAura(iter);
5331 continue;
5332 }
5333
5334 ++iter;
5335 }
5336}
bool HasEffectMechanic(Mechanics mechanic) const
Definition SpellInfo.cpp:897
void RemoveAurasWithMechanic(uint64 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition Unit.cpp:5338

References Aura::GetSpellInfo(), SpellInfo::HasEffectMechanic(), m_appliedAuras, SpellInfo::Mechanic, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), and RemoveAurasWithMechanic().

Referenced by Spell::CheckCast(), Spell::EffectTriggerSpell(), spell_pri_improved_shadowform::HandleProc(), spell_pri_imp_shadowform::HandleProc(), and spell_gen_remove_impairing_auras::HandleScriptEffect().

◆ RemoveNotOwnSingleTargetAuras()

void Unit::RemoveNotOwnSingleTargetAuras ( )
5231{
5232 // single target auras from other casters
5233 // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras).
5234 // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras.
5235 // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container
5236 // leading to assertion failures if the aura was cast on a player that can
5237 // (and is changing map at the point where this function is called).
5238 // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
5239 // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
5240 // to register in m_appliedAuras
5241 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5242 {
5243 Aura const* aura = iter->second;
5244
5245 if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget())
5246 RemoveOwnedAura(iter);
5247 else
5248 ++iter;
5249 }
5250
5251 // single target auras at other targets
5252 AuraList& scAuras = GetSingleCastAuras();
5253 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
5254 {
5255 Aura* aura = *iter;
5256 if (aura->GetUnitOwner() != this)
5257 {
5258 aura->Remove();
5259 iter = scAuras.begin();
5260 }
5261 else
5262 ++iter;
5263 }
5264}

References Aura::GetCasterGUID(), Object::GetGUID(), GetSingleCastAuras(), Aura::GetUnitOwner(), Aura::IsSingleTarget(), m_ownedAuras, Aura::Remove(), and RemoveOwnedAura().

Referenced by RemoveFromWorld().

◆ RemoveNpcFlag()

void Unit::RemoveNpcFlag ( NPCFlags  flags)
inline
771{ RemoveFlag(UNIT_NPC_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_vaelastrasz::BeginSpeech(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_rocknot::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_fos_leader::npc_fos_leaderAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), brann_bronzebeard::DoAction(), npc_akama_illidan::DoAction(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::EndBattle(), spell_q12096_q12092_dummy::HandleDummy(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), npc_precious::npc_preciousAI::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), npc_fos_leader_second::npc_fos_leader_secondAI::npc_fos_leader_secondAI(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_hyjal_jaina::OnGossipSelect(), npc_hyjal_thrall::OnGossipSelect(), npc_zulaman_hostage::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_battle_at_valhalas::OnQuestAccept(), npc_riggle_bassbait::OnQuestReward(), boss_flame_leviathan_overload_device::OnSpellClick(), NPCStaveQuestAI::PrepareForEncounter(), RemoveVehicleKit(), boss_majordomo::Reset(), npc_arthas::npc_arthasAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), brann_bronzebeard::Reset(), npc_lake_frog::npc_lake_frogAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), Vehicle::SetBoardableByPlayers(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::sGossipSelect(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::sGossipSelect(), boss_doomrel::sGossipSelect(), boss_apothecary_hummel::boss_apothecary_hummelAI::sGossipSelect(), boss_majordomo::sGossipSelect(), boss_victor_nefarius::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_announcer_toc5::sGossipSelect(), npc_general_andorov::sGossipSelect(), brann_bronzebeard::sGossipSelect(), npc_expedition_commander::sGossipSelect(), npc_akama_shade::sGossipSelect(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_chesspiece::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_deathstalker_fearleia::sQuestAccept(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::StartBattle(), npc_koltira_deathweaver::StartEvent(), npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), and Vehicle::Vehicle().

◆ RemoveOwnedAura() [1/3]

void Unit::RemoveOwnedAura ( Aura *  aura,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4786{
4787 if (aura->IsRemoved())
4788 return;
4789
4790 ASSERT(aura->GetOwner() == this);
4791
4792 uint32 spellId = aura->GetId();
4793 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4794
4795 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
4796 {
4797 if (itr->second == aura)
4798 {
4799 RemoveOwnedAura(itr, removeMode);
4800 return;
4801 }
4802 }
4803
4804 ABORT();
4805}

References ABORT, ASSERT, Aura::GetId(), Aura::GetOwner(), Aura::IsRemoved(), m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAura() [2/3]

void Unit::RemoveOwnedAura ( AuraMap::iterator &  i,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)

◆ RemoveOwnedAura() [3/3]

void Unit::RemoveOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4774{
4775 for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
4776 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
4777 {
4778 RemoveOwnedAura(itr, removeMode);
4779 itr = m_ownedAuras.lower_bound(spellId);
4780 }
4781 else
4782 ++itr;
4783}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [1/2]

void Unit::RemoveOwnedAuras ( std::function< bool(Aura const *)> const &  check)
4908{
4909 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
4910 {
4911 if (check(iter->second))
4912 {
4913 RemoveOwnedAura(iter);
4914 continue;
4915 }
4916 ++iter;
4917 }
4918}

References m_ownedAuras, and RemoveOwnedAura().

Referenced by _RemoveNoStackAurasDueToAura(), and Player::RemoveOrphanedItemObtainSpells().

◆ RemoveOwnedAuras() [2/2]

void Unit::RemoveOwnedAuras ( uint32  spellId,
std::function< bool(Aura const *)> const &  check 
)
4935{
4936 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
4937 {
4938 if (check(iter->second))
4939 {
4940 RemoveOwnedAura(iter);
4941 continue;
4942 }
4943 ++iter;
4944 }
4945}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemovePetAura()

void Unit::RemovePetAura ( PetAura const *  petSpell)
13414{
13415 if (!IsPlayer())
13416 return;
13417
13418 m_petAuras.erase(petSpell);
13419 if (Pet* pet = ToPlayer()->GetPet())
13420 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
13421 if (Unit* charm = GetCharm())
13422 charm->RemoveAurasDueToSpell(petSpell->GetAura(charm->GetEntry()));
13423}

References PetAura::GetAura(), GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Player::_removeTalentAurasAndSpells(), Pet::CastPetAuras(), AuraEffect::HandleAuraDummy(), and Player::removeSpell().

◆ RemovePlayerFromVision()

void Unit::RemovePlayerFromVision ( Player *  player)
Todo:
: This isn't right, if a previously active object was set to active with e.g. Mind Vision this will make them no longer active
8126{
8127 m_sharedVision.remove(player);
8128 player->m_isInSharedVisionOf.erase(this);
8129
8131 if (m_sharedVision.empty())
8132 setActive(false);
8133}

References Player::m_isInSharedVisionOf, m_sharedVision, and WorldObject::setActive().

Referenced by Player::SetViewpoint(), and Player::~Player().

◆ RemovePointedBy()

void Unit::RemovePointedBy ( SafeUnitPointer *  sup)
inline

◆ RemoveStandFlags()

void Unit::RemoveStandFlags ( uint8  flags)
inline
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:28
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:921

References Object::RemoveByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, and UNIT_FIELD_BYTES_1.

Referenced by AuraEffect::HandleModStealth(), Player::InitStatsForLevel(), and npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI().

◆ RemoveUnitFlag()

void Unit::RemoveUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

755{ RemoveFlag(UNIT_FIELD_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_FIELD_FLAGS.

Referenced by at_hol_hall_of_watchers::_OnTrigger(), npc_rocknot::AbortLovePotionEvent(), spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), boss_flame_leviathan_seat::ActivateTurret(), Player::BuildPlayerRepop(), boss_thekal::CheckPhaseTransition(), Player::CleanupAfterTaxiFlight(), ClearInCombat(), ClearInPetCombat(), boss_alar::DamageTaken(), DisableRotate(), boss_thorim::DisableThorim(), Dismount(), boss_xt002::DisposeHeart(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_thekal::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_grand_champion::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_living_constellation::DoAction(), npc_expedition_trapper::DoAction(), npc_xt002_heart::DoAction(), boss_the_lurker_below::DoAction(), npc_frozen_core::DoAction(), boss_broggok::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_cthun::DoAction(), boss_anubarak_trial::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_kelidan_the_breaker::DoAction(), boss_ichoron::DoExplodeCompleted(), HomeMovementGenerator< Creature >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WorldSession::DoLootRelease(), Spell::EffectResurrectPet(), Spell::EffectSkinning(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_yoggsaron_sara::EnableSara(), boss_bronjahm::EnterEvadeMode(), npc_ghostly_priest::EnterEvadeMode(), npc_phantom_mage::EnterEvadeMode(), npc_shadowy_mercenary::EnterEvadeMode(), npc_spectral_footman::EnterEvadeMode(), npc_tortured_rifleman::EnterEvadeMode(), boss_kelthuzad::boss_kelthuzadAI::EnterEvadeMode(), boss_malygos::EnterEvadeMode(), boss_ymiron::boss_ymironAI::EnterEvadeMode(), npc_overlord_drakuru_betrayal::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), SACActivateEvent::Execute(), PlayerCanFlyControlLossTest::ExpectRevokeReplayedAfter(), boss_ingvar_the_plunderer::FeignDeath(), TimedFleeingMovementGenerator::Finalize(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_feign_death_all_flags::HandleEffectRemove(), spell_gen_feign_death_no_dyn_flag::HandleEffectRemove(), spell_gen_feign_death_no_prevent_emotes::HandleEffectRemove(), boss_ragnaros::HandleEmerge(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLogoutCancelOpcode(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), WorldSession::HandlePlayerLoginToCharInWorld(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_vaelastrasz::Initialize(), boss_kiljaeden::InitializeAI(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), npc_onyxian_whelp::IsSummonedBy(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), boss_volazj::JustDied(), boss_xt002::JustDied(), boss_taerar::boss_taerarAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_ichoron::JustDied(), boss_ymiron::boss_ymironAI::JustEngagedWith(), boss_novos::JustEngagedWith(), npc_rocknot::JustReachedHome(), boss_hazzarah::JustSummoned(), npc_crystalline_frayer::LeaveSeedPod(), boss_taldaram::MovementInform(), boss_grand_champion::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_expedition_defender::MovementInform(), npc_memory::npc_memory(), npc_toc5_player_vehicle::OnCharmed(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), npc_bessy::OnQuestAccept(), spell_halion_twilight_phasing_aura::OnRemove(), npc_hover_disk::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), RemoveCharmedBy(), Vehicle::RemovePassenger(), boss_keristrasza::RemovePrison(), npc_rocknot::Reset(), boss_lord_valthalak::Reset(), boss_rend_blackhand::Reset(), boss_victor_nefarius::Reset(), boss_ragnaros::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_crone::Reset(), boss_julianne::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), boss_kalecgos::Reset(), boss_kiljaeden::Reset(), boss_muru::Reset(), npc_harrison_jones::Reset(), npc_amanishi_lookout::Reset(), boss_eye_of_cthun::Reset(), boss_volazj::Reset(), boss_anub_arak::Reset(), boss_sartharion_dragonAI::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_grand_champion::Reset(), boss_novos::Reset(), boss_bronjahm::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_malygos::Reset(), npc_crystalline_frayer::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_flame_leviathan::Reset(), boss_freya_elder_stonebark::Reset(), boss_freya_elder_brightleaf::Reset(), boss_freya_elder_ironbranch::Reset(), boss_mimiron::Reset(), npc_ulduar_leviathan_mkii::Reset(), boss_xt002::Reset(), boss_ingvar_the_plunderer::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_ichoron::Reset(), npc_wounded_skirmisher::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_leotheras_the_blind::Reset(), npc_shattered_hand_scout::Reset(), boss_kaelthas::Reset(), advisor_baseAI::Reset(), emerald_dragonAI::Reset(), npc_doctor::npc_doctorAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_mistress_nagmara::ResetLovePotionEvent(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_the_lurker_below::SchedulerPhaseTwo(), Player::SetBeastMaster(), SetCharm(), npc_ulduar_leviathan_mkii::SetData(), npc_ulduar_vx001::SetData(), npc_ulduar_aerial_command_unit::SetData(), Pet::setDeathState(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetStunned(), SetSwim(), Battlefield::ShowNpc(), npc_black_knight_ghoul::SpellHit(), npc_ulduar_iron_construct::SpellHit(), npc_ulduar_leviathan_mkii::SpellHit(), npc_ulduar_aerial_command_unit::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_ulduar_vx001::SpellHit(), advisor_baseAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_black_knight::SpellHitTarget(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::StartFighting(), boss_noth::boss_nothAI::StartGroundPhase(), npc_expedition_engineer::StartRepairing(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_highlord_darion_mograine::SummonReplacement(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), boss_pyroguard_emberseer::UpdateAI(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scarlet_ghoul::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::UpdateAI(), boss_anubarak_trial::UpdateAI(), npc_nerubian_burrower::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_flame_leviathan::UpdateAI(), boss_mimiron::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), CombatManager::UpdateOwnerCombatState(), UpdatePetCombatState(), and npc_general_andorov::WaypointReached().

◆ RemoveUnitFlag2()

◆ RemoveUnitMovementFlag()

◆ RemoveVehicleKit()

void Unit::RemoveVehicleKit ( )

◆ RemoveVisibleAura()

void Unit::RemoveVisibleAura ( uint8  slot)
inline
1565{ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
void UpdateAuraForGroup(uint8 slot)
Definition Unit.cpp:13273

References m_visibleAuras, and UpdateAuraForGroup().

Referenced by AuraApplication::_Remove().

◆ ReplaceAllDynamicFlags()

◆ ReplaceAllNpcFlags()

void Unit::ReplaceAllNpcFlags ( NPCFlags  flags)
inline

References SetUInt32Value(), and UNIT_NPC_FLAGS.

Referenced by Pet::CreateBaseAtTamed(), npc_wild_wyrm::DamageTaken(), npc_rocknot::DoAction(), brann_bronzebeard::DoAction(), Spell::EffectSummonType(), SmartAI::EndPath(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_rocknot::JustReachedHome(), npc_rocknot::JustRespawned(), npc_highlord_darion_mograine::JustRespawned(), npc_akama_illidan::JustSummoned(), Pet::LoadPetFromDB(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), go_crystalline_tear::OnQuestAccept(), boss_yoggsaron_descend_portal::OnSpellClick(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_mistress_nagmara::Reset(), npc_rocknot::Reset(), boss_doomrel::Reset(), npc_eris_hevenfire::npc_eris_hevenfireAI::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::setDeathState(), npc_eris_hevenfire::npc_eris_hevenfireAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_mistress_nagmara::sGossipSelect(), npc_akama_illidan::sGossipSelect(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StartPath(), Player::SummonPet(), npc_highlord_darion_mograine::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), Creature::UpdateEntry(), GameEventMgr::UpdateEventNPCFlags(), and npc_captain_saeed::npc_captain_saeedAI::WaypointReached().

◆ ReplaceAllUnitFlags()

◆ ReplaceAllUnitFlags2()

void Unit::ReplaceAllUnitFlags2 ( UnitFlags2  flags)
inline

◆ resetAttackTimer()

◆ RespondsToCallForHelp()

bool Unit::RespondsToCallForHelp ( ) const
inline
1051 {
1052 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
1053 return entry->FactionRespondsToCallForHelp();
1054
1055 return false;
1056 }

References GetFactionTemplateEntry().

Referenced by Creature::CanAssistTo().

◆ RestoreDisplayId()

void Unit::RestoreDisplayId ( )
12868{
12869 AuraEffect* handledAura = nullptr;
12870 AuraEffect* handledAuraForced = nullptr;
12871 // try to receive model from transform auras
12873 if (!transforms.empty())
12874 {
12875 // iterate over already applied transform auras - from newest to oldest
12876 for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
12877 {
12878 if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
12879 {
12880 if (!handledAura)
12881 handledAura = (*i);
12882 // xinef: prefer negative/forced auras
12883 if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !aurApp->IsPositive())
12884 {
12885 handledAuraForced = (*i);
12886 break;
12887 }
12888 }
12889 }
12890 }
12891
12892 // Xinef: include clone auras (eg mirror images)
12893 if (!handledAuraForced && !handledAura)
12894 {
12896 if (!cloneAuras.empty())
12897 for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i)
12898 handledAura = *i;
12899 }
12900
12902
12903 // xinef: order of execution is important!
12904 // first forced transform auras, then shapeshifts, then normal transform
12905 // transform aura was found
12906 if (handledAuraForced)
12907 {
12908 handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
12909 return;
12910 }
12911 else if (!shapeshiftAura.empty()) // we've found shapeshift
12912 {
12913 // only one such aura possible at a time
12914 if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
12915 {
12916 SetDisplayId(modelId);
12917 return;
12918 }
12919 }
12920 else if (handledAura)
12921 {
12922 handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
12923 return;
12924 }
12925
12926 // no auras found - set modelid to default
12928}
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition SpellAuraDefines.h:43
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:755
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId)
Definition Unit.cpp:15146

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraApplication::GetBase(), Object::GetGUID(), GetModelForForm(), GetNativeDisplayId(), GetShapeshiftForm(), AuraEffect::HandleEffect(), SetDisplayId(), SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_CLONE_CASTER, SPELL_AURA_MOD_SHAPESHIFT, and SPELL_AURA_TRANSFORM.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_gen_aura_service_uniform::OnRemove(), and Player::SetIsSpectator().

◆ RestoreFaction()

◆ ResumeMovement()

void Unit::ResumeMovement ( uint32  timer = 0,
uint8  slot = 0 
)
12756{
12757 if (slot >= MAX_MOTION_SLOT)
12758 return;
12759
12760 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
12761 movementGenerator->Resume(timer);
12762}

References GetMotionMaster(), and MAX_MOTION_SLOT.

Referenced by npc_mistress_nagmara::ContinueAfterDoor(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), npc_acherus_necromancer::UpdateAI(), and npc_gothik_the_harvester::UpdateAI().

◆ RewardRage()

void Unit::RewardRage ( uint32  damage,
uint32  weaponSpeedHitFactor,
bool  attacker 
)
15778{
15779 // Rage formulae https://wowwiki-archive.fandom.com/wiki/Rage#Formulae
15780 float addRage;
15781
15782 float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
15783
15784 // Unknown if correct, but lineary adjust rage conversion above level 70
15785 if (GetLevel() > 70)
15786 rageconversion += 13.27f * (GetLevel() - 70);
15787
15788 if (attacker)
15789 {
15790 // see Bornak's bluepost explanation (05/29/2009)
15791 float rageFromDamageDealt = damage / rageconversion * 7.5f;
15792 addRage = (rageFromDamageDealt + weaponSpeedHitFactor) / 2.0f;
15793 addRage = std::min(addRage, rageFromDamageDealt * 2.0f);
15795 }
15796 else
15797 {
15798 addRage = damage / rageconversion * 2.5f;
15799
15800 // Berserker Rage effect
15801 if (HasAura(18499))
15802 addRage *= 3.0f;
15803 }
15804
15805 addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
15806
15807 ModifyPower(POWER_RAGE, uint32(addRage * 10));
15808}
@ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT
Definition SpellAuraDefines.h:276
@ RATE_POWER_RAGE_INCOME
Definition WorldConfig.h:405

References AddPct(), GetLevel(), GetTotalAuraModifier(), HasAura(), ModifyPower(), POWER_RAGE, RATE_POWER_RAGE_INCOME, SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT, and sWorld.

Referenced by DealDamage(), DealMeleeDamage(), and TEST_F().

◆ RollMeleeOutcomeAgainst() [1/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType 
) const
2984{
2985 // This is only wrapper
2986
2987 // Miss chance based on melee
2988 //float miss_chance = MeleeMissChanceCalc(victim, attType);
2989 float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetMaxSkillValueForLevel(this)), 0);
2990
2991 // Critical hit chance
2992 float crit_chance = GetUnitCriticalChance(attType, victim);
2993 if (crit_chance < 0)
2994 crit_chance = 0;
2995
2996 float dodge_chance = victim->GetUnitDodgeChance();
2997 float block_chance = victim->GetUnitBlockChance();
2998 float parry_chance = victim->GetUnitParryChance();
2999
3000 // Useful if want to specify crit & miss chances for melee, else it could be removed
3001 //LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss {} crit {} dodge {} parry {} block {}", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
3002
3003 return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
3004}
float GetUnitCriticalChance(WeaponAttackType attackType, Unit const *victim) const
Definition Unit.cpp:3628

References GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), MeleeSpellMissChance(), and RollMeleeOutcomeAgainst().

Referenced by CalculateMeleeDamage(), and RollMeleeOutcomeAgainst().

◆ RollMeleeOutcomeAgainst() [2/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType,
int32  crit_chance,
int32  miss_chance,
int32  dodge_chance,
int32  parry_chance,
int32  block_chance 
) const
3007{
3008 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks())
3009 {
3010 return MELEE_HIT_EVADE;
3011 }
3012
3013 int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
3014 int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
3015
3016 int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
3017 int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
3018
3019 sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, attackerMaxSkillValueForLevel, victimMaxSkillValueForLevel, attackerWeaponSkill, victimDefenseSkill, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
3020
3021 // bonus from skills is 0.04%
3022 int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
3023 int32 sum = 0, tmp = 0;
3024 int32 roll = urand (0, 10000);
3025
3026 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of {} for attacker", skillBonus);
3027 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled {}, miss {}, dodge {}, parry {}, block {}, crit {}",
3028 // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
3029
3030 tmp = miss_chance;
3031
3032 if (tmp > 0 && roll < (sum += tmp))
3033 {
3034 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS");
3035 return MELEE_HIT_MISS;
3036 }
3037
3038 // Dodge chance
3039
3040 // only players can't dodge if attacker is behind
3041 if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
3042 {
3043 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
3044 }
3045 // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
3046 else if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_DODGE)))
3047 {
3048 // Reduce dodge chance by attacker expertise rating
3049 if (IsPlayer())
3050 dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
3051 else
3052 dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
3053
3054 // Modify dodge chance by attacker SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3056 dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3057
3058 tmp = dodge_chance;
3059
3060 // xinef: if casting or stunned - cant dodge
3061 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3062 tmp = 0;
3063
3064 if ((tmp > 0) // check if unit _can_ dodge
3065 && ((tmp -= skillBonus) > 0)
3066 && roll < (sum += tmp))
3067 {
3068 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <{}, {})", sum - tmp, sum);
3069 return MELEE_HIT_DODGE;
3070 }
3071 }
3072
3073 // parry & block chances
3074
3075 // check if attack comes from behind, nobody can parry or block if attacker is behind
3076 if (!victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
3077 {
3078 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
3079 }
3080 else
3081 {
3082 // Reduce parry chance by attacker expertise rating
3083 if (IsPlayer())
3084 parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
3085 else
3086 parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
3087
3088 if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_PARRY)))
3089 {
3090 tmp = parry_chance;
3091
3092 // xinef: cant parry while casting or while stunned
3093 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3094 tmp = 0;
3095
3096 if (tmp > 0 // check if unit _can_ parry
3097 && (tmp -= skillBonus) > 0
3098 && roll < (sum += tmp))
3099 {
3100 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <{}, {})", sum - tmp, sum);
3101 return MELEE_HIT_PARRY;
3102 }
3103 }
3104
3105 if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_BLOCK)))
3106 {
3107 tmp = block_chance;
3108
3109 // xinef: cant block while casting or while stunned
3110 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3111 tmp = 0;
3112
3113 if (tmp > 0 // check if unit _can_ block
3114 && (tmp -= skillBonus) > 0
3115 && roll < (sum += tmp))
3116 {
3117 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <{}, {})", sum - tmp, sum);
3118 return MELEE_HIT_BLOCK;
3119 }
3120 }
3121 }
3122
3123 // Max 40% chance to score a glancing blow against mobs of the same or higher level (can do only players and pets and not with ranged weapon)
3124 if (attType != RANGED_ATTACK &&
3125 (IsPlayer() || IsPet()) &&
3126 !victim->IsPlayer() && !victim->IsPet() &&
3127 GetLevel() <= victim->getLevelForTarget(this))
3128 {
3129 // cap possible value (with bonuses > max skill)
3130 int32 skill = attackerWeaponSkill;
3131 int32 maxskill = attackerMaxSkillValueForLevel;
3132 skill = (skill > maxskill) ? maxskill : skill;
3133
3134 // 6% against same level targets, 24% against a +3 boss
3135 tmp = 600 + (victimDefenseSkill - skill) * 120;
3136 tmp = tmp > 4000 ? 4000 : tmp;
3137 if (tmp > 0 && roll < (sum += tmp))
3138 {
3139 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <{}, {})", sum - 4000, sum);
3140 return MELEE_HIT_GLANCING;
3141 }
3142 }
3143
3144 // mobs can score crushing blows if they're 4 or more levels above victim
3145 if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
3146 // can be from by creature (if can) or from controlled player that considered as creature
3149 {
3150 // when their weapon skill is 15 or more above victim's defense skill
3151 tmp = victimDefenseSkill;
3152 int32 tmpmax = victimMaxSkillValueForLevel;
3153 // having defense above your maximum (from items, talents etc.) has no effect
3154 tmp = tmp > tmpmax ? tmpmax : tmp;
3155 // tmp = mob's level * 5 - player's current defense skill
3156 tmp = attackerMaxSkillValueForLevel - tmp;
3157 if (tmp >= 15)
3158 {
3159 // add 2% chance per lacking skill point, min. is 15%
3160 tmp = tmp * 200 - 1500;
3161 if (roll < (sum += tmp))
3162 {
3163 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum - tmp, sum);
3164 return MELEE_HIT_CRUSHING;
3165 }
3166 }
3167 }
3168
3169 // Critical chance
3170 tmp = crit_chance;
3171
3172 if (tmp > 0 && roll < (sum += tmp))
3173 {
3174 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
3175 if (IsCreature() && (ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_CRIT)))
3176 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
3177 else
3178 return MELEE_HIT_CRIT;
3179 }
3180
3181 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL");
3182 return MELEE_HIT_NORMAL;
3183}
@ CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS
Definition CreatureData.h:51
@ CREATURE_FLAG_EXTRA_NO_CRIT
Definition CreatureData.h:63

References CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_CRIT, CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, GetDefenseSkillValue(), GetLevel(), getLevelForTarget(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetWeaponSkillValue(), Creature::HasFlagsExtra(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsNonMeleeSpellCast(), IsPet(), Object::IsPlayer(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, RANGED_ATTACK, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, urand(), and VICTIMSTATE_DODGE.

◆ Say() [1/2]

void Unit::Say ( std::string_view  text,
Language  language,
WorldObject const *  target = nullptr 
)
virtual

◆ Say() [2/2]

void Unit::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

16982{
16983 Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
16984}

References CHAT_MSG_MONSTER_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ SelectNearbyNoTotemTarget()

Unit * Unit::SelectNearbyNoTotemTarget ( Unit *  exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
13112{
13113 std::list<Unit*> targets;
13114 Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
13116 Cell::VisitObjects(this, searcher, dist);
13117
13118 // remove current target
13119 if (GetVictim())
13120 targets.remove(GetVictim());
13121
13122 if (exclude)
13123 targets.remove(exclude);
13124
13125 // remove not LoS targets
13126 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
13127 {
13128 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
13129 {
13130 std::list<Unit*>::iterator tIter2 = tIter;
13131 ++tIter;
13132 targets.erase(tIter2);
13133 }
13134 else
13135 ++tIter;
13136 }
13137
13138 // no appropriate targets
13139 if (targets.empty())
13140 return nullptr;
13141
13142 // select random
13144}
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition Unit.cpp:10553
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
Definition GridNotifiers.h:446

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitObjects().

Referenced by spell_rog_blade_flurry::CheckProc(), and spell_warr_sweeping_strikes::CheckProc().

◆ SelectNearbyTarget()

Unit * Unit::SelectNearbyTarget ( Unit *  exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
13077{
13078 std::list<Unit*> targets;
13079 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
13081 Cell::VisitObjects(this, searcher, dist);
13082
13083 // remove current target
13084 if (GetVictim())
13085 targets.remove(GetVictim());
13086
13087 if (exclude)
13088 targets.remove(exclude);
13089
13090 // remove not LoS targets
13091 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
13092 {
13093 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
13094 {
13095 std::list<Unit*>::iterator tIter2 = tIter;
13096 ++tIter;
13097 targets.erase(tIter2);
13098 }
13099 else
13100 ++tIter;
13101 }
13102
13103 // no appropriate targets
13104 if (targets.empty())
13105 return nullptr;
13106
13107 // select random
13109}
Definition GridNotifiers.h:884

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitObjects().

Referenced by boss_yazzai::JustEngagedWith(), npc_highlord_darion_mograine::JustSummoned(), boss_curator::JustSummoned(), npc_hodirs_fury::UpdateAI(), boss_kologarn::UpdateAI(), boss_thorim_trap::UpdateAI(), boss_yoggsaron_cloud::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ SendAttackStateUpdate() [1/2]

void Unit::SendAttackStateUpdate ( CalcDamageInfo *  damageInfo)

Probably used for debugging purposes, as it is not known to appear on retail servers

6718{
6719 LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
6720
6721 uint32 tmpDamage[MAX_ITEM_PROTO_DAMAGES] = { };
6722 uint32 tmpAbsorb[MAX_ITEM_PROTO_DAMAGES] = { };
6723 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6724 {
6725 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6726 tmpDamage[i] = damageInfo->damages[i].damage;
6727 tmpAbsorb[i] = damageInfo->damages[i].absorb;
6728 if (damageInfo->target->IsPlayer() && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6729 {
6730 tmpAbsorb[i] = tmpDamage[i];
6731 tmpDamage[i] = 0;
6732 }
6733 }
6734
6735 uint32 count = 1;
6736 if (tmpDamage[1] || tmpAbsorb[1] || damageInfo->damages[1].resist)
6737 {
6738 ++count;
6739 }
6740
6741 std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
6742 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
6743 data << uint32(damageInfo->HitInfo);
6744 data << damageInfo->attacker->GetPackGUID();
6745 data << damageInfo->target->GetPackGUID();
6746 data << uint32(tmpDamage[0] + tmpDamage[1]); // Full damage
6747 int32 overkill = tmpDamage[0] + tmpDamage[1] - damageInfo->target->GetHealth();
6748 data << uint32(overkill < 0 ? 0 : overkill); // Overkill
6749 data << uint8(count); // Sub damage count
6750
6751 for (uint32 i = 0; i < count; ++i)
6752 {
6753 data << uint32(damageInfo->damages[i].damageSchoolMask); // School of sub damage
6754 data << float(tmpDamage[i]); // sub damage
6755 data << uint32(tmpDamage[i]); // Sub Damage
6756 }
6757
6759 {
6760 for (uint32 i = 0; i < count; ++i)
6761 {
6762 data << uint32(tmpAbsorb[i]); // Absorb
6763 }
6764 }
6765
6767 {
6768 for (uint32 i = 0; i < count; ++i)
6769 {
6770 data << uint32(damageInfo->damages[i].resist); // Resist
6771 }
6772 }
6773
6774 data << uint8(damageInfo->TargetState);
6775 data << uint32(0); // Unknown attackerstate
6776 data << uint32(0); // Melee spellid
6777
6778 if (damageInfo->HitInfo & HITINFO_BLOCK)
6779 data << uint32(damageInfo->blocked_amount);
6780
6781 if (damageInfo->HitInfo & HITINFO_RAGE_GAIN)
6782 data << uint32(0);
6783
6785 if (damageInfo->HitInfo & HITINFO_DEBUG)
6786 {
6787 data << uint32(0);
6788 data << float(0);
6789 data << float(0);
6790 data << float(0);
6791 data << float(0);
6792 data << float(0);
6793 data << float(0);
6794 data << float(0);
6795 data << float(0);
6796 data << float(0); // Found in a loop with 1 iteration
6797 data << float(0); // ditto ^
6798 data << uint32(0);
6799 }
6800
6801 SendMessageToSet(&data, true);
6802}
@ HITINFO_RAGE_GAIN
Definition Unit.h:125
@ HITINFO_DEBUG
Definition Unit.h:100
@ SMSG_ATTACKERSTATEUPDATE
Definition Opcodes.h:360

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CHEAT_GOD, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), CalcDamageInfo::HitInfo, HITINFO_BLOCK, HITINFO_DEBUG, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_RAGE_GAIN, Object::IsPlayer(), LOG_DEBUG, MAX_ITEM_PROTO_DAMAGES, CalcDamageInfo::resist, WorldObject::SendMessageToSet(), SMSG_ATTACKERSTATEUPDATE, CalcDamageInfo::target, CalcDamageInfo::TargetState, and Object::ToPlayer().

Referenced by AttackerStateUpdate(), misc_commandscript::HandleDamageCommand(), spell_dk_dancing_rune_weapon::HandleProc(), and SendAttackStateUpdate().

◆ SendAttackStateUpdate() [2/2]

void Unit::SendAttackStateUpdate ( uint32  HitInfo,
Unit *  target,
uint8  SwingType,
SpellSchoolMask  damageSchoolMask,
uint32  Damage,
uint32  AbsorbDamage,
uint32  Resist,
VictimState  TargetState,
uint32  BlockedAmount 
)
6805{
6806 CalcDamageInfo dmgInfo;
6807 dmgInfo.HitInfo = HitInfo;
6808 dmgInfo.attacker = this;
6809 dmgInfo.target = target;
6810
6811 dmgInfo.damages[0].damage = Damage - AbsorbDamage - Resist - BlockedAmount;
6812 dmgInfo.damages[0].damageSchoolMask = damageSchoolMask;
6813 dmgInfo.damages[0].absorb = AbsorbDamage;
6814 dmgInfo.damages[0].resist = Resist;
6815
6816 dmgInfo.damages[1].damage = 0;
6817 dmgInfo.damages[1].damageSchoolMask = 0;
6818 dmgInfo.damages[1].absorb = 0;
6819 dmgInfo.damages[1].resist = 0;
6820
6821 dmgInfo.TargetState = TargetState;
6822 dmgInfo.blocked_amount = BlockedAmount;
6823 SendAttackStateUpdate(&dmgInfo);
6824}
HitInfo
Definition Unit.h:98

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, CalcDamageInfo::HitInfo, CalcDamageInfo::resist, SendAttackStateUpdate(), CalcDamageInfo::target, and CalcDamageInfo::TargetState.

◆ SendClearTarget()

void Unit::SendClearTarget ( )
15991{
15993 data << GetPackGUID();
15994 SendMessageToSet(&data, false);
15995}
@ SMSG_BREAK_TARGET
Definition Opcodes.h:368

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_BREAK_TARGET.

Referenced by Vehicle::AddPassenger(), and Spell::EffectForceDeselect().

◆ SendComboPoints()

void Unit::SendComboPoints ( )
12974{
12975 if (m_cleanupDone)
12976 {
12977 return;
12978 }
12979
12981 if (Player* playerMe = ToPlayer())
12982 {
12983 WorldPacket data(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
12984 data << packGUID;
12985 data << uint8(m_comboPoints);
12986 playerMe->SendDirectMessage(&data);
12987 }
12988
12989 ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
12990 Player* owner = nullptr;
12991 if (ownerGuid.IsPlayer())
12992 {
12993 owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
12994 }
12995
12996 if (m_movedByPlayer || owner)
12997 {
12998 WorldPacket data(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
12999 data << GetPackGUID();
13000 data << packGUID;
13001 data << uint8(m_comboPoints);
13002
13003 if (m_movedByPlayer)
13005
13006 if (owner && owner != m_movedByPlayer)
13007 owner->SendDirectMessage(&data);
13008 }
13009}
Definition ObjectGuid.h:267
std::size_t size() const
Definition ObjectGuid.h:278
@ SMSG_PET_UPDATE_COMBO_POINTS
Definition Opcodes.h:1200
@ SMSG_UPDATE_COMBO_POINTS
Definition Opcodes.h:955

References GetCharmerOrOwnerGUID(), Object::GetPackGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), m_cleanupDone, m_comboPoints, m_comboTarget, m_movedByPlayer, Player::SendDirectMessage(), PackedGuid::size(), SMSG_PET_UPDATE_COMBO_POINTS, SMSG_UPDATE_COMBO_POINTS, and Object::ToPlayer().

Referenced by AddComboPoints(), and ClearComboPoints().

◆ SendEnergizeSpellLog()

void Unit::SendEnergizeSpellLog ( Unit *  victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
8204{
8205 WorldPacket data(SMSG_SPELLENERGIZELOG, (8 + 8 + 4 + 4 + 4 + 1));
8206 data << victim->GetPackGUID();
8207 data << GetPackGUID();
8208 data << uint32(spellID);
8209 data << uint32(powerType);
8210 data << uint32(damage);
8211 SendMessageToSet(&data, true);
8212}
@ SMSG_SPELLENERGIZELOG
Definition Opcodes.h:367

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLENERGIZELOG.

Referenced by EnergizeBySpell(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ SendHealSpellLog()

void Unit::SendHealSpellLog ( HealInfo const &  healInfo,
bool  critical = false 
)
8171{
8172 uint32 overheal = healInfo.GetHeal() - healInfo.GetEffectiveHeal();
8173
8174 // we guess size
8175 WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
8176 data << healInfo.GetTarget()->GetPackGUID();
8177 data << GetPackGUID();
8178 data << uint32(healInfo.GetSpellInfo()->Id);
8179 data << uint32(healInfo.GetHeal());
8180 data << uint32(overheal);
8181 data << uint32(healInfo.GetAbsorb()); // Absorb amount
8182 data << uint8(critical ? 1 : 0);
8183 data << uint8(0); // unused
8184 SendMessageToSet(&data, true);
8185}
@ SMSG_SPELLHEALLOG
Definition Opcodes.h:366

References HealInfo::GetAbsorb(), HealInfo::GetEffectiveHeal(), HealInfo::GetHeal(), Object::GetPackGUID(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SpellInfo::Id, WorldObject::SendMessageToSet(), and SMSG_SPELLHEALLOG.

Referenced by HealBySpell().

◆ SendMeleeAttackStart()

void Unit::SendMeleeAttackStart ( Unit *  victim,
Player *  sendTo = nullptr 
)
3263{
3264 WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
3265 data << GetGUID();
3266 data << victim->GetGUID();
3267 if (sendTo)
3268 sendTo->SendDirectMessage(&data);
3269 else
3270 SendMessageToSet(&data, true);
3271 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART");
3272}
@ SMSG_ATTACKSTART
Definition Opcodes.h:353

References Object::GetGUID(), Object::GetGUID(), LOG_DEBUG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), and SMSG_ATTACKSTART.

Referenced by Attack(), Player::GetInitialVisiblePackets(), and boss_leotheras_the_blind::Reset().

◆ SendMeleeAttackStop()

void Unit::SendMeleeAttackStop ( Unit const *  victim = nullptr) const

Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.

3279{
3280 // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating!
3281 // pussywizard: this happens in some boss scripts, just add clearing here
3282 // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // commented out for now
3283
3285 attackStop.Attacker = GetGUID();
3286 attackStop.Victim = Object::GetGUID(victim);
3287 attackStop.NowDead = !IsAlive();
3288
3289 SendMessageToSet(attackStop.Write(), true);
3290 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");
3291
3292 if (victim)
3293 LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString(), (victim->IsPlayer() ? "player" : "creature"), victim->GetGUID().ToString());
3294 else
3295 LOG_DEBUG("entities.unit", "{} {} stopped attacking", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString());
3296}
Definition CombatPackets.h:39
ObjectGuid Attacker
Definition CombatPackets.h:45
bool NowDead
Definition CombatPackets.h:47
ObjectGuid Victim
Definition CombatPackets.h:46
WorldPacket const * Write() override
Definition CombatPackets.cpp:25

References WorldPackets::Combat::SAttackStop::Attacker, Object::GetGUID(), Object::GetGUID(), IsAlive(), Object::IsPlayer(), LOG_DEBUG, WorldPackets::Combat::SAttackStop::NowDead, WorldObject::SendMessageToSet(), ObjectGuid::ToString(), WorldPackets::Combat::SAttackStop::Victim, and WorldPackets::Combat::SAttackStop::Write().

Referenced by Attack(), AttackStop(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_ulduar_vx001::DamageTaken(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), WorldSession::HandleAttackSwingOpcode(), spell_svalna_revive_champion::Land(), boss_leotheras_the_blind::Reset(), SetControlled(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), and boss_mimiron::UpdateAI().

◆ SendMonsterMove()

void Unit::SendMonsterMove ( float  NewPosX,
float  NewPosY,
float  NewPosZ,
uint32  TransitTime,
SplineFlags  sf = SPLINEFLAG_WALK_MODE 
)
665{
666 WorldPacket data(SMSG_MONSTER_MOVE, 1 + 12 + 4 + 1 + 4 + 4 + 4 + 12 + GetPackGUID().size());
667 data << GetPackGUID();
668
669 data << uint8(0); // new in 3.1
670 data << GetPositionX() << GetPositionY() << GetPositionZ();
671 data << GameTime::GetGameTimeMS().count();
672 data << uint8(0);
673 data << uint32(sf);
674 data << TransitTime; // Time in between points
675 data << uint32(1); // 1 single waypoint
676 data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
677
678 SendMessageToSet(&data, true);
679}
@ SMSG_MONSTER_MOVE
Definition Opcodes.h:251

References GameTime::GetGameTimeMS(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::SendMessageToSet(), and SMSG_MONSTER_MOVE.

◆ SendMovementFeatherFall()

void Unit::SendMovementFeatherFall ( Player *  sendTo)
16480{
16481 if (!movespline->Initialized())
16482 return;
16484 data << GetPackGUID();
16485 sendTo->SendDirectMessage(&data);
16486}
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition Opcodes.h:803

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_FEATHER_FALL.

◆ SendMovementFlagUpdate()

void Unit::SendMovementFlagUpdate ( bool  self = false)
12780{
12781 if (IsRooted())
12782 {
12783 // each case where this occurs has to be examined and reported and dealt with.
12784 LOG_ERROR("Unit", "Attempted sending heartbeat with root flag for guid {}", GetGUID().ToString());
12785 return;
12786 }
12787
12788 WorldPacket data;
12789 BuildHeartBeatMsg(&data);
12790 SendMessageToSet(&data, self);
12791}
bool IsRooted() const
Definition Unit.h:1735
void BuildHeartBeatMsg(WorldPacket *data) const
Definition Object.cpp:2171

References BuildHeartBeatMsg(), Object::GetGUID(), IsRooted(), LOG_ERROR, WorldObject::SendMessageToSet(), and Position::ToString().

Referenced by boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_madrigosa::DoAction(), boss_nightbane::EnterEvadeMode(), boss_kaelthas::ExecuteMiddleEvent(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), boss_felmyst::InitializeAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_harbinger_skyriss::JustSummoned(), MotionMaster::MoveFall(), npc_twilight_volunteer::MovementInform(), boss_volkhan::MovementInform(), boss_felmyst::MovementInform(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), boss_felmyst::ScheduleGroundAbilities(), SetCharm(), boss_devourer_of_souls::SpellHitTarget(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_anub_arak::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_ignis::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), and boss_koralon::boss_koralonAI::UpdateAI().

◆ SendMovementHover()

void Unit::SendMovementHover ( Player *  sendTo)
16489{
16490 if (!movespline->Initialized())
16491 return;
16493 data << GetPackGUID();
16494 sendTo->SendDirectMessage(&data);
16495}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition Opcodes.h:805

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_SET_HOVER.

◆ SendMovementWaterWalking()

void Unit::SendMovementWaterWalking ( Player *  sendTo)
16471{
16472 if (!movespline->Initialized())
16473 return;
16475 data << GetPackGUID();
16476 sendTo->SendDirectMessage(&data);
16477}
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition Opcodes.h:807

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_WATER_WALK.

◆ SendMoveRoot()

void Unit::SendMoveRoot ( bool  state)
protected
14186{
14187 Player const* client = GetClientControlling();
14188
14189 // Apply flags in-place when unit currently is not controlled by a player
14190 if (!client)
14191 {
14192 if (apply)
14193 {
14194 // MOVEMENTFLAG_ROOT must not be sent alongside MOVEMENTFLAG_MASK_MOVING.
14195 // The 3.3.5a client's movement step returns zero consumed time as soon
14196 // as it sees ROOT, while the loop driving it only terminates once that
14197 // time reaches the step target, so a moving flag alongside ROOT spins
14198 // forever and freezes every client that receives this unit's movement
14199 // info. The turn bits stay set, they never reach that step.
14202 if (!client)
14203 StopMoving();
14204 }
14205 else
14207 }
14208
14209 if (!IsInWorld())
14210 return;
14211
14212 PackedGuid const& guid = GetPackGUID();
14213 // Wrath+ spline root: when unit is currently not controlled by a player
14214 if (!client)
14215 {
14216 WorldPacket data(apply ? SMSG_SPLINE_MOVE_ROOT : SMSG_SPLINE_MOVE_UNROOT, guid.size());
14217 data << guid;
14218 SendMessageToSet(&data, true);
14219 }
14220 // Wrath+ force root: when unit is controlled by a player
14221 else
14222 {
14223 uint32 const counter = client->GetSession()->GetOrderCounter();
14224
14225 WorldPacket data(apply ? SMSG_FORCE_MOVE_ROOT : SMSG_FORCE_MOVE_UNROOT, guid.size() + 4);
14226 data << guid;
14227 data << counter;
14228 client->GetSession()->SendPacket(&data);
14229 client->GetSession()->IncrementOrderCounter();
14230 }
14231}
@ MOVEMENTFLAG_MASK_MOVING_FLY
Definition UnitDefines.h:413
Player const * GetClientControlling() const
Definition Unit.cpp:17158
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:309
@ SMSG_FORCE_MOVE_UNROOT
Definition Opcodes.h:264
@ SMSG_FORCE_MOVE_ROOT
Definition Opcodes.h:262
@ SMSG_SPLINE_MOVE_UNROOT
Definition Opcodes.h:802
@ SMSG_SPLINE_MOVE_ROOT
Definition Opcodes.h:824
void AddMovementFlag(uint32 flag)
Definition Object.h:351

References MovementInfo::AddMovementFlag(), GetClientControlling(), WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetSession(), WorldSession::IncrementOrderCounter(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_MASK_MOVING, MOVEMENTFLAG_MASK_MOVING_FLY, MOVEMENTFLAG_ROOT, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), WorldSession::SendPacket(), PackedGuid::size(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_SPLINE_MOVE_ROOT, SMSG_SPLINE_MOVE_UNROOT, and StopMoving().

Referenced by Player::BuildPlayerRepop(), Player::KillPlayer(), Player::ResurrectPlayer(), and SetRooted().

◆ SendPeriodicAuraLog()

void Unit::SendPeriodicAuraLog ( SpellPeriodicAuraLogInfo *  pInfo)
6642{
6643 AuraEffect const* aura = pInfo->auraEff;
6645 data << GetPackGUID();
6646 data << aura->GetCasterGUID().WriteAsPacked();
6647 data << uint32(aura->GetId()); // spellId
6648 data << uint32(1); // count
6649 data << uint32(aura->GetAuraType()); // auraId
6650 switch (aura->GetAuraType())
6651 {
6654 {
6655 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6656 uint32 damage = pInfo->damage;
6657 uint32 absorb = pInfo->absorb;
6658 if (IsPlayer() && ToPlayer()->GetCommandStatus(CHEAT_GOD))
6659 {
6660 absorb = damage;
6661 damage = 0;
6662 }
6663
6664 data << uint32(damage); // damage
6665 data << uint32(pInfo->overDamage); // overkill?
6666 data << uint32(aura->GetSpellInfo()->GetSchoolMask());
6667 data << uint32(absorb); // absorb
6668 data << uint32(pInfo->resist); // resist
6669 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6670 }
6671 break;
6674 data << uint32(pInfo->damage); // damage
6675 data << uint32(pInfo->overDamage); // overheal
6676 data << uint32(pInfo->absorb); // absorb
6677 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6678 break;
6681 data << uint32(aura->GetMiscValue()); // power type
6682 data << uint32(pInfo->damage); // damage
6683 break;
6685 data << uint32(aura->GetMiscValue()); // power type
6686 data << uint32(pInfo->damage); // amount
6687 data << float(pInfo->multiplier); // gain multiplier
6688 break;
6689 default:
6690 LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura {}", uint32(aura->GetAuraType()));
6691 return;
6692 }
6693
6694 SendMessageToSet(&data, true);
6695}
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
PackedGuid WriteAsPacked() const
Definition ObjectGuid.h:325
@ SMSG_PERIODICAURALOG
Definition Opcodes.h:620
float multiplier
Definition Unit.h:548
bool critical
Definition Unit.h:549
uint32 overDamage
Definition Unit.h:545
uint32 resist
Definition Unit.h:547
uint32 damage
Definition Unit.h:544
AuraEffect const * auraEff
Definition Unit.h:543
uint32 absorb
Definition Unit.h:546

References SpellPeriodicAuraLogInfo::absorb, SpellPeriodicAuraLogInfo::auraEff, CHEAT_GOD, SpellPeriodicAuraLogInfo::critical, SpellPeriodicAuraLogInfo::damage, AuraEffect::GetAuraType(), AuraEffect::GetCasterGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), Object::GetPackGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Object::IsPlayer(), LOG_ERROR, SpellPeriodicAuraLogInfo::multiplier, SpellPeriodicAuraLogInfo::overDamage, SpellPeriodicAuraLogInfo::resist, WorldObject::SendMessageToSet(), SMSG_PERIODICAURALOG, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_MANA_LEECH, Object::ToPlayer(), and ObjectGuid::WriteAsPacked().

Referenced by spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SendPetActionFeedback()

void Unit::SendPetActionFeedback ( uint8  msg) const

-------—Pet responses methods--------------—

12685{
12686 Unit* owner = GetOwner();
12687 if (!owner || !owner->IsPlayer())
12688 return;
12689
12691 data << uint8(msg);
12692 owner->ToPlayer()->SendDirectMessage(&data);
12693}
@ SMSG_PET_ACTION_FEEDBACK
Definition Opcodes.h:740

References GetOwner(), Object::IsPlayer(), Player::SendDirectMessage(), SMSG_PET_ACTION_FEEDBACK, and Object::ToPlayer().

Referenced by WorldSession::HandlePetCancelAuraOpcode().

◆ SendPetActionSound()

void Unit::SendPetActionSound ( PetAction  action) const
12696{
12697 SendMessageToSet(WorldPackets::Pet::PetActionSound(GetGUID(), static_cast<int32>(action)).Write(), false);
12698}
Definition PetPackets.h:100

References Object::GetGUID(), and WorldObject::SendMessageToSet().

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPetAIReaction()

void Unit::SendPetAIReaction ( ObjectGuid  guid) const
12707{
12708 Unit* owner = GetOwner();
12709 if (!owner || !owner->IsPlayer())
12710 return;
12711
12712 WorldPacket data(SMSG_AI_REACTION, 8 + 4);
12713 data << guid;
12714 data << uint32(AI_REACTION_HOSTILE);
12715 owner->ToPlayer()->SendDirectMessage(&data);
12716}
@ SMSG_AI_REACTION
Definition Opcodes.h:346

References AI_REACTION_HOSTILE, GetOwner(), Object::IsPlayer(), Player::SendDirectMessage(), SMSG_AI_REACTION, and Object::ToPlayer().

Referenced by PetAI::DoAttack(), and WorldSession::HandlePetActionHelper().

◆ SendPetDismissSound()

void Unit::SendPetDismissSound ( ) const
12701{
12702 if (CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()))
12703 SendMessageToSet(WorldPackets::Pet::PetDismissSound(static_cast<int32>(displayInfo->ModelId), GetPosition()).Write(), false);
12704}
Definition PetPackets.h:112
Position GetPosition() const
Definition Position.h:147

References GetNativeDisplayId(), Position::GetPosition(), sCreatureDisplayInfoStore, and WorldObject::SendMessageToSet().

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPlaySpellImpact()

void Unit::SendPlaySpellImpact ( ObjectGuid  guid,
uint32  id 
)
14898{
14900 data << guid; // target
14901 data << uint32(id); // SpellVisualKit.dbc index
14902 SendMessageToSet(&data, true);
14903}
@ SMSG_PLAY_SPELL_IMPACT
Definition Opcodes.h:533

References WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_IMPACT.

Referenced by debug_commandscript::HandleDebugVisualCommand().

◆ SendPlaySpellVisual()

◆ SendSpeedToController()

void Unit::SendSpeedToController ( UnitMoveType  mtype,
Player *  target 
) const
11181{
11182 SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[mtype];
11183 uint32 const counter = target->GetSession()->GetOrderCounter();
11184
11185 ++target->m_forced_speed_changes[mtype];
11186
11187 WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::PC)], 18);
11188 data << GetPackGUID();
11189 data << counter;
11190 if (mtype == MOVE_RUN)
11191 data << uint8(0);
11192
11193 data << GetSpeed(mtype);
11194 target->GetSession()->SendPacket(&data);
11195 target->GetSession()->IncrementOrderCounter();
11196}
const Opcodes SpeedOpcodePair[static_cast< size_t >(SpeedOpcodeIndex::MAX)]
Definition Unit.h:655
SpeedOpcodePair SetSpeed2Opc_table[MAX_MOVE_TYPE]
Definition Unit.h:656
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition Player.h:2446
float GetSpeed(UnitMoveType mtype) const
Definition Unit.cpp:11125

References WorldSession::GetOrderCounter(), Object::GetPackGUID(), Player::GetSession(), GetSpeed(), WorldSession::IncrementOrderCounter(), Player::m_forced_speed_changes, MOVE_RUN, PC, WorldSession::SendPacket(), and SetSpeed2Opc_table.

Referenced by RemoveCharmedBy(), and SetSpeed().

◆ SendSpellDamageImmune()

void Unit::SendSpellDamageImmune ( Unit *  target,
uint32  spellId 
)
6708{
6709 WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8 + 8 + 4 + 1);
6710 data << GetGUID();
6711 data << target->GetGUID();
6712 data << uint32(spellId);
6713 data << uint8(0); // bool - log format: 0-default, 1-debug
6714 SendMessageToSet(&data, true);
6715}
@ SMSG_SPELLORDAMAGE_IMMUNE
Definition Opcodes.h:641

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLORDAMAGE_IMMUNE.

Referenced by DealDamageShieldDamage(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectHealMaxHealth(), and AuraEffect::SendTickImmune().

◆ SendSpellDamageResist()

void Unit::SendSpellDamageResist ( Unit *  target,
uint32  spellId 
)
6698{
6699 WorldPacket data(SMSG_PROCRESIST, 8 + 8 + 4 + 1);
6700 data << GetGUID();
6701 data << target->GetGUID();
6702 data << uint32(spellId);
6703 data << uint8(0); // bool - log format: 0-default, 1-debug
6704 SendMessageToSet(&data, true);
6705}
@ SMSG_PROCRESIST
Definition Opcodes.h:638

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PROCRESIST.

◆ SendSpellNonMeleeDamageLog() [1/2]

void Unit::SendSpellNonMeleeDamageLog ( SpellNonMeleeDamage *  log)
6541{
6542 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6543 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6544 uint32 damage = log->damage;
6545 uint32 absorb = log->absorb;
6546 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6547 {
6548 absorb = damage;
6549 damage = 0;
6550 }
6551 data << log->target->GetPackGUID();
6552 data << log->attacker->GetPackGUID();
6553 data << uint32(log->spellInfo->Id);
6554 data << uint32(damage); // damage amount
6555 int32 overkill = damage - log->target->GetHealth();
6556 data << uint32(overkill > 0 ? overkill : 0); // overkill
6557 data << uint8 (log->schoolMask); // damage school
6558 data << uint32(absorb); // AbsorbedDamage
6559 data << uint32(log->resist); // resist
6560 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6561 data << uint8 (log->unused); // unused
6562 data << uint32(log->blocked); // blocked
6563 data << uint32(log->HitInfo);
6565 //if (log->HitInfo & SPELL_HIT_TYPE_CRIT_DEBUG)
6566 //{
6567 // data << float(log->CritRoll);
6568 // data << float(log->CritNeeded);
6569 //}
6570 //if (log->HitInfo & SPELL_HIT_TYPE_HIT_DEBUG)
6571 //{
6572 // data << float(log->HitRoll);
6573 // data << float(log->HitNeeded);
6574 //}
6575 //if (log->HitInfo & SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG)
6576 //{
6577 // data << float(log->MissChance);
6578 // data << float(log->DodgeChance);
6579 // data << float(log->ParryChance);
6580 // data << float(log->BlockChance);
6581 // data << float(log->GlanceChance);
6582 // data << float(log->CrushChance);
6583 //}
6584 SendMessageToSet(&data, true);
6585}
@ SPELL_HIT_TYPE_HIT_DEBUG
Definition SharedDefines.h:1541
@ SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG
Definition SharedDefines.h:1544
@ SPELL_HIT_TYPE_CRIT_DEBUG
Definition SharedDefines.h:1539
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition Opcodes.h:622
bool physicalLog
Definition Unit.h:529
bool unused
Definition Unit.h:530

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, WorldObject::SendMessageToSet(), SMSG_SPELLNONMELEEDAMAGELOG, SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG, SPELL_HIT_TYPE_CRIT_DEBUG, SPELL_HIT_TYPE_HIT_DEBUG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by CalcAbsorbResist(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectEnvironmentalDMG(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and SendSpellNonMeleeDamageLog().

◆ SendSpellNonMeleeDamageLog() [2/2]

void Unit::SendSpellNonMeleeDamageLog ( Unit *  target,
SpellInfo const *  spellInfo,
uint32  Damage,
SpellSchoolMask  damageSchoolMask,
uint32  AbsorbedDamage,
uint32  Resist,
bool  PhysicalDamage,
uint32  Blocked,
bool  CriticalHit = false,
bool  Split = false 
)
6588{
6589 SpellNonMeleeDamage log(this, target, spellInfo, damageSchoolMask);
6590 log.damage = Damage;
6591 log.absorb = AbsorbedDamage;
6592 log.resist = Resist;
6593 log.physicalLog = PhysicalDamage;
6594 log.blocked = Blocked;
6595 log.HitInfo = 0;
6596 if (CriticalHit)
6597 {
6598 log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6599 }
6600 if (Split)
6601 {
6602 log.HitInfo |= SPELL_HIT_TYPE_SPLIT;
6603 }
6605}
@ SPELL_HIT_TYPE_SPLIT
Definition SharedDefines.h:1542
Definition Unit.h:514

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::damage, SpellNonMeleeDamage::HitInfo, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SendSpellNonMeleeDamageLog(), SPELL_HIT_TYPE_CRIT, and SPELL_HIT_TYPE_SPLIT.

◆ SendSpellNonMeleeReflectLog()

void Unit::SendSpellNonMeleeReflectLog ( SpellNonMeleeDamage *  log,
Unit *  attacker 
)
6509{
6510 // Xinef: function for players only, placed in unit because of cosmetics
6511 if (!IsPlayer())
6512 return;
6513
6514 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6515 // If we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our HP bar will not drop
6516 uint32 damage = log->damage;
6517 uint32 absorb = log->absorb;
6518 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6519 {
6520 absorb = damage;
6521 damage = 0;
6522 }
6523 data << log->target->GetPackGUID();
6524 data << attacker->GetPackGUID();
6525 data << uint32(log->spellInfo->Id);
6526 data << uint32(damage); // damage amount
6527 int32 overkill = damage - log->target->GetHealth();
6528 data << uint32(overkill > 0 ? overkill : 0); // overkill
6529 data << uint8 (log->schoolMask); // damage school
6530 data << uint32(absorb); // AbsorbedDamage
6531 data << uint32(log->resist); // resist
6532 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6533 data << uint8 (log->unused); // unused
6534 data << uint32(log->blocked); // blocked
6535 data << uint32(log->HitInfo);
6536 data << uint8 (0); // flag to use extend data
6537 ToPlayer()->SendDirectMessage(&data);
6538}

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, Player::SendDirectMessage(), SMSG_SPELLNONMELEEDAMAGELOG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by Spell::DoAllEffectOnTarget().

◆ SendTameFailure()

void Unit::SendTameFailure ( uint8  result)
15699{
15701 data << uint8(result);
15702 ToPlayer()->SendDirectMessage(&data);
15703}
@ SMSG_PET_TAME_FAILURE
Definition Opcodes.h:401

References Player::SendDirectMessage(), SMSG_PET_TAME_FAILURE, and Object::ToPlayer().

Referenced by spell_hun_tame_beast::CheckCast(), and Spell::CheckCast().

◆ SendTeleportPacket()

void Unit::SendTeleportPacket ( Position &  pos)
15706{
15708 if (IsCreature())
15709 Relocate(&pos);
15710 if (IsPlayer())
15711 {
15712 ToPlayer()->SetCanTeleport(true);
15713 }
15714 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
15715 data2 << GetPackGUID();
15716 BuildMovementPacket(&data2);
15717 if (IsCreature())
15718 Relocate(&oldPos);
15719 if (IsPlayer())
15720 Relocate(&pos);
15721 SendMessageToSet(&data2, false);
15722}
@ MSG_MOVE_TELEPORT
Definition Opcodes.h:227

References BuildMovementPacket(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsCreature(), Object::IsPlayer(), MSG_MOVE_TELEPORT, Position::Relocate(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), and Object::ToPlayer().

Referenced by NearTeleportTo(), and Player::TeleportTo().

◆ SetAI()

void Unit::SetAI ( UnitAI *  newAI)
inline
700{ i_AI = newAI; }

References i_AI.

◆ SetAnimTier()

◆ SetArmor()

void Unit::SetArmor ( int32  val)
inline

◆ SetAttackTime()

◆ setAttackTimer()

◆ SetAuraStack()

void Unit::SetAuraStack ( uint32  spellId,
Unit *  target,
uint32  stack 
)
14881{
14882 Aura* aura = target->GetAura(spellId, GetGUID());
14883 if (!aura)
14884 aura = AddAura(spellId, target);
14885 if (aura && stack)
14886 aura->SetStackAmount(stack);
14887}
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:1048

References AddAura(), GetAura(), Object::GetGUID(), and Aura::SetStackAmount().

Referenced by boss_viscidus::DamageTaken(), spell_capacitus_polarity_charge::HandleTargets(), spell_thaddius_pos_neg_charge::HandleTargets(), BattlefieldWG::OnPlayerJoinWar(), and npc_auriaya_feral_defender::Reset().

◆ SetBaseWeaponDamage()

void Unit::SetBaseWeaponDamage ( WeaponAttackType  attType,
WeaponDamageRange  damageRange,
float  value,
uint8  damageIndex = 0 
)
inline
1226{ m_weaponDamage[attType][damageRange][damageIndex] = value; }

References m_weaponDamage.

Referenced by Player::_ApplyWeaponDamage(), Guardian::InitStatsForLevel(), and Creature::SelectLevel().

◆ SetCanDualWield()

virtual void Unit::SetCanDualWield ( bool  value)
inlinevirtual

◆ SetCanFly()

void Unit::SetCanFly ( bool  enable)

Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().

Doesn't inform the client.

16297{
16298 bool isClientControlled = IsClientControlled();
16299
16300 // The owning client ignores the spline packet for its own mover, so replay it once Fear/Confuse ends
16301 if (Player* player = ToPlayer())
16302 {
16303 if (isClientControlled)
16304 player->ClearPendingCanFlyResync();
16306 player->SetPendingCanFlyResync(enable);
16307 }
16308
16309 if (!isClientControlled)
16310 {
16311 if (enable)
16313 else
16315 }
16316
16317 if (!IsInWorld()) // is sent on add to map
16318 return;
16319
16320 if (isClientControlled)
16321 {
16322 if (Player const* player = GetClientControlling())
16323 {
16324 uint32 const counter = player->GetSession()->GetOrderCounter();
16325 const_cast<Player*>(player)->SetPendingFlightChange(counter);
16326
16328 data << GetPackGUID();
16329 data << counter;
16330 player->SendDirectMessage(&data);
16331 player->GetSession()->IncrementOrderCounter();
16332 return;
16333 }
16334 }
16335
16337 data << GetPackGUID();
16338 SendMessageToSet(&data, true);
16339}
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:396
@ SMSG_SPLINE_MOVE_SET_FLYING
Definition Opcodes.h:1088
@ SMSG_MOVE_SET_CAN_FLY
Definition Opcodes.h:865
@ SMSG_SPLINE_MOVE_UNSET_FLYING
Definition Opcodes.h:1089
@ SMSG_MOVE_UNSET_CAN_FLY
Definition Opcodes.h:866

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), HasUnitFlag(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_CAN_FLY, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_SET_CAN_FLY, SMSG_MOVE_UNSET_CAN_FLY, SMSG_SPLINE_MOVE_SET_FLYING, SMSG_SPLINE_MOVE_UNSET_FLYING, Object::ToPlayer(), UNIT_FLAG_CONFUSED, and UNIT_FLAG_FLEEING.

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_kalecgos_kj::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), brann_bronzebeard::DoMarnakDarkMatter(), boss_nightbane::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), PlayerCanFlyControlLossTest::ExpectRevokeReplayedAfter(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), debug_commandscript::HandleDebugMoveflagsCommand(), gm_commandscript::HandleGMFlyCommand(), WorldSession::HandleMoveKnockBackAck(), boss_felmyst::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_urom::boss_uromAI::JustDied(), boss_ayamiss::JustEngagedWith(), npc_icc_spire_frostwyrm::JustReachedHome(), brann_bronzebeard::JustSummoned(), boss_ingvar_the_plunderer::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_frost_sphere::Land(), boss_onyxia::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_icc_spire_frostwyrm::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_pet_dk_ebon_gargoyle::MovementInform(), npc_alexstrasza::npc_alexstrasza(), npc_batrider::npc_batrider(), npc_pet_gen_moth::npc_pet_gen_moth(), spell_chapter5_light_of_dawn_aura::OnApply(), spell_chapter5_light_of_dawn_aura::OnRemove(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), boss_nefarian::Reset(), boss_nightbane::Reset(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_valkyr_battle_maiden::Reset(), npc_hallows_end_soh::Reset(), boss_onyxia::Reset(), boss_ayamiss::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), npc_icc_spire_frostwyrm::Reset(), npc_ulduar_mimiron_rocket::Reset(), boss_nazan::Reset(), Player::ResyncCanFlyToClient(), boss_felmyst::ScheduleGroundAbilities(), Player::SendInitialPacketsAfterAddToMap(), instance_halls_of_reflection::SetData(), SmartAI::SetFly(), npc_simon_bunny::npc_simon_bunnyAI::SetGUID(), boss_urom::boss_uromAI::SpellHit(), boss_felmyst::StartIntro(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_batrider::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetCanModifyStats()

◆ SetCantProc()

void Unit::SetCantProc ( bool  apply)
13391{
13392 if (apply)
13393 ++m_procDeep;
13394 else
13395 {
13397 --m_procDeep;
13398 }
13399}

References ASSERT, and m_procDeep.

Referenced by TriggerAurasProcOnEvent().

◆ SetCharm()

void Unit::SetCharm ( Unit *  target,
bool  apply 
)
Todo:
: maybe we can use this flag to check if controlled by player
7811{
7812 if (apply)
7813 {
7814 if (IsPlayer())
7815 {
7816 if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
7817 LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
7818
7819 charm->m_ControlledByPlayer = true;
7821 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7822 }
7823 else
7824 {
7825 charm->m_ControlledByPlayer = false;
7827 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7828 }
7829
7830 // PvP, FFAPvP
7831 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
7832
7833 if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
7834 LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
7835
7836 _isWalkingBeforeCharm = charm->IsWalking();
7838 {
7839 charm->SetWalk(false);
7840 charm->SendMovementFlagUpdate();
7841 }
7842
7843 m_Controlled.insert(charm);
7844 }
7845 else
7846 {
7847 charm->ClearUnitState(UNIT_STATE_CHARMED);
7848
7849 if (IsPlayer())
7850 {
7851 if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
7852 LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
7853 }
7854
7855 if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
7856 LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
7857
7858 if (charm->IsPlayer())
7859 {
7860 charm->m_ControlledByPlayer = true;
7861 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7862 charm->ToPlayer()->UpdatePvPState();
7863 }
7864 else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
7865 {
7866 charm->m_ControlledByPlayer = true;
7867 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7868 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
7869
7870 // Xinef: skip controlled erase if charmed unit is owned by charmer
7871 if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION)))
7872 return;
7873 }
7874 else
7875 {
7876 charm->m_ControlledByPlayer = false;
7877 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
7878 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
7879 }
7880
7881 if (charm->IsWalking() != _isWalkingBeforeCharm)
7882 {
7883 charm->SetWalk(_isWalkingBeforeCharm);
7884 charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
7885 }
7886
7887 m_Controlled.erase(charm);
7888 }
7889}
@ UNIT_STATE_CHARMED
Definition UnitDefines.h:175
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:684
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:702

References _isWalkingBeforeCharm, Object::AddGuidValue(), ClearUnitState(), Object::GetByteValue(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), WorldObject::GetName(), HasUnitFlag(), HasUnitTypeMask(), IsDuringRemoveFromWorld(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), IsWalking(), LOG_FATAL, m_Controlled, m_ControlledByPlayer, Object::RemoveGuidValue(), RemoveUnitFlag(), SendMovementFlagUpdate(), Object::SetByteValue(), SetUnitFlag(), SetWalk(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), UNIT_FIELD_BYTES_2, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MASK_MINION, UNIT_STATE_CHARMED, and Player::UpdatePvPState().

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Player::StopCastingCharm().

◆ SetCharmedBy()

bool Unit::SetCharmedBy ( Unit *  charmer,
CharmType  type,
AuraApplication const *  aurApp = nullptr 
)
14315{
14316 if (!charmer)
14317 return false;
14318
14319 if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld())
14320 {
14321 return false;
14322 }
14323
14324 // dismount players when charmed
14325 if (IsPlayer() && type != CHARM_TYPE_POSSESS)
14327
14328 if (charmer->IsPlayer())
14330
14331 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
14332 if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard
14333 throw 1;
14334 ASSERT((type == CHARM_TYPE_VEHICLE) == (GetVehicleKit() && GetVehicleKit()->IsControllableVehicle()));
14335
14336 LOG_DEBUG("entities.unit", "SetCharmedBy: charmer {} ({}), charmed {} ({}), type {}.",
14337 charmer->GetEntry(), charmer->GetGUID().ToString(), GetEntry(), GetGUID().ToString(), uint32(type));
14338
14339 if (this == charmer)
14340 {
14341 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit {} ({}) is trying to charm itself!", GetEntry(), GetGUID().ToString());
14342 return false;
14343 }
14344
14345 //if (HasUnitState(UNIT_STATE_UNATTACKABLE))
14346 // return false;
14347
14348 if (IsPlayer() && ToPlayer()->GetTransport())
14349 {
14350 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString());
14351 return false;
14352 }
14353
14354 // Already charmed
14355 if (GetCharmerGUID())
14356 {
14357 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) has already been charmed but {} ({}) is trying to charm it!",
14358 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
14359 return false;
14360 }
14361
14362 CastStop();
14363 AttackStop();
14364
14365 Player* playerCharmer = charmer->ToPlayer();
14366
14367 // Charmer stop charming
14368 if (playerCharmer)
14369 {
14370 playerCharmer->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
14371 playerCharmer->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
14372 }
14373
14374 // Charmed stop charming
14375 if (IsPlayer())
14376 {
14377 ToPlayer()->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
14378 ToPlayer()->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
14379 }
14380
14381 // StopCastingCharm may remove a possessed pet?
14382 if (!IsInWorld())
14383 {
14384 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) is not in world but {} ({}) is trying to charm it!",
14385 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
14386 return false;
14387 }
14388
14389 // charm is set by aura, and aura effect remove handler was called during apply handler execution
14390 // prevent undefined behaviour
14391 if (aurApp && aurApp->GetRemoveMode())
14392 return false;
14393
14395 SetFaction(charmer->GetFaction());
14396
14397 // snapshot current speed rates so we can detect speed changes
14398 for (uint8 i = MOVE_WALK; i < MAX_MOVE_TYPE; ++i)
14400
14401 // Set charmed
14402 charmer->SetCharm(this, true);
14403
14405
14406 if (IsCreature())
14407 {
14408 GetMotionMaster()->Clear(false);
14410 StopMoving();
14411
14412 if (charmer->IsPlayer() && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON)
14413 {
14414 // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
14415 Creature* charmed = ToCreature();
14416 charmed->NeedChangeAI = true;
14417 charmed->IsAIEnabled = false;
14418 }
14419 else
14420 {
14421 ToCreature()->AI()->OnCharmed(true);
14422 }
14423
14424 // Xinef: If creature can fly, add normal player flying flag (fixes speed)
14425 if (charmer->IsPlayer() && ToCreature()->CanFly())
14427 }
14428 else
14429 {
14430 Player* player = ToPlayer();
14431 if (player->isAFK())
14432 player->ToggleAFK();
14433
14434 player->SetClientControl(this, false); // verified
14435 }
14436
14437 // charm is set by aura, and aura effect remove handler was called during apply handler execution
14438 // prevent undefined behaviour
14439 if (aurApp && aurApp->GetRemoveMode())
14440 return false;
14441
14442 // Pets already have a properly initialized CharmInfo, don't overwrite it.
14443 // Xinef: I need charmInfo for vehicle
14444 if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo())
14445 {
14446 InitCharmInfo();
14447 if (type == CHARM_TYPE_POSSESS)
14449 else if (type != CHARM_TYPE_VEHICLE)
14450 {
14452
14453 // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers
14454 if (type == CHARM_TYPE_CONVERT && IsCreature())
14456 }
14457 }
14458
14459 if (playerCharmer)
14460 {
14461 switch (type)
14462 {
14463 case CHARM_TYPE_VEHICLE:
14466 playerCharmer->SetClientControl(this, true); // verified
14467 playerCharmer->VehicleSpellInitialize();
14468 break;
14469 case CHARM_TYPE_POSSESS:
14474 playerCharmer->SetClientControl(this, true); // verified
14475 playerCharmer->PossessSpellInitialize();
14476 break;
14477 case CHARM_TYPE_CHARM:
14479 {
14481 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
14482 {
14483 // to prevent client crash
14485
14486 // just to enable stat window
14487 if (GetCharmInfo())
14488 GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
14489
14490 // if charmed two demons the same session, the 2nd gets the 1st one's name
14491 SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
14492 }
14493 }
14494 if (playerCharmer->m_seer != this)
14495 {
14497 playerCharmer->CharmSpellInitialize();
14498 }
14499 break;
14500 default:
14501 break;
14502 }
14503 }
14504 else if (IsPlayer())
14506
14508
14509 if (Creature* creature = ToCreature())
14510 creature->RefreshSwimmingFlag();
14511
14512 if (IsPlayer())
14513 sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
14514
14515 return true;
14516}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
@ CLASS_MAGE
Definition SharedDefines.h:133
@ REACT_DEFENSIVE
Definition Unit.h:575
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition UpdateFields.h:133
void OnCharmed(bool apply) override
Called when unit is charmed.
Definition CreatureAI.cpp:36
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
void MoveIdle()
Definition MotionMaster.cpp:235
void CharmSpellInitialize()
Definition Player.cpp:9979
WorldObject * m_seer
Definition Player.h:2378
void ToggleAFK()
Definition Player.cpp:1362
void PossessSpellInitialize()
Definition Player.cpp:9876
bool isAFK() const
Definition Player.h:1151
void VehicleSpellInitialize()
Definition Player.cpp:9904
void StopCastingBindSight(Aura *except=nullptr)
Definition Player.cpp:13573
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:778
virtual float GetFollowAngle() const
Definition Unit.h:1917
CharmInfo * InitCharmInfo()
Definition Unit.cpp:12362
void InitPossessCreateSpells()
Definition CharmInfo.cpp:77
void InitCharmCreateSpells()
Definition CharmInfo.cpp:98

References _charmStartSpeedRate, _oldFactionId, AddUnitMovementFlag(), AddUnitState(), Creature::AI(), ASSERT, AttackStop(), CanFly(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_CONVERT, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, Player::CharmSpellInitialize(), CLASS_CONTEXT_PET_CHARM, CLASS_MAGE, CLASS_WARLOCK, MotionMaster::Clear(), CREATURE_TYPE_DEMON, AuraApplication::GetBase(), GetCharmerGUID(), GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFaction(), GetFollowAngle(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGUID(), GetMotionMaster(), AuraApplication::GetRemoveMode(), WorldObject::GetTransport(), GetVehicleKit(), CharmInfo::InitCharmCreateSpells(), InitCharmInfo(), CharmInfo::InitPossessCreateSpells(), Player::isAFK(), IsAIEnabled, IsClass(), Object::IsCreature(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Object::IsPlayer(), IsVehicle(), LOG_DEBUG, LOG_FATAL, Player::m_seer, m_speed_rate, MAX_MOVE_TYPE, MOVE_WALK, MotionMaster::MoveFollow(), MotionMaster::MoveIdle(), MOVEMENTFLAG_FLYING, NeedChangeAI, CreatureAI::OnCharmed(), PET_FOLLOW_DIST, Player::PossessSpellInitialize(), REACT_DEFENSIVE, RemoveAurasByType(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), Creature::SetReactState(), SetUInt32Value(), SetUnitFlag(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, StopAttackingInvalidTarget(), Player::StopCastingBindSight(), Player::StopCastingCharm(), StopMoving(), Object::ToCreature(), Player::ToggleAFK(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), CreatureTemplate::type, UNIT_FIELD_BYTES_0, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_STATE_CHARMED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and Player::VehicleSpellInitialize().

Referenced by Vehicle::AddPassenger(), AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), and Puppet::InitSummon().

◆ SetCharmerGUID()

void Unit::SetCharmerGUID ( ObjectGuid  owner)
inline

◆ SetCombatTimer()

void Unit::SetCombatTimer ( uint32  timer)
inline
957{ m_CombatTimer = timer; }

References m_CombatTimer.

◆ SetConfused()

void Unit::SetConfused ( bool  apply)
protected
14280{
14281 if (apply)
14282 {
14283 SetTarget();
14285 }
14286 else
14287 {
14288 if (IsAlive())
14289 {
14290 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE)
14291 {
14293 StopMoving();
14294 }
14295
14296 if (GetVictim())
14298 }
14299 }
14300
14301 // xinef: block / allow control to real mover (eg. charmer)
14302 if (IsPlayer())
14303 {
14304 if (m_movedByPlayer)
14305 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
14306 //else
14307 // ToPlayer()->SetClientControl(this, !apply);
14308
14309 if (!apply)
14311 }
14312}
@ CONFUSED_MOTION_TYPE
Definition MotionMaster.h:44
void MoveConfused()
Enable the confusion movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:295
void ResyncCanFlyToClient()
Definition Player.cpp:13317

References CONFUSED_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveConfused(), MotionMaster::MovementExpired(), Player::ResyncCanFlyToClient(), Player::SetClientControl(), SetTarget(), StopMoving(), and Object::ToPlayer().

Referenced by SetControlled().

◆ SetContestedPvP()

void Unit::SetContestedPvP ( Player *  attackedPlayer = nullptr,
bool  lookForNearContestedGuards = true 
)
13353{
13355
13356 if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->Opponent == attackedPlayer))) || player->InBattleground()))
13357 return;
13358
13359 // check if there any guards that should care about the contested flag on player
13360 if (lookForNearContestedGuards)
13361 {
13362 std::list<Unit*> targets;
13365 Cell::VisitObjects(this, searcher, MAX_AGGRO_RADIUS);
13366
13367 // return if there are no contested guards found
13368 if (!targets.size())
13369 {
13370 return;
13371 }
13372 }
13373
13374 player->SetContestedPvPTimer(30000);
13376 {
13379 // call MoveInLineOfSight for nearby contested guards
13381 }
13383 {
13385 // call MoveInLineOfSight for nearby contested guards
13387 }
13388}
#define MAX_AGGRO_RADIUS
Definition Unit.h:45
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1126
bool InBattleground() const
Definition Player.h:2295
void SetContestedPvPTimer(uint32 newTime)
Definition Player.h:1898

References WorldObject::AddToNotify(), AddUnitState(), Player::duel, GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitState(), Player::InBattleground(), MAX_AGGRO_RADIUS, NOTIFY_AI_RELOCATION, PLAYER_FLAGS_CONTESTED_PVP, Player::SetContestedPvPTimer(), Player::SetPlayerFlag(), UNIT_STATE_ATTACK_PLAYER, and Cell::VisitObjects().

Referenced by AtTargetAttacked(), Spell::DoSpellHitOnUnit(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetControlled()

void Unit::SetControlled ( bool  apply,
UnitState  state,
Unit *  source = nullptr,
bool  isFear = false 
)
14002{
14003 if (apply)
14004 {
14005 if (HasUnitState(state))
14006 return;
14007
14008 AddUnitState(state);
14009 switch (state)
14010 {
14011 case UNIT_STATE_STUNNED:
14012 SetStunned(true);
14013 break;
14014 case UNIT_STATE_ROOT:
14016 SetRooted(true);
14017 break;
14020 {
14023 // SendAutoRepeatCancel ?
14024 SetConfused(true);
14025 CastStop(0, false);
14026 }
14027 break;
14028 case UNIT_STATE_FLEEING:
14030 {
14033 // SendAutoRepeatCancel ?
14034 SetFeared(true, source, isFear);
14035 CastStop(0, false);
14036 }
14037 break;
14038 default:
14039 break;
14040 }
14041
14042 if (IsPlayer())
14043 {
14044 sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
14045 }
14046 }
14047 else
14048 {
14049 // xinef: moved from below, checked all SetX functions, no calls to currently modified state
14050 // xinef: added to each case because of return
14051 //ClearUnitState(state);
14052
14053 switch (state)
14054 {
14055 case UNIT_STATE_STUNNED:
14056 if (HasStunAura())
14057 return;
14058 ClearUnitState(state);
14059 SetStunned(false);
14060 break;
14061 case UNIT_STATE_ROOT:
14062 // Prevent the DB rooted flag from being removed on aura expiration.
14063 if (IsCreature())
14064 if (ToCreature()->GetMovementTemplate().IsRooted())
14065 return;
14066
14067 if (HasRootAura() || GetVehicle())
14068 return;
14069 ClearUnitState(state);
14070 SetRooted(false);
14071 break;
14073 if (HasConfuseAura())
14074 return;
14075 ClearUnitState(state);
14076 SetConfused(false);
14077 break;
14078 case UNIT_STATE_FLEEING:
14079 if (HasFearAura())
14080 return;
14081 ClearUnitState(state);
14082 SetFeared(false);
14083 break;
14084 default:
14085 return;
14086 }
14087
14088 //ClearUnitState(state);
14089
14091 SetStunned(true);
14092 else
14093 {
14095 SetRooted(true);
14096
14098 SetConfused(true);
14100 {
14101 bool isFear = false;
14102 if (HasFearAura())
14103 {
14104 isFear = true;
14105 source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
14106 }
14107
14108 if (!source)
14109 {
14110 source = getAttackerForHelper();
14111 }
14112
14113 SetFeared(true, source, isFear);
14114 }
14115 }
14116 }
14117}
void SetFeared(bool apply, Unit *fearedBy=nullptr, bool isFear=false)
Definition Unit.cpp:14244
bool HasStunAura() const
Definition Unit.h:1858
void SetConfused(bool apply)
Definition Unit.cpp:14279
void SetStunned(bool apply)
Definition Unit.cpp:14119
Unit * getAttackerForHelper() const
Definition Unit.cpp:878
bool HasConfuseAura() const
Definition Unit.h:1856
void SetRooted(bool apply, bool stun=false, bool logout=false)
Definition Unit.cpp:14165
bool HasRootAura() const
Definition Unit.h:1857
bool HasFearAura() const
Definition Unit.h:1855

References AddUnitState(), CastStop(), ClearUnitState(), getAttackerForHelper(), GetAuraEffectsByType(), ObjectAccessor::GetUnit(), GetVehicle(), HasConfuseAura(), HasFearAura(), HasRootAura(), HasStunAura(), HasUnitState(), Object::IsCreature(), Object::IsPlayer(), IsRooted(), SendMeleeAttackStop(), SetConfused(), SetFeared(), SetRooted(), SetStunned(), SPELL_AURA_MOD_FEAR, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, UNIT_STATE_MELEE_ATTACKING, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by _ExitVehicle(), Vehicle::AddPassenger(), boss_ahune::boss_ahune(), boss_ouro::boss_ouro(), boss_black_knight::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_black_knight_skeletal_gryphon::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), Creature::DoFleeToGetAssistance(), boss_skeram::DoTeleport(), boss_yoggsaron_immortal_guardian::EngageFromStasis(), CritterAI::EnterEvadeMode(), boss_devourer_of_souls::EnterEvadeMode(), boss_falric::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_noth::boss_nothAI::EnterEvadeMode(), boss_thaddius_summon::boss_thaddius_summonAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), boss_svala::boss_svalaAI::EnterEvadeMode(), boss_cyanigosa::EnterEvadeMode(), boss_shirrak_the_dead_watcher::EnterEvadeMode(), boss_cyanigosa::ExecuteEvent(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleAuraModRoot(), AuraEffect::HandleAuraModStun(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_gen_visual_dummy_stun::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_gen_visual_dummy_stun::HandleEffectRemove(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModFear(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), AuraEffect::HandlePreventFleeing(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_volazj::JustDied(), CritterAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_skeram::JustSummoned(), npc_twilight_volunteer::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_volkhan::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_gunship_gunner::npc_gunship_gunnerAI::MovementInform(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_hodirs_fury::MovementInform(), npc_iron_watcher::npc_iron_watcherAI::MovementInform(), npc_buru_egg::npc_buru_egg(), npc_icc_blood_beast::npc_icc_blood_beastAI::npc_icc_blood_beastAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayal(), npc_raging_spirit::npc_raging_spiritAI::npc_raging_spiritAI(), npc_vengeful_shade::npc_vengeful_shadeAI::npc_vengeful_shadeAI(), spell_systems_shutdown_aura::OnApply(), spell_systems_shutdown_aura::OnRemove(), npc_akama_illidan::PathEndReached(), boss_ragnaros::Reset(), boss_skeram::Reset(), boss_volazj::Reset(), npc_twilight_summon::Reset(), boss_devourer_of_souls::Reset(), boss_falric::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_thaddius_summon::boss_thaddius_summonAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::Reset(), boss_thorim_pillar::Reset(), boss_yoggsaron_immortal_guardian::Reset(), boss_ingvar_the_plunderer::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), npc_iron_watcher::npc_iron_watcherAI::Reset(), boss_shirrak_the_dead_watcher::Reset(), boss_illidan_stormrage::Reset(), npc_akama_illidan::Reset(), npc_target_dummy::Reset(), boss_illidan_stormrage::ScheduleAbilities(), Player::SetClientControl(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::SpellHitTarget(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_volkhan::SpellHitTarget(), boss_devourer_of_souls::SpellHitTarget(), boss_ionar::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_noth::boss_nothAI::StartGroundPhase(), boss_skeram::UpdateAI(), boss_volazj::UpdateAI(), boss_falric::UpdateAI(), npc_icc_blood_beast::npc_icc_blood_beastAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ionar::UpdateAI(), npc_hodirs_fury::UpdateAI(), boss_ignis::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_target_dummy::UpdateAI(), Creature::UpdateEntry(), and npc_black_knight_skeletal_gryphon::WaypointReached().

◆ SetCreateHealth()

◆ SetCreateMana()

◆ SetCreateStat()

void Unit::SetCreateStat ( Stats  stat,
float  val 
)
inline

◆ SetCreatorGUID()

◆ SetCritterGUID()

void Unit::SetCritterGUID ( ObjectGuid  guid)
inline

◆ SetCurrentCastedSpell()

void Unit::SetCurrentCastedSpell ( Spell *  pSpell)
3894{
3895 ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
3896
3897 CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
3898
3899 if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
3900 return;
3901
3902 bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
3903
3904 // break same type spell if it is not delayed
3905 InterruptSpell(CSpellType, false, true, bySelf);
3906
3907 // special breakage effects:
3908 switch (CSpellType)
3909 {
3911 {
3912 // generic spells always break channeled not delayed spells
3914 {
3915 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3916 {
3918 }
3919 }
3920
3921 // autorepeat breaking
3923 {
3924 // break autorepeat if not Auto Shot
3925 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3927 m_AutoRepeatFirstCast = true;
3928 }
3929
3930 // melee spells breaking
3932 {
3933 // break melee spells if cast time
3934 if (pSpell->GetCastTime() > 0)
3935 {
3937 }
3938 }
3939 if (pSpell->GetCastTime() > 0)
3941
3942 break;
3943 }
3945 {
3946 // channel spells always break generic non-delayed and any channeled spells,
3947 // unless the channel itself is allowed to run alongside other actions
3948 if (!pSpell->GetSpellInfo()->IsActionAllowedChannel())
3950
3951 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
3952
3953 // it also does break autorepeat if not Auto Shot
3955 m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3957
3959
3960 break;
3961 }
3963 {
3964 // only Auto Shoot does not break anything
3965 if (pSpell->m_spellInfo->Id != 75)
3966 {
3967 // generic autorepeats break generic non-delayed and channeled non-delayed spells
3969 {
3970 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3971 {
3973 }
3974 }
3975
3977 }
3978 // special action: set first cast flag
3979 m_AutoRepeatFirstCast = true;
3980
3981 break;
3982 }
3983
3984 default:
3985 // other spell types don't break anything now
3986 break;
3987 }
3988
3989 // current spell (if it is still here) may be safely deleted now
3990 if (m_currentSpells[CSpellType])
3991 m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
3992
3993 // set new current spell
3994 m_currentSpells[CSpellType] = pSpell;
3995 pSpell->SetReferencedFromCurrent(true);
3996
3997 pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
3998}
bool IsActionAllowedChannel() const
Definition SpellInfo.cpp:1306
CurrentSpellTypes GetCurrentContainer() const
Definition Spell.cpp:8330
Spell ** m_selfContainer
Definition Spell.h:644

References AddUnitState(), ASSERT, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, Spell::GetCastTime(), Spell::GetCurrentContainer(), GetCurrentSpell(), Spell::GetSpellInfo(), SpellInfo::Id, InterruptSpell(), SpellInfo::IsActionAllowedChannel(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_selfContainer, Spell::m_spellInfo, Spell::SetReferencedFromCurrent(), and UNIT_STATE_CASTING.

Referenced by Spell::prepare().

◆ setDeathState()

void Unit::setDeathState ( DeathState  s,
bool  despawn = false 
)
virtual

Reimplemented in Creature, Minion, Pet, and Player.

11199{
11200 bool const wasAlive = IsAlive();
11201
11202 // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
11203 // it can be used to check creation of death items (such as soul shards).
11204 m_deathState = s;
11205
11207 {
11208 if (wasAlive)
11209 {
11211 // restart our pvp timers so units fighting us get a full pvp timeout from our death (#27967)
11213 }
11214 CombatStop(false, /*mutualPvP*/ true, /*keepPvPForOthers*/ true);
11215 ClearComboPointHolders(); // any combo points pointed to unit lost at it death
11216
11217 if (IsNonMeleeSpellCast(false))
11219
11220 UnsummonAllTotems(true);
11221 RemoveAllControlled(true);
11223 }
11224
11225 if (s == DeathState::JustDied)
11226 {
11227 // remove aurastates allowing special moves
11230
11231 GetMotionMaster()->Clear(false);
11233
11234 // Xinef: Remove Hover so the corpse can fall to the ground
11235 SetHover(false);
11236
11237 if (despawn)
11238 DisableSpline();
11239 else
11240 StopMoving();
11241
11242 // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
11243 // do not why since in IncreaseMaxHealth currenthealth is checked
11244 SetHealth(0);
11245 SetPower(getPowerType(), 0);
11246
11247 // Stop emote on death
11249
11250 // players in instance don't have ZoneScript, but they have InstanceScript
11252 zoneScript->OnUnitDeath(this);
11253 }
11254 else if (s == DeathState::JustRespawned)
11255 {
11256 RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
11257 }
11258}
@ UNIT_FLAG_SKINNABLE
Definition UnitDefines.h:283
void SetHover(bool enable)
Definition Unit.cpp:16382
void ClearAllReactives()
Definition Unit.cpp:13019
void ClearDiminishings()
Definition Unit.h:1883
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
ZoneScript * GetZoneScript() const
Definition Object.h:643
Definition ZoneScript.h:26

References Alive, MotionMaster::Clear(), ClearAllReactives(), ClearComboPointHolders(), ClearDiminishings(), CombatStop(), DisableSpline(), GetCombatManager(), GameTime::GetGameTimeMS(), WorldObject::GetInstanceScript(), GetMotionMaster(), getPowerType(), WorldObject::GetZoneScript(), InterruptNonMeleeSpells(), IsAlive(), IsNonMeleeSpellCast(), JustDied, JustRespawned, m_deathState, m_lastDeathTime, MotionMaster::MoveIdle(), RemoveAllAurasOnDeath(), RemoveAllControlled(), Object::RemoveFlag(), CombatManager::RestartPvPCombatTimers(), SetHealth(), SetHover(), SetPower(), SetUInt32Value(), StopMoving(), UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE, UNIT_NPC_EMOTESTATE, and UnsummonAllTotems().

Referenced by _ExitVehicle(), KillMagnetEvent::Execute(), Spell::finish(), WorldSession::HandlePetActionHelper(), AuraEffect::HandleSpiritOfRedemption(), Kill(), and Creature::setDeathState().

◆ SetDisableGravity()

void Unit::SetDisableGravity ( bool  disable)
16237{
16238 bool isClientControlled = IsClientControlled();
16239
16240 if (!isClientControlled)
16241 {
16242 if (enable)
16244 else
16246 }
16247
16248 if (!IsInWorld()) // is sent on add to map
16249 return;
16250
16251 if (isClientControlled)
16252 {
16253 if (Player const* player = GetClientControlling())
16254 {
16255 uint32 const counter = player->GetSession()->GetOrderCounter();
16256
16258 data << GetPackGUID();
16259 data << counter;
16260 player->GetSession()->SendPacket(&data);
16261 player->GetSession()->IncrementOrderCounter();
16262 return;
16263 }
16264 }
16265
16267 data << GetPackGUID();
16268 SendMessageToSet(&data, true);
16269}
@ SMSG_SPLINE_MOVE_GRAVITY_DISABLE
Definition Opcodes.h:1265
@ SMSG_MOVE_GRAVITY_DISABLE
Definition Opcodes.h:1260
@ SMSG_MOVE_GRAVITY_ENABLE
Definition Opcodes.h:1262
@ SMSG_SPLINE_MOVE_GRAVITY_ENABLE
Definition Opcodes.h:1266

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_DISABLE_GRAVITY, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_GRAVITY_DISABLE, SMSG_MOVE_GRAVITY_ENABLE, SMSG_SPLINE_MOVE_GRAVITY_DISABLE, and SMSG_SPLINE_MOVE_GRAVITY_ENABLE.

Referenced by boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_yoggsaron_brain::boss_yoggsaron_brain(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_the_lurker_below::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_nightbane::DoAction(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_razorscale::DoAction(), npc_madrigosa::DoAction(), boss_kalecgos::DoAction(), npc_kalecgos_kj::DoAction(), npc_ulduar_aerial_command_unit::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_nightbane::EnterEvadeMode(), boss_malygos::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_razorscale::EnterEvadeMode(), boss_kaelthas::ExecuteMiddleEvent(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), boss_sartharion_dragonAI::HandleExtraEvent(), spell_the_lich_king_valkyr_target_search::HandleScript(), boss_razorscale::Initialize(), boss_felmyst::InitializeAI(), boss_taldaram::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_kologarn::JustDied(), boss_ayamiss::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), npc_spinestalker::npc_spinestalkerAI::JustReachedHome(), npc_rimefang::npc_rimefangAI::JustReachedHome(), boss_sister_svalna::boss_sister_svalnaAI::JustReachedHome(), npc_icc_spire_frostwyrm::JustReachedHome(), boss_ingvar_the_plunderer::JustSummoned(), npc_kiljaeden_controller::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_algalon_the_observer::MovementInform(), npc_enslaved_netherwing_drake::MovementInform(), boss_onyxia::MovementInform(), boss_ayamiss::MovementInform(), boss_taldaram::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_spire_frostwyrm::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_malygos::MovementInform(), npc_oculus_drake::npc_oculus_drakeAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), npc_hallows_end_soh::MovementInform(), boss_headless_horseman::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_kaelthas::MovementInform(), npc_pet_dk_ebon_gargoyle::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_razorscale::MovementInform(), npc_alexstrasza::npc_alexstrasza(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_gothik_trigger::npc_gothik_triggerAI::npc_gothik_triggerAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::npc_icc_nerubar_broodkeeperAI(), npc_korkron_or_wildhammer::npc_korkron_or_wildhammer(), npc_nightbane_helper_target::npc_nightbane_helper_target(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unit(), spell_chapter5_light_of_dawn_aura::OnApply(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), spell_q12779_an_end_to_all_things_devour_aura::OnRemove(), spell_chapter5_light_of_dawn_aura::OnRemove(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_jeklik::PathEndReached(), boss_nefarian::PathEndReached(), SmartScript::ProcessAction(), boss_nefarian::Reset(), boss_kalecgos::Reset(), npc_akilzon_eagle::Reset(), boss_jeklik::Reset(), npc_soh_fire_trigger::Reset(), npc_hallows_end_soh::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_ayamiss::Reset(), boss_jedoga_shadowseeker::Reset(), boss_sartharion_dragonAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), npc_spinestalker::npc_spinestalkerAI::Reset(), npc_rimefang::npc_rimefangAI::Reset(), npc_icc_spire_frostwyrm::Reset(), boss_malygos::Reset(), boss_stormcaller_brundir::Reset(), boss_kologarn::Reset(), npc_ulduar_aerial_command_unit::Reset(), boss_thorim_pillar::Reset(), boss_yoggsaron_sara::Reset(), boss_svala::boss_svalaAI::Reset(), boss_illidan_stormrage::Reset(), boss_nazan::Reset(), boss_kaelthas::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), boss_felmyst::ScheduleGroundAbilities(), npc_ulduar_aerial_command_unit::SetData(), instance_halls_of_reflection::SetData(), Creature::setDeathState(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_highborne_lamenter::npc_highborne_lamenterAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_onyxia::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_mimiron::UpdateAI(), boss_razorscale::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetDisplayId()

void Unit::SetDisplayId ( uint32  modelId,
std::optional< float >  displayScale = {} 
)
virtual

Reimplemented in Pet.

12854{
12856
12857 // Set Gender by modelId
12858 if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId))
12859 SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
12860
12861 _displayScale = displayScale;
12863
12864 sScriptMgr->OnDisplayIdChange(this, modelId);
12865}
virtual void RecalculateObjectScale()
Definition Unit.cpp:12845
Definition CreatureData.h:389

References _displayScale, RecalculateObjectScale(), Object::SetByteValue(), SetUInt32Value(), sObjectMgr, sScriptMgr, UNIT_FIELD_BYTES_0, and UNIT_FIELD_DISPLAYID.

Referenced by npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Creature::Create(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DeMorph(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_shattrath_daily_quest::DoAction(), npc_blade_of_azzinoth::DoAction(), boss_ichoron::DoExplodeCompleted(), SACDeactivateEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), AuraEffect::HandleAuraCloneCaster(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_tharon_ja_dummy_aura::HandleEffectApply(), spell_gen_model_visible::HandleEffectApply(), spell_gen_model_visible::HandleEffectRemove(), modify_commandscript::HandleMorphTargetCommand(), npc_commandscript::HandleNpcSetModelCommand(), spell_naked_caravan_guard_transform::HandleScriptEffect(), wp_commandscript::HandleWpShowCommand(), Player::InitDisplayIds(), Creature::InitEntry(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), Totem::InitStats(), Guardian::InitStatsForLevel(), npc_eoe_wyrmrest_skytalon::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_ichoron::JustDied(), npc_scholomance_occultist::npc_scholomance_occultistAI::JustReachedHome(), npc_cw_area_trigger::npc_cw_area_triggerAI::npc_cw_area_triggerAI(), npc_grizzlemaw_cw_trigger::npc_grizzlemaw_cw_triggerAI::npc_grizzlemaw_cw_triggerAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::npc_pos_collapsing_icicleAI(), npc_the_biggest_tree::npc_the_biggest_tree(), spell_gen_aura_service_uniform::OnApply(), spell_alar_dive_bomb::OnApply(), npc_eoe_wyrmrest_skytalon::PassengerBoarded(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_black_knight::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_yoggsaron_sara::Reset(), boss_ingvar_the_plunderer::Reset(), boss_ichoron::Reset(), boss_laj::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), Creature::Respawn(), RestoreDisplayId(), boss_laj::ScheduleTasks(), Creature::SetDisplayFromModel(), Pet::SetDisplayId(), Player::SetIsSpectator(), npc_netherspite_infernal::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), boss_black_knight::SpellHitTarget(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), npc_vaelastrasz_the_red::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), npc_ulduar_icicle::UpdateAI(), npc_ulduar_mimiron_rocket::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), boss_ichoron::UpdateAI(), and npc_azure_saboteur::UpdateAI().

◆ SetDualWieldMode()

virtual void Unit::SetDualWieldMode ( DualWieldMode  mode)
inlinevirtual
994{ _dualWieldMode = mode; }

References _dualWieldMode.

Referenced by Creature::InitEntry(), and Creature::UpdateEntry().

◆ SetEmoteState()

◆ SetExtraUnitMovementFlags()

void Unit::SetExtraUnitMovementFlags ( uint16  f)
inline

◆ SetFacingTo()

void Unit::SetFacingTo ( float  ori)
16186{
16187 Movement::MoveSplineInit init(this);
16188 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
16190 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
16191 init.SetFacing(ori);
16192 init.Launch();
16193}
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:780
ObjectGuid GetTransGUID() const override
Definition Unit.cpp:14734

References Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTransGUID(), HasUnitMovementFlag(), Movement::MoveSplineInit::Launch(), MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_twinemperorsAI::DoAction(), brann_bronzebeard::DoAction(), npc_arthas::npc_arthasAI::DoAction(), WaypointMovementGenerator< Creature >::DoUpdate(), FormationMovementGenerator::DoUpdate(), Spell::EffectDistract(), UtherBatteredHiltEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), FaceBarrageArc(), DistractMovementGenerator::Finalize(), Creature::FocusTarget(), spell_item_unusual_compass::HandleDummy(), spell_wailing_souls_periodic_aura::HandlePeriodicTick(), spell_drakkari_colossus_face_me::HandleScriptEffect(), boss_grand_warlock_nethekurse::IntroRP(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), boss_ragnaros::JustDied(), npc_rocknot::JustReachedHome(), boss_ingvar_the_plunderer::JustSummoned(), boss_nalorakk::MoveInLineOfSight(), boss_algalon_the_observer::MovementInform(), npc_brann_bronzebeard_algalon::MovementInform(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), boss_onyxia::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_eadric::MovementInform(), boss_paletress::MovementInform(), boss_grand_champion::MovementInform(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::MovementInform(), npc_saurfang_event::npc_saurfang_eventAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), brann_bronzebeard::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_razorscale::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), spell_lurker_below_spout::OnPeriodic(), npc_phalanx::PathEndReached(), SmartAI::PausePath(), SmartScript::ProcessAction(), npc_mistress_nagmara::ReachLoversStop(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_illidan_stormrage::ScheduleAbilities(), boss_nightbane::ScheduleFly(), Player::SetClientControl(), boss_grand_warlock_nethekurse::SetData(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::SetSaurfangCampWorkerWorking(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_chesspiece::SpellHitTarget(), boss_heigan::StartFightPhase(), boss_netherspite::SwitchToBanishPhase(), CreatureAI::TriggerAlert(), RotateMovementGenerator::Update(), boss_rend_blackhand::UpdateAI(), boss_victor_nefarius::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), boss_onyxia::UpdateAI(), npc_hadronox_crusherPackAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_brann_bronzebeard_algalon::UpdateAI(), boss_razorscale::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_rocknot::UpdateEscortAI(), npc_general_andorov::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_argent_soldier::WaypointReached(), npc_black_knight_skeletal_gryphon::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetFacingToObject()

void Unit::SetFacingToObject ( WorldObject *  object,
Milliseconds  timed = 0ms 
)
Todo:
figure out under what conditions creature will move towards object instead of facing it where it currently is.
16196{
16197 // never face when already moving
16198 if (!IsStopped())
16199 return;
16200
16202 Movement::MoveSplineInit init(this);
16203 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
16204 init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
16205 init.Launch();
16206
16207 if (timed > 0ms)
16208 {
16209 if (Creature* c = ToCreature())
16210 {
16211 c->m_Events.AddEventAtOffset([c]()
16212 {
16213 if (c->IsInWorld() && c->FindMap() && c->IsAlive() && !c->IsInCombat())
16214 c->SetFacingTo(c->GetHomePosition().GetOrientation());
16215 }, timed);
16216 }
16217 else
16218 LOG_ERROR("entities.unit", "Unit::SetFacingToObject called on non-creature unit {}. This should never happen.", GetEntry());
16219 }
16220}
bool IsStopped() const
Definition Unit.h:1778

References Position::GetAngle(), Object::GetEntry(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsStopped(), Movement::MoveSplineInit::Launch(), LOG_ERROR, Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and Object::ToCreature().

Referenced by npc_mistress_nagmara::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), npc_forest_frog::DoSpawnRandom(), Spell::EffectSummonType(), npc_mistress_nagmara::GreetRocknot(), spell_chapter5_return_to_capital::HandleHit(), spell_yogg_saron_target_selectors::HandleScript(), npc_vaelastrasz_the_red::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_freya::JustEngagedWith(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), npc_overlord_drakuru_betrayal::JustSummoned(), boss_illidan_stormrage::JustSummoned(), npc_acherus_necromancer::MovementInform(), npc_gothik_the_harvester::MovementInform(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), npc_akama_illidan::MovementInform(), npc_hor_lich_king::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_nightbane::ScheduleFly(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), boss_the_lurker_below::SchedulerPhaseOne(), boss_shade_of_aran::SetGUID(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::SetGUID(), npc_harrison_jones::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_ulduar_vx001::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_devourer_of_souls::SpellHitTarget(), boss_hydross_the_unstable::SummonMovementInform(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), npc_rookery_hatcher::UpdateAI(), boss_victor_nefarius::UpdateAI(), boss_majordomo::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer::UpdateAI(), npc_acherus_necromancer::UpdateAI(), npc_gothik_the_harvester::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_pilgrims_bounty_chair::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_bronjahm::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::UpdateAI(), npc_ulduar_vx001::UpdateAI(), npc_expedition_engineer::UpdateAI(), npc_hidden_cultist::npc_hidden_cultistAI::UpdateAI(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached().

◆ SetFaction()

void Unit::SetFaction ( uint32  faction)
6904{
6906 if (IsCreature())
6908}
void UpdateMoveInLineOfSightState()
Definition Creature.cpp:2663

References Object::IsCreature(), SetUInt32Value(), Object::ToCreature(), UNIT_FIELD_FACTIONTEMPLATE, and Creature::UpdateMoveInLineOfSightState().

Referenced by npc_phalanx::Activate(), npc_hidden_cultist::npc_hidden_cultistAI::AttackPlayer(), boss_eadric::DamageTaken(), boss_algalon_the_observer::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_paletress::DamageTaken(), boss_yoggsaron_sara::DamageTaken(), boss_thorim::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_kalecgos::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), Spell::EffectSummonType(), npc_overlord_drakuru_betrayal::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), AuraEffect::HandleAuraModFaction(), BattlegroundIC::HandleCapturedNodes(), spell_q12096_q12092_dummy::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), spell_mutate_explode_bug::HandleOnHit(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_item_draenic_pale_ale::HandleSummon(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), boss_vaelastrasz::Initialize(), boss_majordomo::InitializeAI(), npc_general_andorov::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), Minion::InitStats(), TempSummon::InitStats(), InitTamedPet(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), FollowerAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_volkhan::JustSummoned(), boss_balinda::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), Pet::LoadPetFromDB(), boss_twilight_corrupter::MoveInLineOfSight(), npc_akama_shade::MovementInform(), BattlegroundAB::NodeOccupied(), npc_chesspiece::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::OnCreatureCreate(), instance_eye_of_eternity::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_oculus::instance_oculus_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), boss_azuregos::OnGossipSelect(), InstanceScript::OnPlayerEnter(), npc_prospector_remtravel::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_frosthound::PassengerBoarded(), BattlegroundAV::PopulateNode(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), RemoveCharmedBy(), boss_doomrel::Reset(), boss_victor_nefarius::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_coren_direbrew::Reset(), npc_direbrew_minion::Reset(), npc_aquementas::npc_aquementasAI::Reset(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset(), boss_algalon_the_observer::Reset(), boss_yoggsaron_sara::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), RestoreFaction(), SetCharmedBy(), Player::SetFactionForRace(), Player::SetGameMaster(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), BattlegroundIC::SetupBattleground(), boss_victor_nefarius::sGossipSelect(), Battlefield::SpawnCreature(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), FollowerAI::StartFollow(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Submit(), npc_deathstalker_fearleia::SummonCreatureWithRandomTarget(), boss_majordomo::SummonedCreatureDies(), Spell::SummonGuardian(), Player::SummonPet(), WorldObject::SummonTrigger(), npc_vaelastrasz_the_red::UpdateAI(), boss_vaelastrasz::UpdateAI(), npc_madrigosa::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_mimiron::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), Creature::UpdateEntry(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ SetFeared()

void Unit::SetFeared ( bool  apply,
Unit *  fearedBy = nullptr,
bool  isFear = false 
)
protected
14245{
14246 if (apply)
14247 {
14248 SetTarget();
14249 GetMotionMaster()->MoveFleeing(fearedBy, isFear ? 0 : sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
14250 }
14251 else
14252 {
14253 if (IsAlive())
14254 {
14255 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE)
14256 {
14258 StopMoving();
14259 }
14260
14261 if (GetVictim())
14263 }
14264 }
14265
14266 // xinef: block / allow control to real mover (eg. charmer)
14267 if (IsPlayer())
14268 {
14269 if (m_movedByPlayer)
14270 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
14271 //else
14272 // ToPlayer()->SetClientControl(this, !apply);
14273
14274 if (!apply)
14276 }
14277}
@ FLEEING_MOTION_TYPE
Definition MotionMaster.h:49
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition WorldConfig.h:243
void MoveFleeing(Unit *enemy, uint32 time=0)
Enable the target's fleeing movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:901

References CONFIG_CREATURE_FAMILY_FLEE_DELAY, FLEEING_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), MotionMaster::GetMotionSlotType(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFleeing(), MotionMaster::MovementExpired(), Player::ResyncCanFlyToClient(), Player::SetClientControl(), SetTarget(), StopMoving(), sWorld, and Object::ToPlayer().

Referenced by SetControlled().

◆ SetFeatherFall()

void Unit::SetFeatherFall ( bool  enable)
16342{
16343 bool isClientControlled = IsClientControlled();
16344
16345 if (!isClientControlled)
16346 {
16347 if (enable)
16349 else
16351 }
16352
16353 if (!IsInWorld()) // is sent on add to map
16354 return;
16355
16356 if (isClientControlled)
16357 {
16358 if (Player const* player = GetClientControlling())
16359 {
16360 uint32 const counter = player->GetSession()->GetOrderCounter();
16361
16363
16364 data << GetPackGUID();
16365 data << counter;
16366 player->SendDirectMessage(&data);
16367 player->GetSession()->IncrementOrderCounter();
16368
16369 // start fall from current height
16370 if (!enable)
16371 const_cast<Player*>(player)->SetFallInformation(0, GetPositionZ());
16372
16373 return;
16374 }
16375 }
16376
16378 data << GetPackGUID();
16379 SendMessageToSet(&data, true);
16380}
@ MOVEMENTFLAG_FALLING_SLOW
Definition UnitDefines.h:401
@ SMSG_MOVE_FEATHER_FALL
Definition Opcodes.h:272
@ SMSG_MOVE_NORMAL_FALL
Definition Opcodes.h:273
@ SMSG_SPLINE_MOVE_NORMAL_FALL
Definition Opcodes.h:804

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), Position::GetPositionZ(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_FALLING_SLOW, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_FEATHER_FALL, SMSG_MOVE_NORMAL_FALL, SMSG_SPLINE_MOVE_FEATHER_FALL, and SMSG_SPLINE_MOVE_NORMAL_FALL.

Referenced by AuraEffect::HandleAuraFeatherFall(), and debug_commandscript::HandleDebugMoveflagsCommand().

◆ SetFullHealth()

◆ SetHealth()

void Unit::SetHealth ( uint32  val)
12037{
12039 val = 0;
12040 else if (IsPlayer() && getDeathState() == DeathState::Dead)
12041 val = 1;
12042 else
12043 {
12044 uint32 maxHealth = GetMaxHealth();
12045 if (maxHealth < val)
12046 val = maxHealth;
12047 }
12048
12049 float prevHealthPct = GetHealthPct();
12050
12052
12053 // mobs that are now or were below 30% need to update their speed
12054 if (IsCreature() && !(IsPet() && ToPet()->isControlled() && IsControlledByPlayer()) && (prevHealthPct < 30.0 || HealthBelowPct(30)))
12055 {
12056 UpdateSpeed(MOVE_RUN, false);
12057 }
12058
12059 // group update
12060 if (IsPlayer())
12061 {
12062 Player* player = ToPlayer();
12063 if (player->NeedSendSpectatorData())
12065
12066 if (player->GetGroup())
12068 }
12069 else if (Pet* pet = ToCreature()->ToPet())
12070 {
12071 if (pet->isControlled())
12072 {
12073 if (Unit* owner = GetOwner())
12074 if (Player* player = owner->ToPlayer())
12075 {
12076 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
12077 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
12078
12079 if (player->GetGroup())
12081 }
12082 }
12083 }
12084}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition Group.h:102
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition Group.h:114
bool NeedSendSpectatorData() const
Definition Player.cpp:15957
void SetGroupUpdateFlag(uint32 flag)
Definition Player.h:2520
float GetHealthPct() const
Definition Unit.h:1124
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1130
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, char const *prefix, uint32 t)
Definition ArenaSpectator.h:62

References Dead, WorldObject::FindMap(), getDeathState(), Player::GetGroup(), Object::GetGUID(), GetHealthPct(), GetMaxHealth(), GetOwner(), GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_HP, HealthBelowPct(), IsControlledByPlayer(), Object::IsCreature(), IsPet(), Object::IsPlayer(), JustDied, MOVE_RUN, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_HEALTH, and UpdateSpeed().

Referenced by Battleground::AddPlayer(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), Player::BuildPlayerRepop(), boss_black_knight::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::DamageTaken(), boss_thorim::DamageTaken(), DealDamage(), boss_grand_champion::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::DoAction(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_oculus_soar_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyHPCommand(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcSetLevelCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), npc_echo_of_medivh::HandlePieceJustDied(), spell_stinky_precious_decimate::HandleScript(), spell_ahune_synch_health::HandleScript(), AuraEffect::HandleSpiritOfRedemption(), npc_pet_pri_lightwell::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustReachedHome(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), npc_snobold_vassal::npc_snobold_vassalAI::LoseCarrier(), ModifyHealth(), boss_grand_champion::MovementInform(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_corrupted_totem::npc_corrupted_totem(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), Player::ProcessDelayedOperations(), boss_vaelastrasz::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetAllPowers(), boss_prince_valanar_icc::boss_prince_valanarAI::ResetPrince(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), boss_yoggsaron::SetData(), setDeathState(), SetFullHealth(), SetMaxHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_hor_lich_king::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_flame_leviathan_defense_turret::UpdateAI(), and Creature::UpdateEntry().

◆ SetHover()

void Unit::SetHover ( bool  enable)
16383{
16384 bool isClientControlled = IsClientControlled();
16385
16386 if (!isClientControlled)
16387 {
16388 if (enable)
16390 else
16392 }
16393
16394 float hoverHeight = GetHoverHeight();
16395
16396 if (enable)
16397 {
16398 if (hoverHeight && GetPositionZ() - GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()) < hoverHeight)
16399 Relocate(GetPositionX(), GetPositionY(), GetPositionZ() + hoverHeight);
16400 }
16401 else
16402 {
16403 if (IsAlive() || !IsUnit())
16404 {
16405 float newZ = std::max<float>(GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ()), GetPositionZ() - hoverHeight);
16408 }
16409 }
16410
16411 if (!IsInWorld()) // is sent on add to map
16412 return;
16413
16414 if (isClientControlled)
16415 {
16416 if (Player const* player = GetClientControlling())
16417 {
16419
16420 uint32 const counter = player->GetSession()->GetOrderCounter();
16421
16422 data << GetPackGUID();
16423 data << counter;
16424 player->SendDirectMessage(&data);
16425 player->GetSession()->IncrementOrderCounter();
16426 return;
16427 }
16428 }
16429
16431 data << GetPackGUID();
16432 SendMessageToSet(&data, true);
16433}
bool IsUnit() const
Definition Object.h:215
float GetHoverHeight() const
Definition Unit.h:1737
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition Object.cpp:1619
@ SMSG_MOVE_SET_HOVER
Definition Opcodes.h:274
@ SMSG_SPLINE_MOVE_UNSET_HOVER
Definition Opcodes.h:806
@ SMSG_MOVE_UNSET_HOVER
Definition Opcodes.h:275

References MovementInfo::AddMovementFlag(), GetClientControlling(), GetHoverHeight(), WorldObject::GetMap(), Object::GetPackGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsAlive(), IsClientControlled(), Object::IsInWorld(), Object::IsUnit(), WorldObject::m_movementInfo, MOVEMENTFLAG_HOVER, Position::Relocate(), MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_SET_HOVER, SMSG_MOVE_UNSET_HOVER, SMSG_SPLINE_MOVE_SET_HOVER, SMSG_SPLINE_MOVE_UNSET_HOVER, and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_taldaram::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_ulduar_aerial_command_unit::DoAction(), boss_illidan_stormrage::DoAction(), AuraEffect::HandleAuraHover(), debug_commandscript::HandleDebugMoveflagsCommand(), boss_sartharion_dragonAI::HandleExtraEvent(), boss_taldaram::InitializeAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_saviana_ragefire::boss_saviana_ragefireAI::JustReachedHome(), boss_taldaram::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_sartharion_dragonAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_korkron_or_wildhammer::npc_korkron_or_wildhammer(), boss_jedoga_shadowseeker::Reset(), boss_sartharion_dragonAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::Reset(), npc_ulduar_aerial_command_unit::Reset(), boss_svala::boss_svalaAI::Reset(), boss_illidan_stormrage::Reset(), npc_ulduar_aerial_command_unit::SetData(), setDeathState(), Creature::setDeathState(), boss_jedoga_shadowseeker::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), npc_auriaya_feral_defender::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), and Creature::UpdateMovementFlags().

◆ SetImmuneToAll()

void Unit::SetImmuneToAll ( bool  apply,
bool  keepCombat = false 
)
inline
938{ SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); }
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:10460

References SetImmuneToNPC(), and SetImmuneToPC().

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::ArmHiddenState(), boss_chromaggus::boss_chromaggus(), boss_nalorakk::boss_nalorakk(), boss_eadric::DamageTaken(), boss_grand_champion::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_paletress::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_grand_champion::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), npc_living_constellation::DoAction(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_felblood_kaelthas::DoAction(), boss_anubarak_trial::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonType(), npc_ghostly_priest::EnterEvadeMode(), npc_phantom_mage::EnterEvadeMode(), npc_shadowy_mercenary::EnterEvadeMode(), npc_spectral_footman::EnterEvadeMode(), npc_tortured_rifleman::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), spell_uldaman_stoned_aura::HandleEffectApply(), spell_uldaman_stoned_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_item_draenic_pale_ale::HandleSummon(), boss_majordomo::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_taldaram::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), Player::InitStatsForLevel(), npc_plague_cauldron_ghoul::IsSummonedBy(), boss_moroes::JustEngagedWith(), boss_falric::JustEngagedWith(), boss_marwyn::JustEngagedWith(), npc_rinji::npc_rinjiAI::JustRespawned(), npc_highlord_darion_mograine::JustRespawned(), npc_isla_starmane::npc_isla_starmaneAI::JustRespawned(), npc_highlord_darion_mograine::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_plague_cauldron_ghoul::Land(), npc_dkc1_gothik::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), boss_captain_skarloc::MovementInform(), boss_taldaram::MovementInform(), boss_grand_champion::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_memory::npc_memory(), npc_rinji::npc_rinjiAI::npc_rinjiAI(), instance_zulaman::instance_zulaman_InstanceMapScript::OnCreatureCreate(), npc_blackhand_incarcerator::Reset(), boss_rend_blackhand::Reset(), boss_ragnaros::Reset(), boss_moroes::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_skeram::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::Reset(), npc_black_knight_skeletal_gryphon::Reset(), boss_grand_champion::Reset(), boss_falric::Reset(), boss_marwyn::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), brann_bronzebeard::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ambassador_hellmaw::Reset(), boss_broggok::Reset(), boss_grand_warlock_nethekurse::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_grand_champion::ScheduleFindNewMount(), boss_svala::boss_svalaAI::SetData(), npc_blackhand_incarcerator::SetData(), boss_chromaggus::SetGUID(), boss_black_knight::SpellHitTarget(), npc_rinji::npc_rinjiAI::sQuestAccept(), boss_majordomo::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_ragnaros::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_skeram::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_anzu::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ SetImmuneToNPC()

void Unit::SetImmuneToNPC ( bool  apply,
bool  keepCombat = false 
)
10461{
10462 if (apply)
10463 {
10465 if (!keepCombat)
10466 {
10467 std::vector<CombatReference*> toEnd;
10468 for (auto const& pair : m_combatManager.GetPvECombatRefs())
10469 if (!pair.second->GetOther(this)->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10470 toEnd.push_back(pair.second);
10471 for (CombatReference* ref : toEnd)
10472 ref->EndCombat();
10473 }
10474 }
10475 else
10477}
Definition CombatManager.h:66

References CombatManager::GetPvECombatRefs(), m_combatManager, RemoveUnitFlag(), SetUnitFlag(), UNIT_FLAG_IMMUNE_TO_NPC, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), violet_hold_trashAI::CreatureStartAttackDoor(), violet_hold_trashAI::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), npc_general_andorov::InitializeAI(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_sartharion::JustEngagedWith(), boss_algalon_the_observer::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), npc_rocknot::JustReachedHome(), npc_rocknot::JustRespawned(), boss_sartharion_dragonAI::MovementInform(), npc_hover_disk::PassengerBoarded(), npc_corporal_keeshan::npc_corporal_keeshanAI::Reset(), npc_medivh_bm::Reset(), boss_sartharion_dragonAI::Reset(), SetImmuneToAll(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_escortAI::Start(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), npc_vaelastrasz_the_red::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), and npc_general_andorov::WaypointReached().

◆ SetImmuneToPC()

void Unit::SetImmuneToPC ( bool  apply,
bool  keepCombat = false 
)
10440{
10441 if (apply)
10442 {
10444 if (!keepCombat)
10445 {
10446 std::vector<CombatReference*> toEnd;
10447 for (auto const& pair : m_combatManager.GetPvECombatRefs())
10448 if (pair.second->GetOther(this)->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10449 toEnd.push_back(pair.second);
10450 for (auto const& pair : m_combatManager.GetPvPCombatRefs())
10451 toEnd.push_back(pair.second);
10452 for (CombatReference* ref : toEnd)
10453 ref->EndCombat();
10454 }
10455 }
10456 else
10458}

References CombatManager::GetPvECombatRefs(), CombatManager::GetPvPCombatRefs(), m_combatManager, RemoveUnitFlag(), SetUnitFlag(), UNIT_FLAG_IMMUNE_TO_PC, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by boss_victor_nefarius::BeginEvent(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), ClearInCombat(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), boss_falric::DoAction(), boss_marwyn::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::DoAction(), boss_razorscale::DoAction(), npc_frozen_core::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_tenris_mirkblood::EnterEvadeMode(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectRemove(), spell_chapter2_persuasive_strike::HandleHit(), boss_felmyst::InitializeAI(), boss_blackheart_the_inciter::JustEngagedWith(), boss_razorscale::JustEngagedWith(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_omen::npc_omenAI::npc_omenAI(), instance_blackrock_depths::OnCreatureCreate(), npc_kaya_flathoof::OnQuestAccept(), npc_ulduar_snow_mound::PassengerBoarded(), boss_doomrel::Reset(), boss_pyroguard_emberseer::Reset(), boss_tenris_mirkblood::Reset(), boss_julianne::Reset(), npc_coren_direbrew::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_algalon_the_observer::Reset(), boss_razorscale::Reset(), boss_skadi::boss_skadiAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_wild_wyrm::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_blackheart_the_inciter::Reset(), boss_magtheridon::Reset(), boss_magtheridon::ScheduleCombatEvents(), npc_ulduar_aerial_command_unit::SetData(), SetImmuneToAll(), boss_victor_nefarius::sGossipSelect(), npc_expedition_commander::sGossipSelect(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_overlord_drakuru_betrayal::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_wild_wyrm::SpellHit(), boss_felmyst::StartIntro(), instance_ulduar::instance_ulduar_InstanceMapScript::Update(), boss_pyroguard_emberseer::UpdateAI(), go_blood_drenched_door::go_blood_drenched_doorAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), and npc_overlord_drakuru_betrayal::UpdateAI().

◆ SetInCombatWith()

◆ SetInFront()

◆ SetInPreDeathAuraTick()

void Unit::SetInPreDeathAuraTick ( bool  value)
inline
1810{ m_inPreDeathAuraTick = value; }

References m_inPreDeathAuraTick.

◆ SetInstantCast()

void Unit::SetInstantCast ( bool  set)
inline
1603{ _instantCast = set; }

References _instantCast.

Referenced by AuraEffect::HandleModCastingSpeed().

◆ SetIsCombatDisallowed()

◆ SetLastDamagedTargetGuid()

void Unit::SetLastDamagedTargetGuid ( ObjectGuid const &  guid)
inline

◆ SetLastExtraAttackSpell()

void Unit::SetLastExtraAttackSpell ( uint32  spellId)
inline
1023{ _lastExtraAttackSpell = spellId; }

References _lastExtraAttackSpell.

◆ SetLastManaUse()

void Unit::SetLastManaUse ( uint32  spellCastTime)
inline
1165{ m_lastManaUse = spellCastTime; }

References m_lastManaUse.

Referenced by Spell::TakePower().

◆ SetLevel()

void Unit::SetLevel ( uint8  lvl,
bool  showLevelChange = true 
)

◆ SetMaxHealth()

void Unit::SetMaxHealth ( uint32  val)
12087{
12088 if (!val)
12089 val = 1;
12090
12091 uint32 health = GetHealth();
12093
12094 // group update
12095 if (IsPlayer())
12096 {
12097 Player* player = ToPlayer();
12098 if (player->NeedSendSpectatorData())
12100
12101 if (player->GetGroup())
12103 }
12104 else if (Pet* pet = ToCreature()->ToPet())
12105 {
12106 if (pet->isControlled())
12107 {
12108 if (Unit* owner = GetOwner())
12109 if (Player* player = owner->ToPlayer())
12110 {
12111 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
12112 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
12113
12114 if (player->GetGroup())
12116 }
12117 }
12118 }
12119
12120 if (val < health)
12121 SetHealth(val);
12122}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition Group.h:103
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition Group.h:115

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetHealth(), GetOwner(), GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_HP, Object::IsPlayer(), Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetHealth(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXHEALTH.

Referenced by Spell::EffectSummonType(), modify_commandscript::HandleModifyHPCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_pet_hunter_snake_trap::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), Player::InitStatsForLevel(), boss_skeram::JustSummoned(), npc_corrupted_totem::npc_corrupted_totem(), Creature::SelectLevel(), Creature::UpdateMaxHealth(), Guardian::UpdateMaxHealth(), and Player::UpdateMaxHealth().

◆ SetMaxPower()

void Unit::SetMaxPower ( Powers  power,
uint32  val 
)
12176{
12177 uint32 cur_power = GetPower(power);
12178 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power, val);
12179
12180 // group update
12181 if (IsPlayer())
12182 {
12183 Player* player = ToPlayer();
12184 if (getPowerType() == power && player->NeedSendSpectatorData())
12185 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
12186
12187 if (player->GetGroup())
12189 }
12190 else if (Pet* pet = ToCreature()->ToPet())
12191 {
12192 if (pet->isControlled())
12193 {
12194 Unit* owner = GetOwner();
12195 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
12197 }
12198 }
12199
12200 if (val < cur_power)
12201 SetPower(power, val);
12202}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition Group.h:118
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition Group.h:106
void SetStatInt32Value(uint16 index, int32 value)
Definition Object.cpp:796

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetOwner(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_MAX_POWER, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetPower(), Object::SetStatInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::Create(), Pet::CreateBaseAtTamed(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), Creature::SelectLevel(), setPowerType(), TEST_F(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ SetMinion()

void Unit::SetMinion ( Minion *  minion,
bool  apply 
)
7620{
7621 LOG_DEBUG("entities.unit", "SetMinion {} for {}, apply {}", minion->GetEntry(), GetEntry(), apply);
7622
7623 if (apply)
7624 {
7625 if (minion->GetOwnerGUID())
7626 {
7627 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
7628 return;
7629 }
7630
7631 minion->SetOwnerGUID(GetGUID());
7632
7633 m_Controlled.insert(minion);
7634
7635 if (IsPlayer())
7636 {
7637 minion->m_ControlledByPlayer = true;
7639 }
7640
7641 // Can only have one pet. If a new one is summoned, dismiss the old one.
7642 if (minion->IsGuardianPet())
7643 {
7644 if (Guardian* oldPet = GetGuardianPet())
7645 {
7646 if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
7647 {
7648 // remove existing minion pet
7649 if (Pet* oldPetAsPet = oldPet->ToPet())
7650 {
7651 oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
7652 }
7653 else
7654 {
7655 oldPet->UnSummon();
7656 }
7657
7658 SetPetGUID(minion->GetGUID());
7660 }
7661 }
7662 else
7663 {
7664 SetPetGUID(minion->GetGUID());
7666 }
7667 }
7668
7670 {
7672 }
7673
7674 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
7675 {
7676 SetCritterGUID(minion->GetGUID());
7677 }
7678
7679 // PvP, FFAPvP
7681
7682 // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
7683 if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
7684 minion->setPowerType(POWER_ENERGY);
7685
7686 if (IsPlayer())
7687 {
7688 // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
7689 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
7690
7691 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
7692 ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
7693 }
7694 }
7695 else
7696 {
7697 if (minion->GetOwnerGUID() != GetGUID())
7698 {
7699 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
7700 return;
7701 }
7702
7703 m_Controlled.erase(minion);
7704
7705 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
7706 {
7707 if (GetCritterGUID() == minion->GetGUID())
7709 }
7710
7711 if (minion->IsGuardianPet())
7712 {
7713 if (GetPetGUID() == minion->GetGUID())
7715 }
7716 else if (minion->IsTotem())
7717 {
7718 // All summoned by totem minions must disappear when it is removed.
7719 if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
7720 {
7721 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
7722 {
7723 if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
7724 continue;
7725
7726 RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
7727 }
7728 }
7729 }
7730
7731 if (IsPlayer())
7732 {
7733 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
7734 // Remove infinity cooldown
7735 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
7736 ToPlayer()->SendCooldownEvent(spellInfo);
7737
7738 // xinef: clear spell book
7739 if (m_Controlled.empty())
7741 }
7742
7743 //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
7744 {
7746 {
7747 // Check if there is another minion
7748 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
7749 {
7750 // do not use this check, creature do not have charm guid
7751 //if (GetCharmGUID() == (*itr)->GetGUID())
7752 if (GetGUID() == (*itr)->GetCharmerGUID())
7753 continue;
7754
7755 //ASSERT((*itr)->GetOwnerGUID() == GetGUID());
7756 if ((*itr)->GetOwnerGUID() != GetGUID())
7757 {
7758 OutDebugInfo();
7759 (*itr)->OutDebugInfo();
7760 ABORT();
7761 }
7762 ASSERT((*itr)->IsCreature());
7763
7764 if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLLABLE_GUARDIAN))
7765 continue;
7766
7767 if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
7768 {
7769 // show another pet bar if there is no charm bar
7770 if (IsPlayer() && !GetCharmGUID())
7771 {
7772 if ((*itr)->IsPet())
7774 else
7776 }
7777 }
7778 break;
7779 }
7780 }
7781 }
7782 }
7783}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:46
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:794
@ SUMMON_TYPE_MINIPET
Definition SharedDefines.h:3532
bool IsGuardianPet() const
Definition TemporarySummon.cpp:395
bool IsPetGhoul() const
Definition TemporarySummon.h:95
void PetSpellInitialize()
Definition Player.cpp:9804
SummonPropertiesEntry const *const m_Properties
Definition TemporarySummon.h:74
uint32 GetSpell(uint8 slot=0) const
Definition Totem.h:59
void OutDebugInfo() const
Definition Unit.cpp:15887
ObjectGuid GetCritterGUID() const
Definition Unit.h:731
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:7507
void SetCritterGUID(ObjectGuid guid)
Definition Unit.h:730
void setPowerType(Powers power)
Definition Unit.cpp:6826
void RemoveAllMinionsByEntry(uint32 entry)
Definition Unit.cpp:7797
uint32 Type
Definition DBCStructure.h:1949

References ABORT, Object::AddGuidValue(), Player::AddSpellAndCategoryCooldowns(), ASSERT, Player::CharmSpellInitialize(), ObjectGuid::Empty, Object::GetByteValue(), GetCharmGUID(), GetCritterGUID(), Object::GetEntry(), GetGuardianPet(), Object::GetGUID(), Object::GetGUID(), GetOwnerGUID(), GetPetGUID(), Totem::GetSpell(), Object::GetUInt32Value(), HasUnitTypeMask(), SpellInfo::IsCooldownStartedOnEvent(), Minion::IsGuardianPet(), IsPet(), Minion::IsPetGhoul(), Object::IsPlayer(), IsTotem(), LOG_DEBUG, LOG_FATAL, m_Controlled, m_ControlledByPlayer, TempSummon::m_Properties, MAX_SPELL_EFFECTS, OutDebugInfo(), PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), POWER_ENERGY, RemoveAllMinionsByEntry(), Object::RemoveGuidValue(), Player::SendCooldownEvent(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCritterGUID(), SetMinionGUID(), SetOwnerGUID(), SetPetGUID(), setPowerType(), SetUnitFlag(), SPELL_EFFECT_SUMMON, sSpellMgr, SUMMON_TYPE_MINIPET, ToPet(), Object::ToPlayer(), ToTotem(), SummonPropertiesEntry::Type, UNIT_CREATED_BY_SPELL, UNIT_FIELD_BYTES_2, UNIT_FIELD_SUMMON, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_CONTROLLABLE_GUARDIAN.

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectTameCreature(), Pet::LoadPetFromDB(), Player::RemovePet(), and Player::SummonPet().

◆ SetMinionGUID()

void Unit::SetMinionGUID ( ObjectGuid  guid)
inline

◆ SetModelVisible()

◆ SetNativeDisplayId()

◆ SetNpcFlag()

void Unit::SetNpcFlag ( NPCFlags  flags)
inline
770{ SetFlag(UNIT_NPC_FLAGS, flags); }

References Object::SetFlag(), and UNIT_NPC_FLAGS.

Referenced by npc_rocknot::AbortLovePotionEvent(), Vehicle::AddPassenger(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_ulduar_arachnopod_destroyer::DamageTaken(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_vaelastrasz::Initialize(), boss_majordomo::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::InitializeAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::JustReachedHome(), npc_aeranas::npc_aeranasAI::JustReachedHome(), npc_chesspiece::MovementInform(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_pos_leader_second::npc_pos_leader_secondAI::MovementInform(), brann_bronzebeard::MovementInform(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::MovementInform(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::OnCreatureCreate(), brann_bronzebeard::PathEndReached(), npc_akama_illidan::PathEndReached(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), Vehicle::RemovePassenger(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_victor_nefarius::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_deathstalker_fearleia::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_hyjal_jaina::hyjalJainaAI::Reset(), npc_hyjal_thrall::hyjalThrallAI::Reset(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), brann_bronzebeard::Reset(), npc_expedition_commander::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), Vehicle::Reset(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData(), npc_mistress_nagmara::ResetLovePotionEvent(), NPCStaveQuestAI::ResetState(), Vehicle::SetBoardableByPlayers(), boss_majordomo::SpellHit(), npc_aged_dying_ancient_kodo::SpellHit(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), Vehicle::Vehicle(), npc_arthas::npc_arthasAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ SetOwnerGUID()

void Unit::SetOwnerGUID ( ObjectGuid  owner)
7508{
7509 if (GetOwnerGUID() == owner)
7510 return;
7511
7513 if (!owner)
7514 return;
7515
7516 m_applyResilience = !IsVehicle() && owner.IsPlayer();
7517
7518 // Update owner dependent fields
7519 Player* player = ObjectAccessor::GetPlayer(*this, owner);
7520 if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
7521 return;
7522
7524
7525 UpdateData udata;
7526 WorldPacket packet;
7527 BuildValuesUpdateBlockForPlayer(&udata, player);
7528 udata.BuildPacket(packet);
7529 player->SendDirectMessage(&packet);
7530
7532}
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:255
void RemoveFieldNotifyFlag(uint16 flag)
Definition Object.h:202
void SetFieldNotifyFlag(uint16 flag)
Definition Object.h:201
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11647
Definition UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Player::HaveAtClient(), ObjectGuid::IsPlayer(), IsVehicle(), m_applyResilience, Object::RemoveFieldNotifyFlag(), Player::SendDirectMessage(), Object::SetFieldNotifyFlag(), Object::SetGuidValue(), UF_FLAG_OWNER, and UNIT_FIELD_SUMMONEDBY.

Referenced by Spell::EffectSummonType(), boss_illidari_council_memberAI::EnterEvadeMode(), spell_item_draenic_pale_ale::HandleSummon(), npc_pet_gen_fetch_ball::IsSummonedBy(), boss_razorgore::JustSummoned(), Player::LoadFromDB(), SetMinion(), and npc_grimstone::UpdateEscortAI().

◆ SetPetGUID()

◆ SetPhaseMask()

void Unit::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

15028{
15029 if (newPhaseMask == GetPhaseMask())
15030 return;
15031
15032 if (IsInWorld())
15033 {
15034 // xinef: to comment, bellow line should be removed
15035 // pussywizard: goign to other phase (valithria, algalon) should not remove such auras
15036 //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
15037
15038 if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
15039 return;
15040 }
15041
15042 WorldObject::SetPhaseMask(newPhaseMask, false);
15043
15044 if (!IsInWorld())
15045 {
15046 return;
15047 }
15048
15049 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
15050 {
15051 Unit* controlled = *itr;
15052 ++itr;
15053 if (controlled->IsCreature())
15054 {
15055 controlled->SetPhaseMask(newPhaseMask, true);
15056 }
15057 }
15058
15059 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
15060 {
15061 if (m_SummonSlot[i])
15062 {
15063 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
15064 {
15065 summon->SetPhaseMask(newPhaseMask, true);
15066 }
15067 }
15068 }
15069
15070 if (update)
15071 {
15073 }
15074}
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:15027
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition Object.cpp:3006

References Map::GetCreature(), WorldObject::GetMap(), WorldObject::GetPhaseMask(), Object::IsCreature(), Object::IsInWorld(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, WorldObject::SetPhaseMask(), SetPhaseMask(), sScriptMgr, and UpdateObjectVisibility().

Referenced by Pet::Create(), Creature::Create(), misc_commandscript::HandleAppearCommand(), modify_commandscript::HandleModifyPhaseCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), spell_wintergrasp_hide_small_elementals_aura::HandlePeriodicDummy(), AuraEffect::HandlePhase(), spell_halion_damage_aoe_summon::HandleSummon(), Battlefield::HideNpc(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), boss_zuramat::JustSummoned(), boss_victor_nefarius::Reset(), boss_volazj::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), Creature::setDeathState(), Player::SetGameMaster(), TestCreature::SetPhase(), SetPhaseMask(), Battlefield::ShowNpc(), WorldObject::SummonTrigger(), and npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached().

◆ SetPower()

void Unit::SetPower ( Powers  power,
uint32  val,
bool  withPowerUpdate = true,
bool  fromRegenerate = false 
)
12125{
12126 if (!fromRegenerate && GetPower(power) == val)
12127 return;
12128
12129 uint32 maxPower = GetMaxPower(power);
12130 if (maxPower < val)
12131 val = maxPower;
12132
12133 if (fromRegenerate)
12134 {
12137 }
12138 else
12140
12141 if (withPowerUpdate)
12142 {
12143 WorldPacket data(SMSG_POWER_UPDATE, 8 + 1 + 4);
12144 data << GetPackGUID();
12145 data << uint8(power);
12146 data << uint32(val);
12147 SendMessageToSet(&data, IsPlayer());
12148 }
12149
12150 // group update
12151 if (IsPlayer())
12152 {
12153 Player* player = ToPlayer();
12154 if (getPowerType() == power && player->NeedSendSpectatorData())
12155 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
12156
12157 if (player->GetGroup())
12159 }
12160 else if (Pet* pet = ToCreature()->ToPet())
12161 {
12162 if (pet->isControlled())
12163 {
12164 Unit* owner = GetOwner();
12165 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
12167 }
12168
12169 // Update the pet's character sheet with happiness damage bonus
12170 if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
12171 pet->UpdateDamagePhysical(BASE_ATTACK);
12172 }
12173}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition Group.h:117
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition Group.h:105
void UpdateUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:661
void AddToObjectUpdateIfNeeded()
Definition Object.cpp:522
@ SMSG_POWER_UPDATE
Definition Opcodes.h:1182

References Object::AddToObjectUpdateIfNeeded(), AsUnderlyingType(), BASE_ATTACK, WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), Object::GetPackGUID(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_PET_CUR_POWER, HUNTER_PET, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_HAPPINESS, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), WorldObject::SendMessageToSet(), Player::SetGroupUpdateFlag(), Object::SetStatInt32Value(), SMSG_POWER_UPDATE, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_POWER1, and Object::UpdateUInt32Value().

Referenced by Player::ActivateSpec(), Player::Create(), Pet::CreateBaseAtTamed(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_dru_frenzied_regeneration::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), WorldSession::HandlePetAbandon(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Vehicle::Install(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), Player::ProcessDelayedOperations(), Player::Regenerate(), spell_igb_incinerating_blast::RemoveEnergy(), spell_igb_below_zero::RemovePassengers(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_selin_fireheart::Reset(), boss_moam::Reset(), npc_obsidian_destroyer::Reset(), npc_obsidian_eradicator::Reset(), npc_obsidian_nullifier::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetMaxPower(), setPowerType(), Player::SummonPet(), and npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI().

◆ setPowerType()

void Unit::setPowerType ( Powers  power)
6827{
6828 SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
6829
6830 if (IsPlayer())
6831 {
6832 if (ToPlayer()->GetGroup())
6834 }
6835 else if (Pet* pet = ToCreature()->ToPet())
6836 {
6837 if (pet->isControlled())
6838 {
6839 Unit* owner = GetOwner();
6840 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
6842 }
6843 }
6844
6845 float powerMultiplier = 1.0f;
6846 if (!IsPet())
6847 if (Creature* creature = ToCreature())
6848 powerMultiplier = creature->GetCreatureTemplate()->ModMana;
6849
6850 switch (new_powertype)
6851 {
6852 default:
6853 case POWER_MANA:
6854 break;
6855 case POWER_RAGE:
6856 SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
6857 SetPower(POWER_RAGE, 0);
6858 break;
6859 case POWER_FOCUS:
6860 SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
6861 SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
6862 break;
6863 case POWER_ENERGY:
6864 SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
6865 break;
6866 case POWER_HAPPINESS:
6867 SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
6868 SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
6869 break;
6870 }
6871
6872 if (Player const* player = ToPlayer())
6873 if (player->NeedSendSpectatorData())
6874 {
6875 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
6876 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype) / 10 : GetMaxPower(new_powertype));
6877 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype) / 10 : GetPower(new_powertype));
6878 }
6879}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition Group.h:104
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition Group.h:116
uint32 GetCreatePowers(Powers power) const
Definition Unit.cpp:12204
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:12175

References WorldObject::FindMap(), GetCreatePowers(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), GetPower(), GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POWER_TYPE, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Object::SetByteValue(), Player::SetGroupUpdateFlag(), SetMaxPower(), SetPower(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_BYTES_0.

Referenced by Pet::CreateBaseAtTamed(), AuraEffect::HandleAuraModShapeshift(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitDataForForm(), Vehicle::Install(), Pet::LoadPetFromDB(), npc_toc_rogue::npc_toc_rogueAI::npc_toc_rogueAI(), SetMinion(), and Player::SummonPet().

◆ SetPvP()

◆ setRace()

void Unit::setRace ( uint8  race)
16810{
16811 if (IsPlayer())
16812 m_race = race;
16813}

References Object::IsPlayer(), and m_race.

◆ SetResistance()

◆ SetRooted()

void Unit::SetRooted ( bool  apply,
bool  stun = false,
bool  logout = false 
)
protected
14166{
14167 const uint32 state = (stun ? (logout ? UNIT_STATE_LOGOUT_TIMER : UNIT_STATE_STUNNED) : UNIT_STATE_ROOT);
14168
14169 if (apply)
14170 {
14171 AddUnitState(state);
14172
14173 SendMoveRoot(true);
14174 }
14175 else
14176 {
14177 ClearUnitState(state);
14178
14179 // Prevent giving ability to move if more immobilizers are active
14180 if (!IsImmobilizedState())
14181 SendMoveRoot(false);
14182 }
14183}
@ UNIT_STATE_LOGOUT_TIMER
Definition UnitDefines.h:205
bool IsImmobilizedState() const
Definition Unit.h:791
void SendMoveRoot(bool state)
Definition Unit.cpp:14185

References AddUnitState(), ClearUnitState(), IsImmobilizedState(), SendMoveRoot(), UNIT_STATE_LOGOUT_TIMER, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandlePlayerLoginToCharInWorld(), SetControlled(), and SetStunned().

◆ SetShapeshiftForm()

void Unit::SetShapeshiftForm ( ShapeshiftForm  form)
17046{
17048 sScriptMgr->OnUnitSetShapeshiftForm((Unit*)this, form);
17049}

References Object::SetByteValue(), sScriptMgr, and UNIT_FIELD_BYTES_2.

Referenced by AuraEffect::HandleAuraModShapeshift(), and reset_commandscript::HandleResetStatsOrLevelHelper().

◆ SetSheath()

virtual void Unit::SetSheath ( SheathState  sheathed)
inlinevirtual

Reimplemented in Player.

1793{ SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); }

References Object::SetByteValue(), and UNIT_FIELD_BYTES_2.

Referenced by Pet::Create(), Pet::CreateBaseAtTamed(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_illidan_stormrage::DoAction(), Pet::LoadPetFromDB(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::MovementInform(), npc_saurfang_event::npc_saurfang_eventAI::MovementInform(), npc_akama_illidan::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), instance_halls_of_reflection::OnCreatureCreate(), SmartScript::ProcessAction(), npc_chesspiece::Reset(), npc_saurfang_event::npc_saurfang_eventAI::Reset(), boss_algalon_the_observer::Reset(), boss_hodir::Reset(), boss_illidan_stormrage::Reset(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreSaurfangEventNpc(), Player::SetSheath(), npc_akama_illidan::sGossipSelect(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_saurfang_event::npc_saurfang_eventAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), boss_lady_vashj::UpdateAI(), Creature::UpdateEntry(), and npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached().

◆ SetSpeed()

void Unit::SetSpeed ( UnitMoveType  mtype,
float  rate,
bool  forced = false 
)
11131{
11132 if (rate < 0)
11133 rate = 0.0f;
11134
11135 // Update speed only on change
11136 if (m_speed_rate[mtype] == rate)
11137 return;
11138
11139 m_speed_rate[mtype] = rate;
11140
11142
11143 SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[mtype];
11144
11145 if (forced && IsClientControlled())
11146 {
11147 SendSpeedToController(mtype, const_cast<Player*>(GetClientControlling()));
11148 }
11149 else if (forced)
11150 {
11151 WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::NPC)], 12);
11152 data << GetPackGUID();
11153 data << float(GetSpeed(mtype));
11154 SendMessageToSet(&data, true);
11155 }
11156
11157 if (IsPlayer())
11158 {
11159 // Xinef: update speed of pet also
11160 if (!IsInCombat())
11161 {
11162 Unit* pet = ToPlayer()->GetPet();
11163 if (!pet)
11164 pet = GetCharm();
11165
11166 // xinef: do not affect vehicles and possesed pets
11167 if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
11168 pet = nullptr;
11169
11170 if (pet && pet->IsCreature() && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
11171 pet->UpdateSpeed(mtype, forced);
11172
11173 if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID()))
11174 critter->UpdateSpeed(mtype, forced);
11175 }
11176 ToPlayer()->SetCanTeleport(true);
11177 }
11178}
@ FOLLOW_MOTION_TYPE
Definition MotionMaster.h:54
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:1088
void propagateSpeedChange()
Definition Unit.h:1761

References FOLLOW_MOTION_TYPE, GetCharm(), GetClientControlling(), GetCritterGUID(), MotionMaster::GetCurrentMovementGeneratorType(), GetMotionMaster(), Object::GetPackGUID(), Player::GetPet(), GetSpeed(), ObjectAccessor::GetUnit(), HasUnitFlag(), IsClientControlled(), Object::IsCreature(), IsInCombat(), Object::IsPlayer(), IsVehicle(), m_speed_rate, NPC, propagateSpeedChange(), WorldObject::SendMessageToSet(), SendSpeedToController(), Player::SetCanTeleport(), SetSpeed2Opc_table, Object::ToPlayer(), UNIT_FLAG_POSSESSED, and UpdateSpeed().

Referenced by Battleground::AddCreature(), boss_bug_trio::DoAction(), boss_grand_champion::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spark_of_ionar::DoAction(), npc_pet_dk_ebon_gargoyle::FlyAway(), boss_volkhan::GoToAnvil(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), boss_sartharion_dragonAI::HandleExtraEvent(), WorldSession::HandleForceSpeedChangeAck(), modify_commandscript::HandleModifyASpeedCommand(), modify_commandscript::HandleModifyMountCommand(), Creature::InitEntry(), boss_glob_of_viscidus::InitializeAI(), Guardian::InitStatsForLevel(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_sartharion_dragonAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_sartharion::JustSummoned(), boss_ichoron::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), boss_bug_trio::MovementInform(), boss_volkhan::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_akilzon_eagle::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_batrider::npc_batrider(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_toc5_player_vehicle::OnCharmed(), instance_halls_of_reflection::OnCreatureCreate(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), SmartScript::ProcessAction(), boss_nightbane::Reset(), npc_zuljin_vortex::Reset(), boss_headless_horseman::Reset(), boss_bug_trio::Reset(), boss_sartharion_dragonAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::Reset(), boss_thorim_sif_blizzard::Reset(), npc_freed_protodrake::npc_freed_protodrakeAI::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_eastvale_peasent::SetData(), Battlefield::SpawnCreature(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_akilzon_eagle::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), UpdateSpeed(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetSpeedRate()

◆ SetStandFlags()

◆ SetStandState()

void Unit::SetStandState ( uint8  state)
12818{
12820
12821 if (IsStandState())
12823
12824 if (IsPlayer())
12825 {
12827 data << (uint8)state;
12828 ToPlayer()->SendDirectMessage(&data);
12829 }
12830}
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition UnitDefines.h:26
bool IsStandState() const
Definition Unit.cpp:12802
@ SMSG_STANDSTATE_UPDATE
Definition Opcodes.h:699

References AURA_INTERRUPT_FLAG_NOT_SEATED, Object::IsPlayer(), IsStandState(), RemoveAurasWithInterruptFlags(), Player::SendDirectMessage(), Object::SetByteValue(), SMSG_STANDSTATE_UPDATE, Object::ToPlayer(), UNIT_BYTES_1_OFFSET_STAND_STATE, and UNIT_FIELD_BYTES_1.

Referenced by _ApplyAura(), spell_the_cleansing_cleansing_soul::AfterApply(), spell_the_cleansing_cleansing_soul::AfterRemove(), Creature::AtEngage(), boss_kologarn::boss_kologarn(), boss_twinemperorsAI::boss_twinemperorsAI(), boss_thekal::CheckPhaseTransition(), npc_ringo::npc_ringoAI::ClearFaint(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), boss_alar::DamageTaken(), boss_thekal::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_nightbane::DoAction(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_the_lurker_below::DoAction(), boss_leotheras_the_blind::DoAction(), npc_madrigosa::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), Spell::DoAllEffectOnTarget(), boss_ahune::Emerge(), UtherBatteredHiltEvent::Execute(), SuckBackEvent::Execute(), boss_ahune::ExecuteEvent(), boss_ingvar_the_plunderer::FeignDeath(), WorldSession::HandleAlterAppearance(), spell_gen_submerge_visual::HandleEffectApply(), spell_gen_submerge_visual::HandleEffectRemove(), WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStandStateChangeOpcode(), DistractMovementGenerator::Initialize(), boss_felmyst::InitializeAI(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_kalecgos::JustEngagedWith(), boss_palehoof::boss_palehoofAI::JustReachedHome(), npc_massive_jormungar::npc_massive_jormungarAI::JustReachedHome(), npc_ferocious_rhino::npc_ferocious_rhinoAI::JustReachedHome(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::JustReachedHome(), npc_frenzied_worgen::npc_frenzied_worgenAI::JustReachedHome(), npc_highlord_darion_mograine::JustRespawned(), boss_yoggsaron_brain::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), boss_kologarn::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_koltira_deathweaver::MovementInform(), npc_twilight_volunteer::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), npc_madrigosa::npc_madrigosa(), spell_love_is_in_the_air_romantic_picnic::OnApply(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_shade_of_aran::OnPowerUpdate(), npc_kernobee::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), spell_q12937_relief_for_the_fallen::OnRemove(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), Spell::prepare(), PretendToDie(), boss_alar::PretendToDie(), WorldSession::ProcessMovementInfo(), boss_victor_nefarius::Reset(), boss_vaelastrasz::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_kalecgos::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_thekal::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::Reset(), boss_illidan_stormrage::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreSaurfangEventNpc(), Resurrect(), npc_ringo::npc_ringoAI::SetFaint(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), npc_kerlonian::npc_kerlonianAI::SetSleeping(), SetStunned(), boss_victor_nefarius::sGossipSelect(), npc_harrison_jones::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), advisor_baseAI::SpellHit(), npc_koltira_deathweaver::StartEvent(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Submit(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), boss_vaelastrasz::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_algalon_the_observer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), GameObject::Use(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetStat()

void Unit::SetStat ( Stats  stat,
int32  val 
)
inline

◆ SetStatFlatModifier()

void Unit::SetStatFlatModifier ( UnitMods  unitMod,
UnitModifierFlatType  modifierType,
float  val 
)

◆ SetStatPctModifier()

◆ SetStunned()

void Unit::SetStunned ( bool  apply)
protected
14120{
14121 if (IsInFlight())
14122 return;
14123
14124 if (apply)
14125 {
14126 SetTarget();
14128
14129 if (IsPlayer())
14130 {
14132 }
14133
14134 SetRooted(true, true);
14135
14136 CastStop();
14137 }
14138 else
14139 {
14140 if (IsAlive() && GetVictim())
14142
14143 if (IsCreature())
14144 {
14145 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
14146 Unit* owner = GetOwner();
14147 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
14149
14150 // Xinef: same for charmed npcs
14151 owner = GetCharmer();
14152 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
14154 }
14155 else
14157
14158 if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
14159 {
14160 SetRooted(false, true);
14161 }
14162 }
14163}
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:35

References CastStop(), GetCharmer(), Object::GetGUID(), GetOwner(), GetVictim(), HasUnitState(), IsAlive(), Object::IsCreature(), IsInFlight(), IsMounted(), Object::IsPlayer(), RemoveUnitFlag(), SetRooted(), SetStandState(), SetTarget(), SetUnitFlag(), Object::ToPlayer(), UNIT_FLAG_STUNNED, UNIT_STAND_STATE_STAND, and UNIT_STATE_ROOT.

Referenced by SetControlled().

◆ SetSwim()

bool Unit::SetSwim ( bool  enable)
virtual

◆ SetTarget()

virtual void Unit::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
pure virtual

◆ setTransForm()

void Unit::setTransForm ( uint32  spellid)
inline
1989{ m_transform = spellid;}

References m_transform.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetUInt32Value()

void Unit::SetUInt32Value ( uint16  index,
uint32  value 
)
17107{
17108 Object::SetUInt32Value(index, value);
17109
17110 switch (index)
17111 {
17112 // Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
17113 // We might also need to invalidate the cache for some other fields as well.
17114 case UNIT_FIELD_HEALTH:
17116 break;
17117 }
17118}
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:648
void InvalidateValuesUpdateCache()
Definition Unit.h:2248

References InvalidateValuesUpdateCache(), Object::SetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_LoadDailyQuestStatus(), Player::_LoadSkills(), Player::AddItemToBuyBackSlot(), Attack(), npc_ulduar_leviathan_mkii::AttackStart(), Player::CheckAreaExploreAndOutdoor(), Spell::CheckItems(), Player::Create(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), boss_grand_champion::DamageTaken(), npc_ulduar_vx001::DamageTaken(), Dismount(), npc_harrison_jones::DoAction(), boss_thekal::DoAction(), npc_black_knight_skeletal_gryphon::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_pathaleon_the_calculator::DoAction(), boss_illidan_stormrage::DoAction(), Player::DuelComplete(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), boss_jindo::EnterEvadeMode(), boss_zuljin::EnterPhase(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraTransform(), character_commandscript::HandleCharacterLevel(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugUpdateCommand(), spell_dk_dancing_rune_weapon_visual::HandleEffectApply(), spell_gen_model_visible::HandleEffectApply(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_baby_murloc::HandleEffectRemove(), boss_ragnaros::HandleEmerge(), misc_commandscript::HandleHideAreaCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), npc_commandscript::HandleNpcPlayEmoteCommand(), WorldSession::HandlePetRename(), reset_commandscript::HandleResetHonorCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), WorldSession::HandleSetTitleOpcode(), WorldSession::HandleSetWatchedFactionOpcode(), misc_commandscript::HandleShowAreaCommand(), WorldSession::HandleTextEmoteOpcode(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), Player::InitGlyphsForLevel(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Initialize(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), InitTamedPet(), npc_toc5_grand_champion_minion::JustDied(), npc_dragonflayer_forge_master::JustEngagedWith(), boss_jindo::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Kill(), Creature::LoadCreaturesAddon(), Creature::LoadEquipment(), Player::LoadFromDB(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Player::ModifySkillBonus(), Mount(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_harrison_jones::MovementInform(), boss_grand_champion::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_tirion_fordring_tft::npc_tirion_fordringAI::MovementInform(), npc_akama_illidan::MovementInform(), npc_apothecary_genericAI::MovementInform(), spell_gen_clone_weapon_aura::OnApply(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), npc_ame::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), spell_gen_clone_weapon_aura::OnRemove(), npc_eastvale_peasent::PathEndReached(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), WorldSession::ProcessMovementInfo(), Player::RemoveAmmo(), Player::RemoveItemFromBuyBackSlot(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), ReplaceAllDynamicFlags(), ReplaceAllNpcFlags(), Player::ReplaceAllPlayerFlags(), ReplaceAllUnitFlags(), ReplaceAllUnitFlags2(), boss_ragnaros::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_zuljin::Reset(), boss_arlokk::boss_arlokkAI::Reset(), boss_grand_champion::Reset(), boss_malygos::Reset(), npc_ulduar_leviathan_mkii::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetDailyQuestStatus(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), Spell::SendChannelStart(), Spell::SendChannelUpdate(), Player::SetAmmo(), Player::SetArenaPoints(), Player::SetArenaTeamInfoField(), SetCharmedBy(), SetCreateHealth(), SetCreateMana(), Player::SetCurrentTitle(), Player::SetDailyQuestStatus(), npc_ulduar_leviathan_mkii::SetData(), npc_ulduar_vx001::SetData(), npc_eastvale_peasent::SetData(), setDeathState(), SetDisplayId(), SetEmoteState(), SetFaction(), TestCreature::SetFaction(), Player::SetFreePrimaryProfessions(), Player::SetFreeTalentPoints(), Player::SetGlyph(), Player::SetGlyphSlot(), SetHealth(), Player::SetHonorPoints(), Player::SetInGuild(), SetLevel(), SetMaxHealth(), Player::SetMoney(), SetNativeDisplayId(), CharmInfo::SetPetNumber(), Player::SetQuestSlot(), Player::SetQuestSlotTimer(), Player::SetRank(), Player::SetRestBonus(), Player::SetSkill(), SetVirtualItem(), Player::SetVisibleItemSlot(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), npc_expedition_engineer::StopRepairing(), Map::SummonCreature(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), Player::SummonPet(), Player::SwapQuestSlot(), TEST_F(), boss_ragnaros::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_highlord_darion_mograine::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::UpdateAI(), boss_mimiron::UpdateAI(), npc_expedition_engineer::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), Player::UpdateArmorPenetration(), Player::UpdateDuelFlag(), Player::UpdateExpertise(), Player::UpdateHonorFields(), Player::UpdateRating(), Player::UpdateShieldBlockValue(), Player::UpdateSkill(), Player::UpdateSkillPro(), Player::UpdateSkillsForLevel(), Player::UpdateSkillsToMaxSkillsForLevel(), npc_black_knight_skeletal_gryphon::WaypointReached(), and npc_ranger_lilatha::WaypointReached().

◆ SetUnitFlag()

void Unit::SetUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

754{ SetFlag(UNIT_FIELD_FLAGS, flags); }

References Object::SetFlag(), and UNIT_FIELD_FLAGS.

Referenced by BattlegroundAV::AddAVCreature(), Vehicle::AddPassenger(), Creature::AllLootRemovedFromCorpse(), npc_doctor::npc_doctorAI::BeginEvent(), boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), Player::Create(), PlayerCanFlyControlLossTest::CreateControlledPlayer(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_eadric::DamageTaken(), boss_black_knight::DamageTaken(), boss_grand_champion::DamageTaken(), npc_frost_sphere::DamageTaken(), boss_bronjahm::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_thaddius_summon::boss_thaddius_summonAI::DamageTaken(), boss_algalon_the_observer::DamageTaken(), npc_auriaya_feral_defender::DamageTaken(), boss_freya::DamageTaken(), boss_hodir::DamageTaken(), npc_ulduar_leviathan_mkii::DamageTaken(), npc_ulduar_vx001::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), advisor_baseAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_paletress::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_kiljaeden::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DisableRotate(), boss_thorim::DisableThorim(), npc_rocknot::DoAction(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_amanishi_lookout::DoAction(), boss_grand_champion::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_algalon_the_observer::DoAction(), npc_xt002_heart::DoAction(), npc_frozen_core::DoAction(), boss_kalecgos::DoAction(), boss_anubarak_trial::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), boss_yoggsaron::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_illidan_stormrage::DoAction(), PetAI::DoAttack(), boss_hodir::DoHelperVictoryEmotes(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::EnableSara(), boss_cyanigosa::EnterEvadeMode(), boss_erekem::EnterEvadeMode(), boss_ichoron::EnterEvadeMode(), boss_lavanthor::EnterEvadeMode(), boss_moragg::EnterEvadeMode(), boss_xevozz::EnterEvadeMode(), boss_zuramat::EnterEvadeMode(), boss_anubarak_trial::EnterEvadeMode(), boss_jaraxxus::EnterEvadeMode(), boss_gormok::boss_gormokAI::EnterEvadeMode(), boss_jormungarAI::EnterEvadeMode(), boss_icehowl::boss_icehowlAI::EnterEvadeMode(), npc_crystalline_frayer::EnterSeedPod(), SACDeactivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), PlayerCanFlyControlLossTest::ExpectRevokeReplayedAfter(), boss_ingvar_the_plunderer::FeignDeath(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_gen_model_visible::HandleEffectApply(), spell_gen_feign_death_all_flags::HandleEffectApply(), spell_gen_feign_death_no_dyn_flag::HandleEffectApply(), spell_gen_feign_death_no_prevent_emotes::HandleEffectApply(), boss_sartharion_dragonAI::HandleExtraEvent(), AuraEffect::HandleFeignDeath(), spell_chapter2_persuasive_strike::HandleHit(), BattlefieldWG::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleLogoutRequestOpcode(), spell_oculus_rider_aura::HandleOnEffectApply(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), boss_kiljaeden::InitializeAI(), npc_scarlet_ghoul::InitializeAI(), npc_general_andorov::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), Player::InitStatsForLevel(), boss_kologarn::JustDied(), boss_algalon_the_observer::JustEngagedWith(), boss_freya::JustEngagedWith(), boss_mimiron::JustEngagedWith(), boss_novos::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), advisor_baseAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_majordomo::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_vaelastrasz::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Mount(), npc_shattered_hand_scout::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_batrider::npc_batrider(), npc_blade_of_azzinoth::npc_blade_of_azzinoth(), npc_chess_move_trigger::npc_chess_move_trigger(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_memory::npc_memory(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), spell_halion_twilight_phasing_aura::OnApply(), npc_toc5_player_vehicle::OnCharmed(), instance_blackrock_depths::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), npc_nerubian_burrower::OnSpellCast(), boss_flame_leviathan_overload_device::OnSpellClick(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), Creature::RefreshSwimmingFlag(), boss_keristrasza::RemovePrison(), npc_grimstone::Reset(), npc_mistress_nagmara::Reset(), npc_rocknot::Reset(), boss_pyroguard_emberseer::Reset(), boss_rend_blackhand::Reset(), boss_nefarian::Reset(), boss_nightbane::Reset(), boss_kiljaeden::Reset(), npc_koltira_deathweaver::Reset(), npc_valkyr_battle_maiden::Reset(), npc_zuljin_vortex::Reset(), npc_hallows_end_soh::Reset(), npc_ancient_wisp::Reset(), boss_cthun::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_giant_spotlight::npc_giant_spotlightAI::Reset(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::Reset(), npc_black_knight_skeletal_gryphon::Reset(), npc_announcer_toc5::Reset(), boss_novos::Reset(), boss_tyrannus::boss_tyrannusAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_malygos::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_flame_leviathan::Reset(), npc_ulduar_iron_construct::Reset(), npc_ulduar_leviathan_mkii::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_massive_jormungar::npc_massive_jormungarAI::Reset(), npc_ferocious_rhino::npc_ferocious_rhinoAI::Reset(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::Reset(), npc_frenzied_worgen::npc_frenzied_worgenAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_shade_of_akama::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), boss_warlord_kalithresh::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::Reset(), boss_magtheridon::Reset(), boss_kaelthas::Reset(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_grand_champion::ScheduleFindNewMount(), boss_the_lurker_below::SchedulerPhaseOne(), boss_drakkari_colossus::boss_drakkari_colossusAI::ScheduleTasks(), Player::SendLoot(), Player::SetBeastMaster(), SetCharm(), SetCharmedBy(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetMinion(), SetStunned(), SetSwim(), npc_mistress_nagmara::sGossipSelect(), boss_victor_nefarius::sGossipSelect(), Battlefield::ShowNpc(), npc_netherspite_infernal::SpellHit(), npc_harrison_jones::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_anub_arak::SpellHitTarget(), npc_rocknot::StartAleEvent(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_lord_valthalak::StartTalking(), npc_giant_claw_tentacle::Submerge(), boss_ouro::Submerge(), boss_ahune::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), npc_highlord_darion_mograine::SummonReplacement(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), boss_vaelastrasz::UpdateAI(), boss_ragnaros::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_anubarak_trial::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), boss_malygos::UpdateAI(), boss_algalon_the_observer::UpdateAI(), boss_xt002::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_ichoron::UpdateAI(), npc_azure_saboteur::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Creature::UpdateEntry(), CombatManager::UpdateOwnerCombatState(), and UpdatePetCombatState().

◆ SetUnitFlag2()

◆ SetUnitMovementFlags()

◆ SetVirtualItem()

void Unit::SetVirtualItem ( uint32  slot,
uint32  itemId 
)

◆ SetVisible()

void Unit::SetVisible ( bool  x)
10933{
10934 if (!x)
10936 else
10938
10940}
@ SEC_GAMEMASTER
Definition Common.h:59

References WorldObject::m_serverSideVisibility, SEC_GAMEMASTER, SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::ArmHiddenState(), Creature::Create(), boss_muru::DamageTaken(), boss_alar::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), boss_victor_nefarius::DoAction(), boss_archimonde::DoAction(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::DoAction(), boss_yoggsaron::DoAction(), npc_hor_spiritual_reflection::EnterEvadeMode(), HideNpcEvent::Execute(), UtherBatteredHiltEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), BattlegroundSA::HandleKillUnit(), boss_yoggsaron_sara::HandleWipeRecovery(), Battlefield::HideNpc(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::HideSaurfangEventNpc(), boss_kiljaeden::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), SmartAI::JustRespawned(), npc_highlord_darion_mograine::JustRespawned(), boss_hazzarah::JustSummoned(), npc_overlord_drakuru_betrayal::MoveInLineOfSight(), npc_enslaved_netherwing_drake::MovementInform(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::MovementInform(), boss_vazruden_the_herald::MovementInform(), npc_shattered_hand_scout::MovementInform(), npc_madrigosa::npc_madrigosa(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnCreatureCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), boss_victor_nefarius::Reset(), boss_midnight::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_muru::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_valkyr_battle_maiden::Reset(), boss_archimonde::Reset(), boss_eye_of_cthun::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_pos_leader::npc_pos_leaderAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_ionar::Reset(), boss_yoggsaron_sara::Reset(), npc_minigob_manabonk::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_overlord_drakuru_betrayal::Reset(), boss_vazruden_the_herald::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::Reset(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::RestoreSaurfangEventNpc(), instance_halls_of_reflection::SetData(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), Battlefield::ShowNpc(), boss_ionar::Split(), boss_warchief_kargath_bladefist::SummonedCreatureDies(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Update(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_valkyr_battle_maiden::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_saurfang_event::npc_saurfang_eventAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_ionar::UpdateAI(), boss_yoggsaron_sara::UpdateAI(), npc_vh_teleportation_portal::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_overlord_drakuru_betrayal::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_grimstone::UpdateEscortAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_taretha::npc_tarethaAI::WaypointReached().

◆ SetVisibleAura()

void Unit::SetVisibleAura ( uint8  slot,
AuraApplication *  aur 
)
inline

◆ SetWalk()

bool Unit::SetWalk ( bool  enable)
virtual

Reimplemented in Creature.

16223{
16224 if (enable == IsWalking())
16225 return false;
16226
16227 if (enable)
16229 else
16231
16233 return true;
16234}
bool IsWalking() const
Definition Unit.h:1727

References AddUnitMovementFlag(), IsWalking(), MOVEMENTFLAG_WALKING, propagateSpeedChange(), and RemoveUnitMovementFlag().

Referenced by debug_commandscript::HandleDebugMoveflagsCommand(), SetCharm(), and Creature::SetWalk().

◆ SetWaterWalking()

void Unit::SetWaterWalking ( bool  enable)
16436{
16437 bool isClientControlled = IsClientControlled();
16438
16439 if (!isClientControlled)
16440 {
16441 if (enable)
16443 else
16445 }
16446
16447 if (!IsInWorld()) // is sent on add to map
16448 return;
16449
16450 if (isClientControlled)
16451 {
16452 if (Player const* player = GetClientControlling())
16453 {
16454 uint32 const counter = player->GetSession()->GetOrderCounter();
16455
16456 WorldPacket data(enable ? SMSG_MOVE_WATER_WALK : SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4);
16457 data << GetPackGUID();
16458 data << counter;
16459 player->SendDirectMessage(&data);
16460 player->GetSession()->IncrementOrderCounter();
16461 return;
16462 }
16463 }
16464
16466 data << GetPackGUID();
16467 SendMessageToSet(&data, true);
16468}
@ MOVEMENTFLAG_WATERWALKING
Definition UnitDefines.h:400
@ SMSG_MOVE_LAND_WALK
Definition Opcodes.h:253
@ SMSG_SPLINE_MOVE_LAND_WALK
Definition Opcodes.h:808
@ SMSG_MOVE_WATER_WALK
Definition Opcodes.h:252

References MovementInfo::AddMovementFlag(), GetClientControlling(), Object::GetPackGUID(), IsClientControlled(), Object::IsInWorld(), WorldObject::m_movementInfo, MOVEMENTFLAG_WATERWALKING, MovementInfo::RemoveMovementFlag(), WorldObject::SendMessageToSet(), PackedGuid::size(), SMSG_MOVE_LAND_WALK, SMSG_MOVE_WATER_WALK, SMSG_SPLINE_MOVE_LAND_WALK, and SMSG_SPLINE_MOVE_WATER_WALK.

Referenced by Player::BuildPlayerRepop(), AuraEffect::HandleAuraWaterWalk(), debug_commandscript::HandleDebugMoveflagsCommand(), cheat_commandscript::HandleWaterWalkCheatCommand(), and Player::ResurrectPlayer().

◆ SpellBaseDamageBonusDone()

int32 Unit::SpellBaseDamageBonusDone ( SpellSchoolMask  schoolMask)
8866{
8867 int32 DoneAdvertisedBenefit = GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_DONE, [schoolMask](AuraEffect const* aurEff)
8868 {
8869 return aurEff->GetMiscValue() & schoolMask &&
8870 // -1 == any item class (not wand then)
8871 aurEff->GetSpellInfo()->EquippedItemClass == -1 &&
8872 // 0 == any inventory type (not wand then)
8874 });
8875
8876 if (IsPlayer())
8877 {
8878 // Base value
8879 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
8880 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellDamageBonus();
8881
8882 // Damage bonus from stats
8884 for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
8885 {
8886 if ((*i)->GetMiscValue() & schoolMask)
8887 {
8888 // stat used stored in miscValueB for this aura
8889 Stats usedStat = Stats((*i)->GetMiscValueB());
8890 DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
8891 }
8892 }
8893 // ... and attack power
8895 }
8896 return DoneAdvertisedBenefit;
8897}
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition SpellAuraDefines.h:237
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
uint32 GetBaseSpellPowerBonus()
Definition Player.h:2002
uint32 GetBaseSpellDamageBonus()
Definition Player.h:2003
int32 EquippedItemInventoryTypeMask
Definition SpellInfo.h:401
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:11986
float GetStat(Stats stat) const
Definition Unit.h:1072

References BASE_ATTACK, CalculatePct(), SpellInfo::EquippedItemClass, SpellInfo::EquippedItemInventoryTypeMask, GetAuraEffectsByType(), Player::GetBaseSpellDamageBonus(), Player::GetBaseSpellPowerBonus(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), GetStat(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::IsPlayer(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by lfg::BuildRBInternalInfo(), spell_item_wraith_scythe_drain_life::CalculateDamage(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), Spell::EffectWeaponDmg(), spell_warl_life_tap::HandleDummy(), spell_pal_seal_of_righteousness::HandleProc(), spell_sha_flametongue_weapon::HandleProc(), SpellDamageBonusDone(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseDamageBonusTaken()

int32 Unit::SpellBaseDamageBonusTaken ( SpellSchoolMask  schoolMask,
bool  isDoT = false 
)
8900{
8901 return GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_TAKEN, [schoolMask, isDoT](AuraEffect const* aurEff)
8902 {
8903 return (aurEff->GetMiscValue() & schoolMask) != 0
8904 // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs
8905 // Xinef: required for hemorrhage & rupture / garrote
8906 && !(isDoT && aurEff->GetBase()->IsUsingCharges() && aurEff->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC);
8907 });
8908}
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:138
bool IsUsingCharges() const
Definition SpellAuras.h:202
uint32 ProcFlags
Definition SpellInfo.h:379

References AuraEffect::GetBase(), AuraEffect::GetMiscValue(), AuraEffect::GetSpellInfo(), GetTotalAuraModifier(), Aura::IsUsingCharges(), PROC_FLAG_TAKEN_PERIODIC, SpellInfo::ProcFlags, and SPELL_AURA_MOD_DAMAGE_TAKEN.

Referenced by spell_pal_seal_of_righteousness::HandleProc(), and SpellDamageBonusTaken().

◆ SpellBaseHealingBonusDone()

int32 Unit::SpellBaseHealingBonusDone ( SpellSchoolMask  schoolMask)
9632{
9633 int32 AdvertisedBenefit = 0;
9634
9635 AdvertisedBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_HEALING_DONE, [schoolMask](AuraEffect const* aurEff)
9636 {
9637 return !aurEff->GetMiscValue() || (aurEff->GetMiscValue() & schoolMask) != 0;
9638 });
9639
9640 // Healing bonus of spirit, intellect and strength
9641 if (IsPlayer())
9642 {
9643 // Base value
9644 AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
9645 AdvertisedBenefit += ToPlayer()->GetBaseSpellHealingBonus();
9646
9647 // Healing bonus from stats
9649 for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
9650 {
9651 // stat used dependent from misc value (stat index)
9652 Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
9653 AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
9654 }
9655
9656 // ... and attack power
9658 }
9659 return AdvertisedBenefit;
9660}
@ SPELL_AURA_MOD_HEALING_DONE
Definition SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition SpellAuraDefines.h:238
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition SpellAuraDefines.h:301
uint32 GetBaseSpellHealingBonus()
Definition Player.h:2004

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellHealingBonus(), Player::GetBaseSpellPowerBonus(), AuraEffect::GetMiscValue(), GetStat(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::IsPlayer(), SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by lfg::BuildRBInternalInfo(), CalculateSpellAmount(), SpellHealingBonusDone(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellCriticalDamageBonus()

uint32 Unit::SpellCriticalDamageBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
9219{
9220 // Calculate critical bonus
9221 int32 crit_bonus = damage;
9222 float crit_mod = 0.0f;
9223
9224 switch (spellProto->DmgClass)
9225 {
9226 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
9228 crit_bonus += damage;
9229 break;
9230 default:
9231 crit_bonus += damage / 2; // for spells is 50%
9232 break;
9233 }
9234
9235 if (caster)
9236 {
9237 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask());
9238
9239 if (victim)
9240 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
9241
9242 if (crit_bonus != 0 && crit_mod != 0.0f)
9243 AddPct(crit_bonus, crit_mod);
9244
9245 crit_bonus -= damage;
9246
9247 // adds additional damage to critBonus (from talents)
9248 if (Player* modOwner = caster->GetSpellModOwner())
9249 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
9250
9251 crit_bonus += damage;
9252 }
9253
9254 return crit_bonus;
9255}

References AddPct(), SpellInfo::DmgClass, GetCreatureTypeMask(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellCriticalHealingBonus()

uint32 Unit::SpellCriticalHealingBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
9258{
9259 // Calculate critical bonus
9260 int32 crit_bonus;
9261 switch (spellProto->DmgClass)
9262 {
9263 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
9266 crit_bonus = damage;
9267 break;
9268 default:
9269 crit_bonus = damage / 2; // for spells is 50%
9270 break;
9271 }
9272
9273 if (caster)
9274 {
9275 if (victim)
9276 {
9277 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
9278 crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask));
9279 }
9280
9281 // adds additional damage to critBonus (from talents)
9282 // xinef: used for death knight death coil
9283 if (Player* modOwner = caster->GetSpellModOwner())
9284 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
9285 }
9286
9287 if (crit_bonus > 0)
9288 damage += crit_bonus;
9289
9290 if (caster)
9291 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT));
9292
9293 return damage;
9294}
@ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT
Definition SpellAuraDefines.h:113

References SpellInfo::DmgClass, GetCreatureTypeMask(), GetSpellModOwner(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by Spell::DoAllEffectOnTarget(), and AuraEffect::HandlePeriodicHealAurasTick().

◆ SpellDamageBonusDone()

uint32 Unit::SpellDamageBonusDone ( Unit *  victim,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
8555{
8556 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
8557 return pdamage;
8558
8559 // Some spells don't benefit from done mods
8560 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
8561 return pdamage;
8562
8563 // For totems get damage bonus from owner
8564 if (IsCreature())
8565 {
8566 if (IsTotem())
8567 {
8568 if (Unit* owner = GetOwner())
8569 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex, TotalMod, stack);
8570 }
8571 // Dancing Rune Weapon...
8572 else if (GetEntry() == 27893)
8573 {
8574 if (Unit* owner = GetOwner())
8575 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2;
8576 }
8577 }
8578
8579 // Done total percent damage auras
8580 float ApCoeffMod = 1.0f;
8581 int32 DoneTotal = 0;
8582 float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
8583
8584 // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controlled Damage
8586 DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
8587
8588 // Some spells don't benefit from pct done mods
8589 if (!spellProto->HasAttribute(SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
8590 {
8591 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
8592 // Add flat bonus from spell damage versus
8594 }
8595
8596 // done scripted mod (take it from owner)
8597 Unit* owner = GetOwner() ? GetOwner() : this;
8598 int32 DoneAdvertisedBenefit = 0;
8599 DoneAdvertisedBenefit += owner->GetTotalAuraModifier(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, [spellProto](AuraEffect const* aurEff)
8600 {
8601 if (!aurEff->IsAffectedOnSpell(spellProto))
8602 return false;
8603
8604 switch (aurEff->GetMiscValue())
8605 {
8606 case 4418: // Increased Shock Damage
8607 case 4554: // Increased Lightning Damage
8608 case 4555: // Improved Moonfire
8609 case 5142: // Increased Lightning Damage
8610 case 5147: // Improved Consecration / Libram of Resurgence
8611 case 5148: // Idol of the Shooting Star
8612 case 6008: // Increased Lightning Damage
8613 case 8627: // Totem of Hex
8614 return true;
8615 break;
8616 default:
8617 break;
8618 }
8619
8620 return false;
8621 });
8622
8623 // Custom scripted damage
8624 switch (spellProto->SpellFamilyName)
8625 {
8626 case SPELLFAMILY_DRUID:
8627 {
8628 // Nourish vs Idol of the Flourishing Life
8629 if (spellProto->SpellFamilyFlags[1] & 0x02000000)
8630 {
8631 if (AuraEffect const* relicAurEff = GetAuraEffect(64949, EFFECT_0))
8632 {
8633 DoneAdvertisedBenefit += relicAurEff->GetAmount();
8634 }
8635 }
8636 break;
8637 }
8639 {
8640 // Sigil of the Vengeful Heart
8641 if (spellProto->SpellFamilyFlags[0] & 0x2000)
8642 {
8643 if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
8644 {
8645 AddPct(DoneTotal, aurEff->GetAmount());
8646 }
8647 }
8648
8649 // Impurity
8651 {
8652 AddPct(ApCoeffMod, aurEff->GetAmount());
8653 }
8654
8655 // Blood Boil - bonus for diseased targets
8656 if ((spellProto->SpellFamilyFlags[0] & 0x00040000) && victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, GetGUID()))
8657 {
8658 DoneTotal += 95;
8659 ApCoeffMod = 1.5835f;
8660 }
8661 break;
8662 }
8663 default:
8664 break;
8665 }
8666
8667 // Done fixed damage bonus auras
8668 DoneAdvertisedBenefit += SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
8669
8670 // Check for table values
8671 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
8672 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
8673 if (bonus)
8674 {
8675 if (damagetype == DOT)
8676 {
8677 coeff = bonus->dot_damage;
8678 if (bonus->ap_dot_bonus > 0)
8679 {
8680 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
8682 APbonus += GetTotalAttackPowerValue(attType);
8683 DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
8684 }
8685 }
8686 else
8687 {
8688 coeff = bonus->direct_damage;
8689 if (bonus->ap_bonus > 0)
8690 {
8691 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
8693 APbonus += GetTotalAttackPowerValue(attType);
8694 DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
8695 }
8696 }
8697 }
8698 else
8699 {
8700 // No bonus damage for SPELL_DAMAGE_CLASS_NONE class spells by default
8701 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
8702 return uint32(std::max((float(pdamage) + DoneTotal) * DoneTotalMod, 0.0f));
8703 }
8704
8705 // Default calculation
8706 if (coeff && DoneAdvertisedBenefit)
8707 {
8708 float factorMod = CalculateLevelPenalty(spellProto) * stack;
8709
8710 if (Player* modOwner = GetSpellModOwner())
8711 {
8712 coeff *= 100.0f;
8713 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
8714 coeff /= 100.0f;
8715 }
8716
8717 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
8718 }
8719
8720 float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
8721 // apply spellmod to Done damage (flat and pct)
8722 if (Player* modOwner = GetSpellModOwner())
8723 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
8724
8725 return uint32(std::max(tmpDamage, 0.0f));
8726}
@ EFFECT_1
Definition SharedDefines.h:32
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
Definition SharedDefines.h:621
@ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS
Definition SpellAuraDefines.h:243
@ SPELLMOD_DOT
Definition SpellDefines.h:106
@ SPELLMOD_BONUS_MULTIPLIER
Definition SpellDefines.h:108
float GetSpellDamageMod(int32 Rank)
Definition Creature.cpp:1612
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:8226
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:8865
float CalculateLevelPenalty(SpellInfo const *spellProto) const
Definition Unit.cpp:3241
Definition SpellMgr.h:321
float ap_dot_bonus
Definition SpellMgr.h:325
float dot_damage
Definition SpellMgr.h:323
float ap_bonus
Definition SpellMgr.h:324
float direct_damage
Definition SpellMgr.h:322

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, EFFECT_0, EFFECT_1, SpellInfo::Effects, AuraEffect::GetAmount(), GetAuraEffect(), GetCreatureTypeMask(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), AuraEffect::GetMiscValue(), GetOwner(), SpellInfo::GetSchoolMask(), Creature::GetSpellDamageMod(), GetSpellModOwner(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), IsControlledByPlayer(), Object::IsCreature(), IsGuardian(), IsPet(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SpellBaseDamageBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctDamageModsDone(), sSpellMgr, and Object::ToCreature().

Referenced by AuraEffect::CalculateAmount(), spell_warl_seed_of_corruption_dummy::CalculateBuffer(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), spell_warr_bloodthirst::HandleDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDamageBonusTaken()

uint32 Unit::SpellDamageBonusTaken ( Unit *  caster,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint32  stack = 1 
)
8729{
8730 if (!spellProto || damagetype == DIRECT_DAMAGE)
8731 return pdamage;
8732
8733 int32 TakenTotal = 0;
8734 float TakenTotalMod = 1.0f;
8735
8736 // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
8737 // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
8738 TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto->GetSchoolMask());
8739
8740 TakenTotalMod = processDummyAuras(TakenTotalMod);
8741
8742 // From caster spells
8743 if (caster)
8744 {
8745 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_FROM_CASTER, [caster, spellProto](AuraEffect const* aurEff) -> bool
8746 {
8747 if (aurEff->GetCasterGUID() == caster->GetGUID() && aurEff->IsAffectedOnSpell(spellProto))
8748 return true;
8749 return false;
8750 });
8751 }
8752
8753 if (uint64 mechanicMask = spellProto->GetAllEffectsMechanicMask())
8754 {
8755 int32 modifierMax = 0;
8756 int32 modifierMin = 0;
8758 for (AuraEffectList::const_iterator i = auraEffectList.begin(); i != auraEffectList.end(); ++i)
8759 {
8760 if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
8761 continue;
8762
8763 // Only death knight spell with this aura
8764 if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
8765 if (!caster || caster->GetGUID() != (*i)->GetCasterGUID())
8766 continue;
8767
8768 if (mechanicMask & (1ULL << (*i)->GetMiscValue()))
8769 {
8770 if ((*i)->GetAmount() > 0)
8771 {
8772 if ((*i)->GetAmount() > modifierMax)
8773 modifierMax = (*i)->GetAmount();
8774 }
8775 else if ((*i)->GetAmount() < modifierMin)
8776 modifierMin = (*i)->GetAmount();
8777 }
8778 }
8779
8780 AddPct(TakenTotalMod, modifierMax);
8781 AddPct(TakenTotalMod, modifierMin);
8782 }
8783
8784 int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT);
8785
8786 // Check for table values
8787 float coeff = 0;
8788 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
8789 if (bonus)
8790 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
8791
8792 // Default calculation
8793 if (TakenAdvertisedBenefit)
8794 {
8795 if (coeff <= 0.0f)
8796 {
8797 if (caster)
8798 coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
8799 else
8800 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
8801 }
8802
8803 float factorMod = CalculateLevelPenalty(spellProto) * stack;
8804 TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
8805 }
8806
8807 // No positive taken bonus, custom attr
8808 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
8809 {
8810 TakenTotal = 0;
8811 TakenTotalMod = 1.0f;
8812 }
8813
8814 // Sanctified Wrath (bypass damage reduction)
8815 if (caster && TakenTotalMod < 1.0f && caster->HasIgnoreTargetResistModifiersAura())
8816 {
8817 float damageModifier = 1.0f - TakenTotalMod;
8819 if (aurEff->GetMiscValue() & spellProto->SchoolMask)
8820 AddPct(damageModifier, -aurEff->GetAmount());
8821
8822 TakenTotalMod = 1.0f - damageModifier;
8823 }
8824
8825 float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
8826
8827 return uint32(std::max(tmpDamage, 0.0f));
8828}
float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
Definition Unit.cpp:13300
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT=false)
Definition Unit.cpp:8899

References AddPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, DOT, SpellBonusEntry::dot_damage, SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), SpellInfo::GetSchoolMask(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistModifiersAura(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), processDummyAuras(), SpellInfo::SchoolMask, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST_MODIFIERS, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, sSpellMgr, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by DealDamageShieldDamage(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and spell_black_temple_l5_arcane_charge::PrepareSpellScript().

◆ SpellDoneCritChance()

float Unit::SpellDoneCritChance ( Unit const *  ,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
8911{
8912 // Mobs can't crit with spells.
8913 if (IsCreature() && !GetSpellModOwner())
8914 return -100.0f;
8915
8916 // not critting spell
8917 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
8918 return 0.0f;
8919
8920 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
8921 if (!skipEffectCheck && !spellProto->IsCritCapable())
8922 return 0.0f;
8923
8924 float crit_chance = 0.0f;
8925 switch (spellProto->DmgClass)
8926 {
8928 {
8929 if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
8930 crit_chance = 0.0f;
8931 // For other schools
8932 else if (IsPlayer())
8933 {
8934 crit_chance = GetFloatValue(static_cast<uint16>(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask));
8935
8936 // register aura mod, this is needed for Arcane Potency
8937 if (Spell* spell = ToPlayer()->m_spellModTakingSpell)
8938 {
8940 for (AuraEffect const* aurEff : critAuras)
8941 spell->m_appliedMods.insert(aurEff->GetBase());
8942
8944 for (AuraEffect const* aurEff : critSchoolAuras)
8945 if (aurEff->GetMiscValue() & schoolMask)
8946 spell->m_appliedMods.insert(aurEff->GetBase());
8947 }
8948 }
8949 else
8950 {
8951 crit_chance = (float)m_baseSpellCritChance;
8953 }
8954 break;
8955 }
8958 {
8959 if (IsPlayer())
8960 {
8961 switch (attackType)
8962 {
8963 case BASE_ATTACK:
8965 break;
8966 case OFF_ATTACK:
8968 break;
8969 case RANGED_ATTACK:
8971 break;
8972 default:
8973 break;
8974 }
8975 }
8976 else
8977 {
8978 crit_chance = 5.0f;
8981 }
8983 break;
8984 }
8985 // values overridden in spellmgr for lifebloom and earth shield
8987 default:
8988 return 0.0f;
8989 }
8990
8991 // percent done
8992 // only players use intelligence for critical chance computations
8993 if (Player* modOwner = GetSpellModOwner())
8994 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
8995
8996 // xinef: can be negative!
8997 return crit_chance;
8998}
@ SPELL_ATTR2_CANT_CRIT
Definition SharedDefines.h:473
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition SharedDefines.h:306
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition SpellAuraDefines.h:134
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:120
@ SPELLMOD_CRITICAL_CHANCE
Definition SpellDefines.h:91
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition UpdateFields.h:354

References BASE_ATTACK, SpellInfo::DmgClass, GetAuraEffectsByType(), GetFirstSchoolInMask(), Object::GetFloatValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsCritCapable(), Object::IsPlayer(), m_baseSpellCritChance, OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_CRITICAL_CHANCE, and Object::ToPlayer().

Referenced by Spell::DoAllEffectOnLaunchTarget().

◆ SpellHealingBonusDone()

uint32 Unit::SpellHealingBonusDone ( Unit *  victim,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
9382{
9383 // For totems get healing bonus from owner (statue isn't totem in fact)
9384 if (IsCreature() && IsTotem())
9385 if (Unit* owner = GetOwner())
9386 return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effIndex, TotalMod, stack);
9387
9388 // No bonus healing for potion spells
9389 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
9390 return healamount;
9391
9392 float ApCoeffMod = 1.0f;
9393 float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype);
9394 int32 DoneTotal = 0;
9395
9396 // done scripted mod (take it from owner)
9397 Unit* owner = GetOwner() ? GetOwner() : this;
9398 int32 DoneAdvertisedBenefit = 0;
9399 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9400 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9401 {
9402 if (!(*i)->IsAffectedOnSpell(spellProto))
9403 continue;
9404
9405 switch ((*i)->GetMiscValue())
9406 {
9407 case 4415: // Increased Rejuvenation Healing
9408 case 4953:
9409 DoneAdvertisedBenefit += (*i)->GetAmount();
9410 break;
9411 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
9412 DoneAdvertisedBenefit += (*i)->GetAmount();
9413 break;
9414 }
9415 }
9416
9417 switch (spellProto->SpellFamilyName)
9418 {
9420 {
9421 // Impurity
9423 {
9424 AddPct(ApCoeffMod, aurEff->GetAmount());
9425 }
9426 break;
9427 }
9428 default:
9429 break;
9430 }
9431
9432 // Done fixed damage bonus auras
9433 DoneAdvertisedBenefit += SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
9434 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
9435
9436 // Check for table values
9437 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
9438 if (bonus)
9439 {
9440 if (damagetype == DOT)
9441 {
9442 coeff = bonus->dot_damage;
9443 if (bonus->ap_dot_bonus > 0)
9444 DoneTotal += int32(bonus->ap_dot_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
9445 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
9446 }
9447 else
9448 {
9449 coeff = bonus->direct_damage;
9450 if (bonus->ap_bonus > 0)
9451 DoneTotal += int32(bonus->ap_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
9452 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
9453 }
9454 }
9455 else
9456 {
9457 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
9458 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
9459 return uint32(std::max(healamount * DoneTotalMod, 0.0f));
9460 }
9461
9462 // Default calculation
9463 if (DoneAdvertisedBenefit)
9464 {
9465 float factorMod = CalculateLevelPenalty(spellProto) * stack;
9466 if (Player* modOwner = GetSpellModOwner())
9467 {
9468 coeff *= 100.0f;
9469 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
9470 coeff /= 100.0f;
9471 }
9472 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
9473 }
9474
9475 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9476 {
9477 switch (spellProto->Effects[i].ApplyAuraName)
9478 {
9479 // Bonus healing does not apply to these spells
9482 DoneTotal = 0;
9483 break;
9484 default:
9485 break;
9486 }
9487 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
9488 DoneTotal = 0;
9489 }
9490
9491 // use float as more appropriate for negative values and percent applying
9492 float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
9493 // apply spellmod to Done amount
9494
9495 if (Player* modOwner = GetSpellModOwner())
9496 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
9497
9498 return uint32(std::max(heal, 0.0f));
9499}
@ SPELLFAMILY_POTION
Definition SharedDefines.h:3797
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition SpellAuraDefines.h:125
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:9631
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:9296

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAttackPowerValue(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_POTION, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctHealingModsDone(), and sSpellMgr.

Referenced by AuraEffect::CalculateAmount(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_dru_lifebloom::HandleDispel(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHealingBonusTaken()

uint32 Unit::SpellHealingBonusTaken ( Unit *  caster,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint32  stack = 1 
)
9502{
9503 float TakenTotalMod = 1.0f;
9504 float minval = 0.0f;
9505
9506 // Healing taken percent
9507 if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
9508 {
9510 }
9511
9512 if (minval)
9513 AddPct(TakenTotalMod, minval);
9514
9516 if (maxval)
9517 AddPct(TakenTotalMod, maxval);
9518
9519 // Tenacity increase healing % taken
9520 if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
9521 AddPct(TakenTotalMod, Tenacity->GetAmount());
9522
9523 // Healing Done
9524 int32 TakenTotal = 0;
9525
9526 // Taken fixed damage bonus auras
9527 int32 TakenAdvertisedBenefit = GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_HEALING, spellProto->GetSchoolMask());
9528
9529 // Nourish cast - 20% bonus if target has Rejuvenation, Regrowth, Lifebloom, or Wild Growth from caster
9530 // Glyph of Nourish is handled by spell_dru_nourish script
9531 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster)
9532 {
9534 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
9535 {
9536 if ((*i)->GetCasterGUID() == caster->GetGUID())
9537 {
9538 SpellInfo const* spell = (*i)->GetSpellInfo();
9539 // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
9540 if (spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0))
9541 {
9542 TakenTotalMod *= 1.2f;
9543 break;
9544 }
9545 }
9546 }
9547 }
9548
9549 if (damagetype == DOT)
9550 {
9551 // Healing over time taken percent
9552 float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
9553 if (minval_hot)
9554 AddPct(TakenTotalMod, minval_hot);
9555
9556 float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
9557 if (maxval_hot)
9558 AddPct(TakenTotalMod, maxval_hot);
9559 }
9560
9561 // Check for table values
9562 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
9563 float coeff = 0;
9564 float factorMod = 1.0f;
9565 if (bonus)
9566 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
9567 else
9568 {
9569 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
9570 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
9571 {
9572 healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
9573 return healamount;
9574 }
9575 }
9576
9577 // Default calculation
9578 if (TakenAdvertisedBenefit)
9579 {
9580 float TakenCoeff = 0.0f;
9581 if (coeff <= 0)
9582 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
9583
9584 factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
9585 if (Player* modOwner = GetSpellModOwner())
9586 {
9587 coeff *= 100.0f;
9588 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
9589 coeff /= 100.0f;
9590 }
9591
9592 TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod);
9593 }
9594
9595 if (caster)
9596 {
9597 TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_RECEIVED, [caster, spellProto](AuraEffect const* aurEff)
9598 {
9599 return caster->GetGUID() == aurEff->GetCasterGUID() && aurEff->IsAffectedOnSpell(spellProto);
9600 });
9601 }
9602
9603 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
9604 {
9605 switch (spellProto->Effects[i].ApplyAuraName)
9606 {
9607 // Bonus healing does not apply to these spells
9610 TakenTotal = 0;
9611 break;
9612 default:
9613 break;
9614 }
9615 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
9616 TakenTotal = 0;
9617 }
9618
9619 // No positive taken bonus, custom attr
9620 if ((spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f)
9621 {
9622 TakenTotal = 0;
9623 TakenTotalMod = 1.0f;
9624 }
9625
9626 float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
9627
9628 return uint32(std::max(heal, 0.0f));
9629}
@ SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS
Definition SharedDefines.h:619
@ SPELL_AURA_MOD_HEALING_RECEIVED
Definition SpellAuraDefines.h:346
@ SPELL_AURA_MOD_HEALING_PCT
Definition SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition SpellAuraDefines.h:322
@ SPELL_AURA_MOD_HEALING
Definition SpellAuraDefines.h:178

References AddPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), Object::GetGUID(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), flag96::HasFlag(), SpellInfo::Id, AuraEffect::IsAffectedOnSpell(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_MOD_HEALING, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HEALING_RECEIVED, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, sScriptMgr, and sSpellMgr.

Referenced by spell_dru_lifebloom::AfterRemove(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_pri_renew::HandleApplyEffect(), spell_pal_lay_on_hands::HandleMaxHealthHeal(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellPctDamageModsDone()

float Unit::SpellPctDamageModsDone ( Unit *  victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
8227{
8228 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
8229 return 1.0f;
8230
8231 // Some spells don't benefit from done mods
8232 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
8233 return 1.0f;
8234
8235 // For totems get damage bonus from owner
8236 if (IsCreature())
8237 {
8238 if (IsTotem())
8239 {
8240 if (Unit* owner = GetOwner())
8241 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
8242 }
8243 // Dancing Rune Weapon...
8244 else if (GetEntry() == 27893)
8245 {
8246 if (Unit* owner = GetOwner())
8247 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
8248 }
8249 }
8250
8251 // Done total percent damage auras
8252 float DoneTotalMod = 1.0f;
8253
8254 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [spellProto, this, damagetype](AuraEffect const* aurEff)
8255 {
8256 // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
8257 if (spellProto->EquippedItemClass == -1 && aurEff->GetSpellInfo()->EquippedItemClass != -1 &&
8259 {
8260 return false;
8261 }
8262
8263 if (!spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT))
8264 return false;
8265
8266 if (aurEff->GetMiscValue() & spellProto->GetSchoolMask())
8267 {
8268 if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
8269 return true;
8271 return true;
8272 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurEff->GetSpellInfo()))
8273 return true;
8274 }
8275 return false;
8276 });
8277
8278 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
8279 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, [creatureTypeMask, spellProto, damagetype, this](AuraEffect const* aurEff)
8280 {
8281 return creatureTypeMask & aurEff->GetMiscValue() && spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT);
8282 });
8283
8284 // bonus against aurastate
8285 DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim, spellProto, damagetype, this](AuraEffect const* aurEff)
8286 {
8287 return victim->HasAuraState(AuraStateType(aurEff->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, aurEff, damagetype == DOT);
8288 });
8289
8290 // done scripted mod (take it from owner)
8291 Unit* owner = GetOwner() ? GetOwner() : this;
8292 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
8293 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
8294 {
8295 // Xinef: self cast is ommited (because of Rage of Rivendare)
8296 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
8297 continue;
8298
8299 // xinef: Molten Fury should work on all spells
8300 switch ((*i)->GetMiscValue())
8301 {
8302 case 4920: // Molten Fury
8303 case 4919:
8304 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8305 AddPct(DoneTotalMod, (*i)->GetAmount());
8306 break;
8307 }
8308
8309 if (!(*i)->IsAffectedOnSpell(spellProto))
8310 continue;
8311
8312 switch ((*i)->GetMiscValue())
8313 {
8314 case 6917: // Death's Embrace
8315 case 6926:
8316 case 6928:
8317 {
8318 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8319 AddPct(DoneTotalMod, (*i)->GetAmount());
8320 break;
8321 }
8322 // Soul Siphon
8323 case 4992:
8324 case 4993:
8325 {
8326 // effect 1 m_amount
8327 int32 maxPercent = (*i)->GetAmount();
8328 // effect 0 m_amount
8329 int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
8330 // count affliction effects and calc additional damage in percentage
8331 int32 modPercent = 0;
8332 AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
8333 for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
8334 {
8335 Aura const* aura = itr->second->GetBase();
8336 SpellInfo const* m_spell = aura->GetSpellInfo();
8337 if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
8338 continue;
8339 modPercent += stepPercent * aura->GetStackAmount();
8340 if (modPercent >= maxPercent)
8341 {
8342 modPercent = maxPercent;
8343 break;
8344 }
8345 }
8346 AddPct(DoneTotalMod, modPercent);
8347 break;
8348 }
8349 case 6916: // Death's Embrace
8350 case 6925:
8351 case 6927:
8352 if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
8353 AddPct(DoneTotalMod, (*i)->GetAmount());
8354 break;
8355 case 5481: // Starfire Bonus
8356 {
8357 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
8358 AddPct(DoneTotalMod, (*i)->GetAmount());
8359 break;
8360 }
8361 // Tundra Stalker
8362 // Merciless Combat
8363 case 7277:
8364 {
8365 // Merciless Combat
8366 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
8367 {
8368 if ((spellProto && spellProto->SpellFamilyFlags[0] & 0x2) || spellProto->SpellFamilyFlags[1] & 0x2 )
8369 if (!victim->HealthAbovePct(35))
8370 AddPct(DoneTotalMod, (*i)->GetAmount());
8371 }
8372 // Tundra Stalker
8373 else
8374 {
8375 // Frost Fever (target debuff)
8376 if (victim->HasAura(55095))
8377 AddPct(DoneTotalMod, (*i)->GetAmount());
8378 break;
8379 }
8380 break;
8381 }
8382 // Rage of Rivendare
8383 case 7293:
8384 {
8386 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
8387 break;
8388 }
8389 // Twisted Faith
8390 case 7377:
8391 {
8393 AddPct(DoneTotalMod, (*i)->GetAmount());
8394 break;
8395 }
8396 // Marked for Death
8397 case 7598:
8398 case 7599:
8399 case 7600:
8400 case 7601:
8401 case 7602:
8402 {
8403 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
8404 AddPct(DoneTotalMod, (*i)->GetAmount());
8405 break;
8406 }
8407 // Dirty Deeds
8408 case 6427:
8409 case 6428:
8410 case 6579:
8411 case 6580:
8412 {
8413 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
8414 {
8415 // effect 0 has expected value but in negative state
8416 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
8417 AddPct(DoneTotalMod, bonus);
8418 }
8419 break;
8420 }
8421 }
8422 }
8423
8424 // Custom scripted damage
8425 switch (spellProto->SpellFamilyName)
8426 {
8427 case SPELLFAMILY_MAGE:
8428 // Ice Lance
8429 if (spellProto->SpellIconID == 186)
8430 {
8431 if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
8432 {
8433 // Glyph of Ice Lance
8434 if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
8435 DoneTotalMod *= 4.0f;
8436 else
8437 DoneTotalMod *= 3.0f;
8438 }
8439 }
8440
8441 // Torment the weak
8442 if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
8443 if (victim->HasAuraWithMechanic((1ULL << MECHANIC_SNARE) | (1ULL << MECHANIC_SLOW_ATTACK)))
8445 AddPct(DoneTotalMod, aurEff->GetAmount());
8446 break;
8447 case SPELLFAMILY_PRIEST:
8448 // Mind Flay
8449 if (spellProto->SpellFamilyFlags[0] & 0x800000)
8450 {
8451 // Glyph of Shadow Word: Pain
8452 if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
8453 // Increase Mind Flay damage if Shadow Word: Pain present on target
8455 AddPct(DoneTotalMod, aurEff->GetAmount());
8456
8457 // Twisted Faith - Mind Flay part
8459 // Increase Mind Flay damage if Shadow Word: Pain present on target
8461 AddPct(DoneTotalMod, aurEff->GetAmount());
8462 }
8463 // Smite
8464 else if (spellProto->SpellFamilyFlags[0] & 0x80)
8465 {
8466 // Glyph of Smite
8467 if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
8468 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
8469 AddPct(DoneTotalMod, aurEff->GetAmount());
8470 }
8471 // Shadow Word: Death
8472 else if (spellProto->SpellFamilyFlags[1] & 0x2)
8473 {
8474 // Glyph of Shadow Word: Death
8475 if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
8477 AddPct(DoneTotalMod, aurEff->GetAmount());
8478 }
8479
8480 break;
8482 // Judgement of Vengeance/Judgement of Corruption
8483 if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
8484 {
8485 // Get stack of Holy Vengeance/Blood Corruption on the target added by caster
8486 uint32 stacks = 0;
8488 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
8489 if (((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID() == GetGUID())
8490 {
8491 stacks = (*itr)->GetBase()->GetStackAmount();
8492 break;
8493 }
8494 // + 10% for each application of Holy Vengeance/Blood Corruption on the target
8495 if (stacks)
8496 AddPct(DoneTotalMod, 10 * stacks);
8497 }
8498 break;
8499 case SPELLFAMILY_DRUID:
8500 // Thorns
8501 if (spellProto->SpellFamilyFlags[0] & 0x100)
8502 {
8503 // Brambles
8504 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
8505 AddPct(DoneTotalMod, aurEff->GetAmount());
8506 }
8507 break;
8509 // Fire and Brimstone
8510 if (spellProto->SpellFamilyFlags[1] & 0x00020040)
8512 {
8514 for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
8515 if ((*i)->GetSpellInfo()->SpellIconID == 3173)
8516 {
8517 AddPct(DoneTotalMod, (*i)->GetAmount());
8518 break;
8519 }
8520 }
8521 // Drain Soul - increased damage for targets under 25 % HP
8522 if (spellProto->SpellFamilyFlags[0] & 0x00004000)
8523 if (!victim->HealthAbovePct(25))
8524 DoneTotalMod *= 4;
8525 // Shadow Bite (15% increase from each dot)
8526 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
8527 if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
8528 AddPct(DoneTotalMod, 15 * count);
8529 break;
8530 case SPELLFAMILY_HUNTER:
8531 // Steady Shot
8532 if (spellProto->SpellFamilyFlags[1] & 0x1)
8533 if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
8534 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
8535 AddPct(DoneTotalMod, aurEff->GetAmount());
8536 break;
8538 // Improved Icy Touch
8539 if (spellProto->SpellFamilyFlags[0] & 0x2)
8541 AddPct(DoneTotalMod, aurEff->GetAmount());
8542
8543 // Glacier Rot
8544 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
8546 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
8547 AddPct(DoneTotalMod, aurEff->GetAmount());
8548 break;
8549 }
8550
8551 return DoneTotalMod;
8552}
@ SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM
Definition SharedDefines.h:571
@ MECHANIC_SLOW_ATTACK
Definition SharedDefines.h:1321
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3789
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3787
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3784
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3794
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition SharedDefines.h:1281
@ AURA_STATE_CONFLAGRATE
Definition SharedDefines.h:1294
int32 EquippedItemSubClassMask
Definition SpellInfo.h:400
bool HealthAbovePct(int32 pct) const
Definition Unit.h:1132
uint32 GetDiseasesByCaster(ObjectGuid casterGUID, uint8 mode=0)
Definition Unit.cpp:5938
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:679
uint32 GetDoTsByCaster(ObjectGuid casterGUID) const
Definition Unit.cpp:5992
bool HasAuraWithMechanic(uint64 mechanicMask) const
Definition Unit.cpp:5909
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Object.cpp:3378

References AddPct(), AURA_STATE_CONFLAGRATE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, WorldObject::CalculateSpellDamage(), DIRECT_DAMAGE, DOT, EFFECT_0, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, AuraEffect::GetAmount(), GetAppliedAuras(), GetAuraEffect(), GetAuraEffectOfRankedSpell(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDoTsByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetLevel(), AuraEffect::GetMiscValue(), GetOwner(), GetOwnerGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), HealthAbovePct(), Object::IsCreature(), IsPet(), IsTotem(), MECHANIC_SLOW_ATTACK, MECHANIC_SNARE, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_DUMMY, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, Object::ToPlayer(), and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by AuraEffect::CalculatePeriodicData(), and SpellDamageBonusDone().

◆ SpellPctHealingModsDone()

float Unit::SpellPctHealingModsDone ( Unit *  victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
9297{
9298 // For totems get healing bonus from owner (statue isn't totem in fact)
9299 if (IsCreature() && IsTotem())
9300 if (Unit* owner = GetOwner())
9301 return owner->SpellPctHealingModsDone(victim, spellProto, damagetype);
9302
9303 // Some spells don't benefit from done mods
9304 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
9305 return 1.0f;
9306
9307 // xinef: Some spells don't benefit from done mods
9308 if (spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS))
9309 return 1.0f;
9310
9311 // No bonus healing for potion spells
9312 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
9313 return 1.0f;
9314
9315 float DoneTotalMod = 1.0f;
9316
9317 // Healing done percent
9319
9320 // done scripted mod (take it from owner)
9321 Unit* owner = GetOwner() ? GetOwner() : this;
9322 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9323 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9324 {
9325 if (!(*i)->IsAffectedOnSpell(spellProto))
9326 continue;
9327
9328 switch ((*i)->GetMiscValue())
9329 {
9330 case 21: // Test of Faith
9331 case 6935:
9332 case 6918:
9333 if (victim->HealthBelowPct(50))
9334 AddPct(DoneTotalMod, (*i)->GetAmount());
9335 break;
9336 case 7798: // Glyph of Regrowth
9337 {
9339 AddPct(DoneTotalMod, (*i)->GetAmount());
9340 break;
9341 }
9342
9343 case 7871: // Glyph of Lesser Healing Wave
9344 {
9345 // xinef: affected by any earth shield
9346 if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0))
9347 AddPct(DoneTotalMod, (*i)->GetAmount());
9348 break;
9349 }
9350 default:
9351 break;
9352 }
9353 }
9354
9355 switch (spellProto->SpellFamilyName)
9356 {
9358 // Talents and glyphs for healing stream totem
9359 if (spellProto->Id == 52042)
9360 {
9361 // Glyph of Healing Stream Totem
9362 if (AuraEffect* dummy = owner->GetAuraEffect(55456, EFFECT_0))
9363 AddPct(DoneTotalMod, dummy->GetAmount());
9364
9365 // Healing Stream totem - Restorative Totems
9366 if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1))
9367 AddPct(DoneTotalMod, aurEff->GetAmount());
9368 }
9369 break;
9370 case SPELLFAMILY_PRIEST:
9371 // T9 HEALING 4P, empowered renew instant heal
9372 if (spellProto->Id == 63544)
9373 if (AuraEffect* aurEff = GetAuraEffect(67202, EFFECT_0))
9374 AddPct(DoneTotalMod, aurEff->GetAmount());
9375 break;
9376 }
9377
9378 return DoneTotalMod;
9379}
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3795
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition SpellAuraDefines.h:199

References AddPct(), EFFECT_0, GetAuraEffect(), GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), GetTotalAuraMultiplier(), SpellInfo::HasAttribute(), HealthBelowPct(), SpellInfo::Id, Object::IsCreature(), IsTotem(), SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_DUMMY, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::CalculatePeriodicData(), and SpellHealingBonusDone().

◆ SpellTakenCritChance()

float Unit::SpellTakenCritChance ( Unit const *  caster,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
float  doneChance,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
9001{
9002 // not critting spell
9003 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
9004 return 0.0f;
9005
9006 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
9007 if (!skipEffectCheck && !spellProto->IsCritCapable())
9008 return 0.0f;
9009
9010 float crit_chance = doneChance;
9011 switch (spellProto->DmgClass)
9012 {
9014 {
9015 if (!spellProto->IsPositive())
9016 {
9017 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
9018 // xinef: apply max and min only
9020 {
9023 }
9024
9025 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
9026 }
9027 // scripted (increase crit chance ... against ... target by x%
9028 if (caster)
9029 {
9030 AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
9031 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
9032 {
9033 if (!((*i)->IsAffectedOnSpell(spellProto)))
9034 continue;
9035 int32 modChance = 0;
9036 switch ((*i)->GetMiscValue())
9037 {
9038 // Shatter
9039 case 911:
9040 modChance += 16;
9041 [[fallthrough]];
9042 case 910:
9043 modChance += 17;
9044 [[fallthrough]];
9045 case 849:
9046 modChance += 17;
9047 if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
9048 break;
9049 crit_chance += modChance;
9050 break;
9051 case 7917: // Glyph of Shadowburn
9052 if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
9053 crit_chance += (*i)->GetAmount();
9054 break;
9055 case 7997: // Renewed Hope
9056 case 7998:
9057 if (HasAura(6788))
9058 crit_chance += (*i)->GetAmount();
9059 break;
9060 default:
9061 break;
9062 }
9063 }
9064 // Custom crit by class
9065 switch (spellProto->SpellFamilyName)
9066 {
9067 case SPELLFAMILY_MAGE:
9068 // Glyph of Fire Blast
9069 if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
9070 if (HasAuraWithMechanic((1ULL << MECHANIC_STUN) | (1ULL << MECHANIC_KNOCKOUT)))
9071 if (AuraEffect const* aurEff = caster->GetAuraEffect(56369, EFFECT_0))
9072 crit_chance += aurEff->GetAmount();
9073 break;
9074 case SPELLFAMILY_DRUID:
9075 // Improved Faerie Fire
9077 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0))
9078 crit_chance += aurEff->GetAmount();
9079
9080 // cumulative effect - don't break
9081
9082 // Starfire
9083 if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485)
9084 {
9085 // Improved Insect Swarm
9086 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
9088 crit_chance += aurEff->GetAmount();
9089 break;
9090 }
9091 break;
9092 case SPELLFAMILY_ROGUE:
9093 // Shiv-applied poisons can't crit
9094 if (caster->FindCurrentSpellBySpellId(5938))
9095 crit_chance = 0.0f;
9096 break;
9098 // Flash of light
9099 if (spellProto->SpellFamilyFlags[0] & 0x40000000)
9100 {
9101 // Sacred Shield
9102 if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID()))
9103 crit_chance += aura->GetAmount();
9104 break;
9105 }
9106 // Exorcism
9107 else if (spellProto->GetCategory() == 19)
9108 {
9110 return 100.0f;
9111 break;
9112 }
9113 break;
9114 case SPELLFAMILY_SHAMAN:
9115 // Lava Burst
9116 if (spellProto->SpellFamilyFlags[1] & 0x00001000)
9117 {
9118 if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID()))
9120 return 100.0f;
9121 break;
9122 }
9123 break;
9124 }
9125
9126 // spell crit suppression vs higher level creatures: none at +1, 0.3% at +2, 2.1% against a +3 boss
9127 if (IsCreature() && !spellProto->IsPositive())
9128 {
9129 int32 const levelDiff = int32(getLevelForTarget(caster)) - int32(caster->GetLevel());
9130 if (levelDiff == 2)
9131 crit_chance -= 0.3f;
9132 else if (levelDiff >= 3)
9133 crit_chance -= 2.1f + (levelDiff - 3) * 0.7f;
9134 }
9135 }
9136 break;
9137 }
9139 // Custom crit by class
9140 if (caster)
9141 {
9142 switch (spellProto->SpellFamilyName)
9143 {
9144 case SPELLFAMILY_DRUID:
9145 // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
9146 if (spellProto->SpellFamilyFlags[0] & 0x00800000 && spellProto->SpellIconID == 1680 && HasAuraState(AURA_STATE_BLEEDING))
9147 {
9148 if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1))
9149 crit_chance += rendAndTear->GetAmount();
9150 break;
9151 }
9152 break;
9154 // Victory Rush
9155 if (spellProto->SpellFamilyFlags[1] & 0x100)
9156 {
9157 // Glyph of Victory Rush
9158 if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0))
9159 crit_chance += aurEff->GetAmount();
9160 break;
9161 }
9162 break;
9163 }
9164 }
9165
9166 // 100% critical chance against sitting target
9168 {
9169 return 100.0f;
9170 }
9171 [[fallthrough]];
9173 {
9174 // flat aura mods
9175 if (attackType == RANGED_ATTACK)
9177 else
9179
9180 // reduce crit chance from Rating for players
9181 if (attackType != RANGED_ATTACK)
9182 {
9183 // xinef: little hack, crit chance dont require caster to calculate, pass victim
9184 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
9185 }
9186 else
9187 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
9188
9189 // Apply crit chance from defence skill
9190 if (caster)
9191 crit_chance += caster->GetCritChanceFromSkillDiff(this);
9192
9193 break;
9194 }
9195 // values overridden in spellmgr for lifebloom and earth shield
9197 default:
9198 return 0.0f;
9199 }
9200
9201 if (caster)
9202 {
9203 crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, [caster](AuraEffect const* aurEff)
9204 {
9205 return caster->GetGUID() == aurEff->GetCasterGUID();
9206 });
9207 }
9208
9209 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
9210 // xinef: should be calculated at the end
9211 if (!spellProto->IsPositive())
9213
9214 // xinef: can be negative!
9215 return crit_chance;
9216}
uint32 const CREATURE_TYPEMASK_DEMON_OR_UNDEAD
Definition SharedDefines.h:2637
@ MECHANIC_KNOCKOUT
Definition SharedDefines.h:1327
@ MECHANIC_STUN
Definition SharedDefines.h:1325
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3792
@ AURA_STATE_BLEEDING
Definition SharedDefines.h:1298
@ AURA_STATE_FAERIE_FIRE
Definition SharedDefines.h:1292
bool HasAttackerSpellCritChanceAura() const
Definition Unit.h:1851
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6153

References ApplyResilience(), AURA_STATE_BLEEDING, AURA_STATE_FAERIE_FIRE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_35_PERCENT, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CREATURE_TYPEMASK_DEMON_OR_UNDEAD, SpellInfo::DmgClass, EFFECT_0, FindCurrentSpellBySpellId(), GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetCasterGUID(), SpellInfo::GetCategory(), GetCreatureTypeMask(), GetCritChanceFromSkillDiff(), GetDummyAuraEffect(), Object::GetGUID(), Object::GetGUID(), GetLevel(), getLevelForTarget(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscMask(), getStandState(), GetTotalAuraModifier(), HasAttackerSpellCritChanceAura(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), Object::IsCreature(), SpellInfo::IsCritCapable(), Object::IsPlayer(), SpellInfo::IsPositive(), IsSitState(), MECHANIC_KNOCKOUT, MECHANIC_STUN, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_DRUID, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, and UNIT_STAND_STATE_SLEEP.

Referenced by AuraEffect::CalcPeriodicCritChance(), and Spell::DoAllEffectOnLaunchTarget().

◆ StartReactiveTimer()

void Unit::StartReactiveTimer ( ReactiveType  reactive)
inline
#define REACTIVE_TIMER_START
Definition Unit.h:623

References m_reactiveTimer, and REACTIVE_TIMER_START.

Referenced by ProcSkillsAndReactives().

◆ StopAttackFaction()

void Unit::StopAttackFaction ( uint32  faction_id)
15811{
15812 if (Unit* victim = GetVictim())
15813 {
15814 if (victim->GetFactionTemplateEntry()->faction == faction_id)
15815 {
15816 AttackStop();
15817 if (IsNonMeleeSpellCast(false))
15819
15820 // melee and ranged forced attack cancel
15821 if (IsPlayer())
15823 }
15824 }
15825
15826 AttackerSet const& attackers = getAttackers();
15827 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
15828 {
15829 if ((*itr)->GetFactionTemplateEntry()->faction == faction_id)
15830 {
15831 (*itr)->AttackStop();
15832 itr = attackers.begin();
15833 }
15834 else
15835 ++itr;
15836 }
15837
15838 // Collect GUIDs, not pointers: EndCombat can cascade through AI callbacks
15839 // (formation MemberEvaded -> CombatStop) and free other refs in the list.
15840 std::vector<ObjectGuid> guidsToEnd;
15841 for (auto const& pair : m_combatManager.GetPvECombatRefs())
15842 if (pair.second->GetOther(this)->GetFactionTemplateEntry()->faction == faction_id)
15843 guidsToEnd.push_back(pair.first);
15844 for (ObjectGuid const& guid : guidsToEnd)
15845 {
15846 auto const& refs = m_combatManager.GetPvECombatRefs();
15847 auto it = refs.find(guid);
15848 if (it != refs.end())
15849 it->second->EndCombat();
15850 }
15851
15852 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
15853 (*itr)->StopAttackFaction(faction_id);
15854}
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
Definition CombatManager.h:136

References AttackStop(), getAttackers(), CombatManager::GetPvECombatRefs(), GetVictim(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_combatManager, m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by AuraEffect::HandleForceReaction().

◆ StopAttackingInvalidTarget()

void Unit::StopAttackingInvalidTarget ( )
15857{
15858 AttackerSet const& attackers = getAttackers();
15859 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
15860 {
15861 Unit* attacker = (*itr);
15862 if (!attacker->IsValidAttackTarget(this))
15863 {
15864 attacker->AttackStop();
15865 if (attacker->IsPlayer())
15866 {
15868 }
15869
15870 for (Unit* controlled : attacker->m_Controlled)
15871 {
15872 if (controlled->GetVictim() == this && !controlled->IsValidAttackTarget(this))
15873 {
15874 controlled->AttackStop();
15875 }
15876 }
15877
15878 itr = attackers.begin();
15879 }
15880 else
15881 {
15882 ++itr;
15883 }
15884 }
15885}

References AttackStop(), getAttackers(), Object::IsPlayer(), IsValidAttackTarget(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ StopMoving()

void Unit::StopMoving ( )
12726{
12728
12729 // not need send any packets if not in world or not moving
12730 if (!IsInWorld())
12731 return;
12732
12733 if (movespline->Finalized())
12734 return;
12735
12736 // Update position now since Stop does not start a new movement that can be updated later
12737 if (movespline->HasStarted())
12739
12740 Movement::MoveSplineInit init(this);
12741 init.Stop();
12742}
bool HasStarted() const
Definition MoveSpline.h:132
void UpdateSplinePosition()
Definition Unit.cpp:734

References ClearUnitState(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::HasStarted(), Object::IsInWorld(), movespline, Movement::MoveSplineInit::Stop(), UNIT_STATE_MOVING, and UpdateSplinePosition().

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), Pet::CastPendingSpell(), boss_alar::ConstructWaypointsAndMove(), boss_baron_geddon::DamageTaken(), boss_grand_champion::DamageTaken(), npc_ulduar_aerial_command_unit::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_razorscale::DoAction(), ScriptedAI::DoCastSpell(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), FormationMovementGenerator::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoReset(), WaypointMovementGenerator< Creature >::DoUpdate(), FormationMovementGenerator::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), WorldSession::HandlePetActionHelper(), RotateMovementGenerator::Initialize(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_kologarn::JustDied(), boss_freya::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_janalai::JustEngagedWith(), Player::LeaveBattleground(), boss_headless_horseman::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_toc5_player_vehicle::OnCharmed(), npc_hover_disk::PassengerBoarded(), PauseMovement(), SmartAI::PausePath(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), RemoveCharmedBy(), Creature::RemoveCorpse(), boss_felblood_kaelthas::Reset(), boss_leotheras_the_blind::Reset(), IdleMovementGenerator::Reset(), boss_grand_champion::ScheduleFindNewMount(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SendMoveRoot(), SetCharmedBy(), SmartAI::SetCombatMovement(), SetConfused(), boss_victor_nefarius::SetData(), setDeathState(), SetFeared(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_harrison_jones::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_heigan::StartFightPhase(), SmartAI::StopFollow(), SmartAI::StopPath(), CreatureAI::TriggerAlert(), TimedFleeingMovementGenerator::Update(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_saurfang_event::npc_saurfang_eventAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::UpdateAI(), boss_stormcaller_brundir::UpdateAI(), boss_mimiron::UpdateAI(), boss_thorim_sif::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), and PetAI::UpdateAI().

◆ StopMovingOnCurrentPos()

void Unit::StopMovingOnCurrentPos ( )
12765{
12767
12768 // not need send any packets if not in world
12769 if (!IsInWorld())
12770 return;
12771
12772 DisableSpline(); // pussywizard: required so Launch() won't recalculate position from previous spline
12773 Movement::MoveSplineInit init(this);
12774 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
12775 init.SetFacing(GetOrientation());
12776 init.Launch();
12777}

References ClearUnitState(), DisableSpline(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsInWorld(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and UNIT_STATE_MOVING.

Referenced by npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), boss_alar::DoDiveBomb(), UtherBatteredHiltEvent::Execute(), WorldSession::HandlePetActionHelper(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), boss_flame_leviathan::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), instance_halls_of_reflection::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_janalai::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_devourer_of_souls::SpellHitTarget(), Creature::Update(), npc_rookery_hatcher::UpdateAI(), npc_vaelastrasz_the_red::UpdateAI(), and npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI().

◆ Talk() [1/2]

void Unit::Talk ( std::string_view  text,
ChatMsg  msgType,
Language  language,
float  textRange,
WorldObject const *  target 
)
virtual

◆ Talk() [2/2]

void Unit::Talk ( uint32  textId,
ChatMsg  msgType,
float  textRange,
WorldObject const *  target 
)
virtual
16968{
16969 if (!sObjectMgr->GetBroadcastText(textId))
16970 {
16971 LOG_ERROR("entities.unit", "Unit::Talk: `broadcast_text` (ID: {}) was not found", textId);
16972 return;
16973 }
16974
16975 Acore::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
16978 Cell::VisitObjects(this, worker, textRange);
16979}
Definition ChatTextBuilder.h:31
uint8 getGender() const
Definition Unit.h:854

References getGender(), LOG_ERROR, sObjectMgr, and Cell::VisitObjects().

◆ TextEmote() [1/2]

◆ TextEmote() [2/2]

void Unit::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

16992{
16993 Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
16994}

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToPet()

◆ ToTempSummon() [1/2]

TempSummon * Unit::ToTempSummon ( )
inline
737{ if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }

References IsSummon().

Referenced by CreatureAI::_EnterEvadeMode(), _ExitVehicle(), npc_living_mojo::npc_living_mojoAI::AttackStart(), ThreatManager::CanHaveThreatList(), WorldObject::CanSeeOrDetect(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Creature::DespawnOnEvade(), Creature::DespawnOrUnsummon(), npc_bone_spike::npc_bone_spikeAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), Spell::EffectScriptEffect(), npc_phantom_hallucination::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), npc_raging_flames::FixateRandomTarget(), Spell::GetGameObjectCaster(), boss_headless_horseman_head::GetOwner(), GetSpellModOwner(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner(), CreatureAI::GetSummoner(), Creature::GetSummonerGUID(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pilgrims_bounty_pass_generic::HandleDummy(), WorldSession::HandlePetActionHelper(), spell_the_cleansing_on_death_cast_on_master::HandleScript(), spell_gen_whisper_to_controller::HandleScript(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), npc_freya_ward_summon::IsSummonedBy(), Creature::IsUpdateNeeded(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), npc_raging_spirit::npc_raging_spiritAI::JustDied(), boss_yoggsaron_influence_tentacle::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::JustDied(), boss_black_knight::JustDied(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), npc_living_mojo::npc_living_mojoAI::JustEngagedWith(), boss_yoggsaron_cloud::JustSummoned(), npc_frosthound::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_collapsing_star::JustSummoned(), npc_algalon_worm_hole::JustSummoned(), boss_supremus::JustSummoned(), Kill(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_netherspite_infernal::KilledUnit(), npc_living_mojo::npc_living_mojoAI::MoveInLineOfSight(), npc_jenny::MoveInLineOfSight(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_midsummer_ribbon_pole_target::npc_midsummer_ribbon_pole_target(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), BattlefieldWG::OnCreatureCreate(), instance_blackwing_lair::OnCreatureCreate(), npc_wormhole::OnGossipHello(), WaypointMovementGenerator< Creature >::ProcessWaypointArrival(), boss_freya_iron_root::ReleaseRootedPlayer(), RemoveAllControlled(), RemoveAllMinionsByEntry(), spell_gen_defend::RemoveDummyFromDriver(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_stormforged_lieutenant::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), npc_voidtraveler::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::SelectVictim(), Spell::SendSpellGo(), Spell::SendSpellStart(), npc_ulduar_flames_spread::SpellHit(), npc_pilgrims_bounty_plate::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SummonedCreatureDies(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), npc_valkyr_battle_maiden::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_ulduar_flash_freeze::UpdateAI(), npc_vh_void_sentry::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_jenny::UpdateFollowerAI(), Player::VehicleSpellInitialize(), and npc_frosthound::WaypointReached().

◆ ToTempSummon() [2/2]

TempSummon const * Unit::ToTempSummon ( ) const
inline
738{ if (IsSummon()) return reinterpret_cast<TempSummon const*>(this); else return nullptr; }

References IsSummon().

◆ ToTotem()

Totem * Unit::ToTotem ( )
inline
736{ if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
Definition Totem.h:51

References IsTotem().

Referenced by _UnapplyAura(), Spell::EffectDestroyAllTotems(), WorldSession::HandleTotemDestroyed(), SetMinion(), Spell::SummonGuardian(), and TotemAI::UpdateAI().

◆ TriggerAurasProcOnEvent() [1/3]

void Unit::TriggerAurasProcOnEvent ( CalcDamageInfo &  damageInfo)
12586{
12587 DamageInfo dmgInfo = DamageInfo(damageInfo);
12588 TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, dmgInfo.GetHitMask(), nullptr, &dmgInfo, nullptr);
12589}
uint32 GetHitMask() const
Definition Unit.cpp:285

References DamageInfo::GetHitMask(), CalcDamageInfo::procAttacker, CalcDamageInfo::procVictim, CalcDamageInfo::target, and TriggerAurasProcOnEvent().

Referenced by ProcSkillsAndAuras(), TriggerAurasProcOnEvent(), and TriggerAurasProcOnEvent().

◆ TriggerAurasProcOnEvent() [2/3]

void Unit::TriggerAurasProcOnEvent ( ProcEventInfo &  eventInfo,
AuraApplicationProcContainer &  procAuras 
)
12628{
12629 Spell const* triggeringSpell = eventInfo.GetProcSpell();
12630 bool const disableProcs = triggeringSpell && triggeringSpell->IsProcDisabled();
12631 if (disableProcs)
12632 SetCantProc(true);
12633
12634 for (auto const& [procEffectMask, aurApp] : aurasTriggeringProc)
12635 {
12636 if (aurApp->GetRemoveMode())
12637 continue;
12638
12639 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
12641 SetCantProc(true);
12642
12643 aurApp->GetBase()->TriggerProcOnEvent(procEffectMask, aurApp, eventInfo);
12644
12646 SetCantProc(false);
12647 }
12648
12649 if (disableProcs)
12650 SetCantProc(false);
12651}
@ SPELL_ATTR3_INSTANT_TARGET_PROCS
Definition SharedDefines.h:500
Spell const * GetProcSpell() const
Definition Unit.h:477
bool IsProcDisabled() const
Definition Spell.h:570
void SetCantProc(bool apply)
Definition Unit.cpp:13390

References ProcEventInfo::GetProcSpell(), SpellInfo::HasAttribute(), Spell::IsProcDisabled(), SetCantProc(), and SPELL_ATTR3_INSTANT_TARGET_PROCS.

◆ TriggerAurasProcOnEvent() [3/3]

void 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 
)
12592{
12593 // prepare data for self trigger
12594 ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
12595 AuraApplicationProcContainer myAurasTriggeringProc;
12596 GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
12597
12598 // needed for example for Cobra Strikes, pet does the attack, but aura is on owner
12599 if (Player* modOwner = GetSpellModOwner())
12600 {
12601 if (modOwner != this && spell)
12602 {
12603 std::list<AuraApplication*> modAuras;
12604 for (auto itr = modOwner->GetAppliedAuras().begin(); itr != modOwner->GetAppliedAuras().end(); ++itr)
12605 {
12606 if (spell->m_appliedMods.count(itr->second->GetBase()) != 0)
12607 modAuras.push_back(itr->second);
12608 }
12609
12610 if (!modAuras.empty())
12611 modOwner->GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, &modAuras, myProcEventInfo);
12612 }
12613 }
12614
12615 // prepare data for target trigger
12616 ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
12617 AuraApplicationProcContainer targetAurasTriggeringProc;
12618 if (typeMaskActionTarget && actionTarget)
12619 actionTarget->GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
12620
12621 TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
12622
12623 if (typeMaskActionTarget && actionTarget)
12624 actionTarget->TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
12625}
Definition Unit.h:450
UsedSpellMods m_appliedMods
Definition Spell.h:560
void GetProcAurasTriggeredOnEvent(AuraApplicationProcContainer &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
Definition Unit.cpp:12548
std::vector< std::pair< uint8, AuraApplication * > > AuraApplicationProcContainer
Definition Unit.h:689

References GetProcAurasTriggeredOnEvent(), GetSpellModOwner(), Spell::m_appliedMods, spellTypeMask, and TriggerAurasProcOnEvent().

◆ UnsummonAllTotems()

void Unit::UnsummonAllTotems ( bool  onDeath = false)
8149{
8150 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
8151 {
8152 if (!m_SummonSlot[i])
8153 {
8154 continue;
8155 }
8156
8157 if (Creature* OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
8158 {
8159 if (OldTotem->IsSummon())
8160 {
8161 if (!(onDeath && !IsPlayer() && OldTotem->IsGuardian()))
8162 {
8163 OldTotem->ToTempSummon()->UnSummon();
8164 }
8165 }
8166 }
8167 }
8168}

References WorldObject::GetMap(), Object::IsPlayer(), m_SummonSlot, and MAX_SUMMON_SLOT.

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ Update()

void Unit::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

511{
512 sScriptMgr->OnUnitUpdate(this, p_time);
513
514 // WARNING! Order of execution here is important, do not change.
515 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
516 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
517 WorldObject::Update(p_time);
518
519 if (!IsInWorld())
520 return;
521
522 // pussywizard:
523 if (!IsPlayer() || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate))
524 {
526 {
528 {
530 //ExecuteDelayedUnitRelocationEvent();
532 }
533 else
535 }
537 {
538 if (m_delayed_unit_ai_notify_timer <= p_time)
539 {
542 }
543 else
545 }
546 }
547
548 _UpdateSpells( p_time );
549
550 // update combat timer only for players and pets (only pets with PetAI)
552 {
553 // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
554 // targets without stopping half way there and running off.
555 // These flags are reset after target dies or another command is given.
556 if (!GetCombatManager().HasCombat())
557 {
558 // m_CombatTimer set at aura start and it will be freeze until aura removing
559 if (m_CombatTimer <= p_time)
561 else
562 m_CombatTimer -= p_time;
563 }
564 }
565
566 m_combatManager.Update(p_time);
567
570 {
571 while (!extraAttacksTargets.empty())
572 {
573 auto itr = extraAttacksTargets.begin();
574 ObjectGuid targetGuid = itr->first;
575 uint32 count = itr->second;
576 extraAttacksTargets.erase(itr);
577 if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid))
578 {
580 || victim->IsWithinMeleeRange(this))
581 {
582 HandleProcExtraAttackFor(victim, count);
583 }
584 }
585 }
587 }
588
589 // not implemented before 3.0.2
590 // xinef: if attack time > 0, reduce by diff
591 // if on next update, attack time < 0 assume player didnt attack - set to 0
592 bool suspendAttackTimer = false;
593 bool suspendRangedAttackTimer = false;
595 {
596 for (Spell* spell : m_currentSpells)
597 {
598 if (spell)
599 {
600 if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
601 {
602 if (spell->IsChannelActive())
603 {
604 suspendRangedAttackTimer = true;
605 }
606
607 suspendAttackTimer = true;
608 break;
609 }
610 }
611 }
612 }
613
614 if (!suspendAttackTimer)
615 {
616 if (int32 base_attack = getAttackTimer(BASE_ATTACK))
617 {
618 setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32) p_time : 0);
619 }
620
621 if (int32 off_attack = getAttackTimer(OFF_ATTACK))
622 {
623 setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32) p_time : 0);
624 }
625 }
626
627 if (!suspendRangedAttackTimer)
628 {
629 if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
630 {
631 setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
632 }
633 }
634
635 // update abilities available only for fraction of time
636 UpdateReactives(p_time);
637
641
642 UpdateSplineMovement(p_time);
643 GetMotionMaster()->UpdateMotion(p_time);
644
646}
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition SharedDefines.h:1303
@ SPELL_HACK_AND_SLASH
Definition Unit.h:306
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:305
void Update(uint32 tdiff)
Definition CombatManager.cpp:148
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition Map.h:239
void UpdateMotion(uint32 diff)
Definition MotionMaster.cpp:107
void _UpdateSpells(uint32 time)
Definition Unit.cpp:3754
void UpdateSplineMovement(uint32 t_diff)
Definition Unit.cpp:702
void UpdateReactives(uint32 p_time)
Definition Unit.cpp:13032
void ExecuteDelayedUnitAINotifyEvent()
Definition Unit.cpp:16168
void HandleProcExtraAttackFor(Unit *victim, uint32 count)
Definition Unit.cpp:2958
virtual void Update(uint32 diff)
Definition Object.cpp:1077

References _lastDamagedTargetGuid, _lastExtraAttackSpell, _UpdateSpells(), AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, bRequestForcedVisibilityUpdate, ClearInCombat(), ObjectGuid::Empty, ExecuteDelayedUnitAINotifyEvent(), extraAttacksTargets, WorldObject::FindMap(), getAttackTimer(), GetCombatManager(), GetMotionMaster(), ObjectAccessor::GetUnit(), HandleProcExtraAttackFor(), HasUnitState(), HasUnitTypeMask(), HealthAbovePct(), HealthBelowPct(), Map::i_objectsForDelayedVisibility, InvalidateValuesUpdateCache(), IsAlive(), IsControlledByPlayer(), IsInCombat(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), m_combatManager, m_CombatTimer, m_currentSpells, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, ModifyAuraState(), OFF_ATTACK, RANGED_ATTACK, setAttackTimer(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, sScriptMgr, Object::ToPlayer(), UNIT_MASK_CONTROLLABLE_GUARDIAN, UNIT_STATE_CASTING, WorldObject::Update(), CombatManager::Update(), MotionMaster::UpdateMotion(), UpdateReactives(), and UpdateSplineMovement().

Referenced by Creature::Update(), and Player::Update().

◆ UpdateAllDamageDoneMods()

void Unit::UpdateAllDamageDoneMods ( )
11820{
11821 for (uint8 i = BASE_ATTACK; i < MAX_ATTACK; ++i)
11823}
virtual void UpdateDamageDoneMods(WeaponAttackType attackType, int32 skipEnchantSlot=-1)
Definition Unit.cpp:11789

References BASE_ATTACK, MAX_ATTACK, and UpdateDamageDoneMods().

Referenced by AuraEffect::HandleModDamageDone().

◆ UpdateAllDamagePctDoneMods()

void Unit::UpdateAllDamagePctDoneMods ( )
11864{
11865 for (uint8 i = BASE_ATTACK; i < MAX_ATTACK; ++i)
11867}
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:11825

References BASE_ATTACK, MAX_ATTACK, and UpdateDamagePctDoneMods().

Referenced by AuraEffect::HandleModDamagePercentDone().

◆ UpdateAllResistances()

void Unit::UpdateAllResistances ( )
virtual

◆ UpdateAllStats()

virtual bool Unit::UpdateAllStats ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

◆ UpdateArmor()

virtual void Unit::UpdateArmor ( )
pure virtual

◆ UpdateAttackPowerAndDamage()

virtual void Unit::UpdateAttackPowerAndDamage ( bool  ranged = false)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateAuraForGroup()

void Unit::UpdateAuraForGroup ( uint8  slot)
13274{
13275 if (slot >= MAX_AURAS) // slot not found, return
13276 return;
13277 if (Player* player = ToPlayer())
13278 {
13279 if (player->GetGroup())
13280 {
13281 player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
13282 player->SetAuraUpdateMaskForRaid(slot);
13283 }
13284 }
13285 else if (IsCreature() && IsPet())
13286 {
13287 Pet* pet = ((Pet*)this);
13288 if (pet->isControlled())
13289 {
13290 Unit* owner = GetOwner();
13291 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
13292 {
13294 pet->SetAuraUpdateMaskForRaid(slot);
13295 }
13296 }
13297 }
13298}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition Group.h:119
@ GROUP_UPDATE_FLAG_AURAS
Definition Group.h:110
#define MAX_AURAS
Definition SpellAuraDefines.h:21
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition Pet.h:136

References Player::GetGroup(), GetOwner(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_PET_AURAS, Pet::isControlled(), Object::IsCreature(), IsPet(), Object::IsPlayer(), MAX_AURAS, Pet::SetAuraUpdateMaskForRaid(), Player::SetGroupUpdateFlag(), and Object::ToPlayer().

Referenced by RemoveVisibleAura(), and SetVisibleAura().

◆ UpdateCharmAI()

void Unit::UpdateCharmAI ( )
12336{
12337 if (IsPlayer())
12338 return;
12339
12340 if (i_disabledAI) // disabled AI must be primary AI
12341 {
12342 if (!IsCharmed())
12343 {
12344 delete i_AI;
12346 i_disabledAI = nullptr;
12347 }
12348 }
12349 else
12350 {
12351 if (IsCharmed())
12352 {
12354 if (isPossessed() || IsVehicle())
12355 i_AI = new PossessedAI(ToCreature());
12356 else
12357 i_AI = new PetAI(ToCreature());
12358 }
12359 }
12360}
Definition PetAI.h:47
Definition PassiveAI.h:37

References i_AI, i_disabledAI, IsCharmed(), Object::IsPlayer(), isPossessed(), IsVehicle(), and Object::ToCreature().

Referenced by Creature::Update().

◆ UpdateDamageDoneMods()

void Unit::UpdateDamageDoneMods ( WeaponAttackType  attackType,
int32  skipEnchantSlot = -1 
)
virtual

Reimplemented in Player.

11790{
11791 UnitMods unitMod;
11792 switch (attackType)
11793 {
11794 case BASE_ATTACK:
11795 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
11796 break;
11797 case OFF_ATTACK:
11798 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
11799 break;
11800 case RANGED_ATTACK:
11801 unitMod = UNIT_MOD_DAMAGE_RANGED;
11802 break;
11803 default:
11804 ABORT();
11805 break;
11806 }
11807
11808 float amount = GetTotalAuraModifier(SPELL_AURA_MOD_DAMAGE_DONE, [&](AuraEffect const* aurEff) -> bool
11809 {
11810 if (!(aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
11811 return false;
11812
11813 return CheckAttackFitToAuraRequirement(attackType, aurEff);
11814 });
11815
11816 SetStatFlatModifier(unitMod, TOTAL_VALUE, amount);
11817}
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:177
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:175
virtual bool CheckAttackFitToAuraRequirement(WeaponAttackType, AuraEffect const *) const
Definition Unit.h:1101
void SetStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float val)
Definition Unit.cpp:11686

References ABORT, BASE_ATTACK, CheckAttackFitToAuraRequirement(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), OFF_ATTACK, RANGED_ATTACK, SetStatFlatModifier(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_SCHOOL_MASK_NORMAL, TOTAL_VALUE, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

Referenced by UpdateAllDamageDoneMods(), and Player::UpdateDamageDoneMods().

◆ UpdateDamagePctDoneMods()

void Unit::UpdateDamagePctDoneMods ( WeaponAttackType  attackType)
11826{
11827 float factor;
11828 UnitMods unitMod;
11829 switch (attackType)
11830 {
11831 case BASE_ATTACK:
11832 factor = 1.0f;
11833 unitMod = UNIT_MOD_DAMAGE_MAINHAND;
11834 break;
11835 case OFF_ATTACK:
11836 // off hand has 50% penalty
11837 factor = 0.5f;
11838 unitMod = UNIT_MOD_DAMAGE_OFFHAND;
11839 break;
11840 case RANGED_ATTACK:
11841 factor = 1.0f;
11842 unitMod = UNIT_MOD_DAMAGE_RANGED;
11843 break;
11844 default:
11845 ABORT();
11846 break;
11847 }
11848
11849 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, [attackType, this](AuraEffect const* aurEff) -> bool
11850 {
11851 if (!(aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
11852 return false;
11853
11854 return CheckAttackFitToAuraRequirement(attackType, aurEff);
11855 });
11856
11857 if (attackType == OFF_ATTACK)
11858 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT, std::bind(&Unit::CheckAttackFitToAuraRequirement, this, attackType, std::placeholders::_1));
11859
11860 SetStatPctModifier(unitMod, TOTAL_PCT, factor);
11861}
@ SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
Definition SpellAuraDefines.h:185
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:11695

References ABORT, BASE_ATTACK, CheckAttackFitToAuraRequirement(), AuraEffect::GetMiscValue(), GetTotalAuraMultiplier(), OFF_ATTACK, RANGED_ATTACK, SetStatPctModifier(), SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT, SPELL_SCHOOL_MASK_NORMAL, TOTAL_PCT, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, and UNIT_MOD_DAMAGE_RANGED.

Referenced by AuraEffect::HandleModOffhandDamagePercent(), UpdateAllDamagePctDoneMods(), and Player::UpdateWeaponDependentAuras().

◆ UpdateDamagePhysical()

void Unit::UpdateDamagePhysical ( WeaponAttackType  attType)
virtual

Reimplemented in Guardian, and Totem.

61{
62 float totalMin = 0.f;
63 float totalMax = 0.f;
64
65 float tmpMin, tmpMax;
66 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
67 {
68 CalculateMinMaxDamage(attType, false, true, tmpMin, tmpMax, i);
69 totalMin += tmpMin;
70 totalMax += tmpMax;
71 }
72
73 switch (attType)
74 {
75 case BASE_ATTACK:
76 default:
79 break;
80 case OFF_ATTACK:
83 break;
84 case RANGED_ATTACK:
87 break;
88 }
89}
void SetStatFloatValue(uint16 index, float value)
Definition Object.cpp:788

References BASE_ATTACK, CalculateMinMaxDamage(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, Object::SetStatFloatValue(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by Player::_ApplyAmmoBonuses(), Player::_ApplyWeaponDamage(), boss_twin_valkyrAI::boss_twin_valkyrAI(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleModAttackSpeed(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::npc_toc_enh_shamanAI(), Player::RemoveAmmo(), Creature::SetCanDualWield(), ScriptedAI::SetEquipmentSlots(), Creature::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), and UpdateUnitMod().

◆ UpdateHeight()

void Unit::UpdateHeight ( float  newZ)

Only server-side height update, does not broadcast to client.

15771{
15773 if (IsVehicle())
15775}
void RelocatePassengers()
Definition Vehicle.cpp:560

References Position::GetPositionX(), Position::GetPositionY(), GetVehicleKit(), IsVehicle(), Position::Relocate(), and Vehicle::RelocatePassengers().

Referenced by npc_dancing_flames::npc_dancing_flamesAI::Reset().

◆ UpdateInterruptMask()

void Unit::UpdateInterruptMask ( )
893{
894 m_interruptMask = 0;
895 for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
896 m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
897
899 if (spell->getState() == SPELL_STATE_CASTING)
900 m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
901}

References CURRENT_CHANNELED_SPELL, m_currentSpells, m_interruptableAuras, m_interruptMask, and SPELL_STATE_CASTING.

Referenced by _UnapplyAura(), Spell::finish(), and RemoveAurasWithInterruptFlags().

◆ UpdateMaxHealth()

virtual void Unit::UpdateMaxHealth ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateMaxPower()

virtual void Unit::UpdateMaxPower ( Powers  power)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateObjectVisibility()

◆ UpdateOrientation()

void Unit::UpdateOrientation ( float  orientation)

Only server-side orientation update, does not broadcast to client.

15763{
15764 SetOrientation(orientation);
15765 if (IsVehicle())
15767}

References GetVehicleKit(), IsVehicle(), Vehicle::RelocatePassengers(), and Position::SetOrientation().

Referenced by spell_wailing_souls_periodic_aura::HandlePeriodicTick(), Spell::UpdateChanneledTargetList(), and UpdatePosition().

◆ UpdatePetCombatState()

void Unit::UpdatePetCombatState ( )
7383{
7384 ASSERT(!IsPet()); // player pets do not use UNIT_FLAG_PET_IN_COMBAT for this purpose
7385
7386 bool state = false;
7387 for (Unit* minion : m_Controlled)
7388 if (minion->IsInCombat())
7389 {
7390 state = true;
7391 break;
7392 }
7393
7394 if (state)
7396 else
7398}

References ASSERT, IsPet(), m_Controlled, RemoveUnitFlag(), SetUnitFlag(), and UNIT_FLAG_PET_IN_COMBAT.

◆ UpdatePosition() [1/2]

bool Unit::UpdatePosition ( float  x,
float  y,
float  z,
float  ang,
bool  teleport = false 
)
virtual

Reimplemented in Player.

15725{
15726 if (!Acore::IsValidMapCoord(x, y, z, orientation))
15727 return false;
15728
15729 float old_orientation = GetOrientation();
15730 float current_z = GetPositionZ();
15731 bool turn = (old_orientation != orientation);
15732 bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z);
15733
15734 if (!GetVehicle())
15735 {
15736 uint32 mask = 0;
15737 if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING;
15738 if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE;
15739 if (mask)
15741 }
15742
15743 if (relocated)
15744 {
15745 if (IsPlayer())
15746 GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation);
15747 else
15748 GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation);
15749 }
15750 else if (turn)
15751 {
15752 UpdateOrientation(orientation);
15753
15754 if (IsPlayer() && ToPlayer()->GetFarSightDistance())
15756 }
15757
15758 return (relocated || turn);
15759}
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition Map.cpp:804
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition Map.cpp:826
void UpdateOrientation(float orientation)
Only server-side orientation update, does not broadcast to client.
Definition Unit.cpp:15762
bool IsValidMapCoord(float c)
Definition GridDefines.h:210

References AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, Map::CreatureRelocation(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetVehicle(), Object::IsPlayer(), Acore::IsValidMapCoord(), Map::PlayerRelocation(), RemoveAurasWithInterruptFlags(), Object::ToCreature(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdateOrientation().

Referenced by boss_taldaram::DoAction(), npc_hor_spiritual_reflection::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), WorldSession::HandleMoverRelocation(), boss_flame_leviathan::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), NearTeleportTo(), instance_halls_of_reflection::OnCreatureCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_gormok::boss_gormokAI::SetGUID(), npc_escortAI::SetNextWaypoint(), npc_escortAI::SetNextWaypoint(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), Player::UpdatePosition(), and UpdateSplinePosition().

◆ UpdatePosition() [2/2]

bool Unit::UpdatePosition ( Position const &  pos,
bool  teleport = false 
)
inline
2029{ return UpdatePosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); }

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and UpdatePosition().

Referenced by UpdatePosition().

◆ UpdateReactives()

void Unit::UpdateReactives ( uint32  p_time)
13033{
13034 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
13035 {
13036 ReactiveType reactive = ReactiveType(i);
13037
13038 if (!m_reactiveTimer[reactive])
13039 continue;
13040
13041 if (m_reactiveTimer[reactive] <= p_time)
13042 {
13043 m_reactiveTimer[reactive] = 0;
13044
13045 switch (reactive)
13046 {
13047 case REACTIVE_DEFENSE:
13050 break;
13054 break;
13055 case REACTIVE_OVERPOWER:
13057 {
13059 }
13060 break;
13062 if (IsHunterPet())
13064 break;
13065 default:
13066 break;
13067 }
13068 }
13069 else
13070 {
13071 m_reactiveTimer[reactive] -= p_time;
13072 }
13073 }
13074}
ReactiveType
Definition Unit.h:626

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), IsHunterPet(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, and REACTIVE_WOLVERINE_BITE.

Referenced by Update().

◆ UpdateResistanceBuffModsMod()

void Unit::UpdateResistanceBuffModsMod ( SpellSchools  school)
6244{
6245 float modPos = 0.0f;
6246 float modNeg = 0.0f;
6247
6248 // these auras are always positive
6250 modPos += GetTotalAuraModifier(SPELL_AURA_MOD_RESISTANCE, [school](AuraEffect const* aurEff) -> bool
6251 {
6252 if ((aurEff->GetMiscValue() & (1 << school)) && aurEff->GetAmount() > 0)
6253 return true;
6254 return false;
6255 });
6256
6257 modNeg = GetTotalAuraModifier(SPELL_AURA_MOD_RESISTANCE, [school](AuraEffect const* aurEff) -> bool
6258 {
6259 if ((aurEff->GetMiscValue() & (1 << school)) && aurEff->GetAmount() < 0)
6260 return true;
6261 return false;
6262 });
6263
6265 modPos *= factor;
6266 modNeg *= factor;
6267
6270}
@ SPELL_AURA_MOD_RESISTANCE
Definition SpellAuraDefines.h:85
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
Definition SpellAuraDefines.h:206
@ SPELL_AURA_MOD_RESISTANCE_PCT
Definition SpellAuraDefines.h:164

References AsUnderlyingType(), AuraEffect::GetAmount(), GetMaxPositiveAuraModifierByMiscMask(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraMultiplierByMiscMask(), Object::SetFloatValue(), SPELL_AURA_MOD_RESISTANCE, SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE, SPELL_AURA_MOD_RESISTANCE_PCT, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, and UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE.

Referenced by AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), and AuraEffect::HandleModResistancePercent().

◆ UpdateResistances()

virtual void Unit::UpdateResistances ( uint32  school)
pure virtual

Implemented in Creature, Player, and Totem.

Referenced by UpdateAllResistances(), and UpdateUnitMod().

◆ UpdateSpeed()

void Unit::UpdateSpeed ( UnitMoveType  mtype,
bool  forced 
)
Todo:
possible affect only on MOVE_RUN
10951{
10952 int32 main_speed_mod = 0;
10953 float stack_bonus = 1.0f;
10954 float non_stack_bonus = 1.0f;
10955
10956 switch (mtype)
10957 {
10958 // Only apply debuffs
10959 case MOVE_FLIGHT_BACK:
10960 case MOVE_RUN_BACK:
10961 case MOVE_SWIM_BACK:
10962 case MOVE_WALK:
10963 break;
10964 case MOVE_RUN:
10965 {
10966 if (IsMounted()) // Use on mount auras
10967 {
10971 }
10972 else
10973 {
10977 }
10978 break;
10979 }
10980 case MOVE_SWIM:
10981 {
10982 // xinef: check for forced_speed_mod of sea turtle
10984 for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr)
10985 {
10986 // xinef: sea turtle only, it is not affected by any increasing / decreasing effects
10987 if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/)
10988 {
10989 SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced);
10990 return;
10991 }
10992 else if (
10993 // case: increase speed
10994 ((*itr)->GetAmount() > 0 && (*itr)->GetAmount() > main_speed_mod) ||
10995 // case: decrease speed
10996 ((*itr)->GetAmount() < 0 && (*itr)->GetAmount() < main_speed_mod)
10997 )
10998 {
10999 main_speed_mod = (*itr)->GetAmount();
11000 }
11001 }
11002 break;
11003 }
11004 case MOVE_FLIGHT:
11005 {
11006 if (IsCreature() && IsControlledByPlayer()) // not sure if good for pet
11007 {
11010
11011 // for some spells this mod is applied on vehicle owner
11012 int32 owner_speed_mod = 0;
11013
11014 if (Unit* owner = GetCharmer())
11015 owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
11016
11017 main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
11018 }
11019 else if (IsMounted())
11020 {
11024 }
11025 else // Use not mount (shapeshift for example) auras (should stack)
11026 {
11030 }
11031
11032 // Update speed for vehicle if available
11033 if (IsPlayer() && GetVehicle())
11035 break;
11036 }
11037 default:
11038 LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type ({})", mtype);
11039 return;
11040 }
11041
11042 // now we ready for speed calculation
11043 float speed = std::max(non_stack_bonus, stack_bonus);
11044 if (main_speed_mod)
11045 AddPct(speed, main_speed_mod);
11046
11047 switch (mtype)
11048 {
11049 case MOVE_RUN:
11050 case MOVE_SWIM:
11051 case MOVE_FLIGHT:
11052 {
11053 // Set creature speed rate
11054 if (IsCreature())
11055 {
11056 if (IsPet() && ToPet()->isControlled() && IsControlledByPlayer())
11057 {
11058 // contant value for player pets
11059 speed *= 1.15f;
11060 }
11061 else
11062 {
11063 speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
11064 }
11065 }
11066
11067 // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
11070 {
11071 if (Creature* creature = ToCreature())
11072 {
11073 // use creature helper which now consults creature_immunities table
11074 if (creature->HasMechanicTemplateImmunity(1ULL << MECHANIC_SNARE) ||
11075 creature->HasMechanicTemplateImmunity(1ULL << MECHANIC_DAZE))
11076 break;
11077 }
11078
11079 // Use speed from aura
11080 float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
11081 if (speed > max_speed)
11082 speed = max_speed;
11083 }
11084 break;
11085 }
11086 default:
11087 break;
11088 }
11089
11090 int32 slowFromHealth = 0;
11091 Creature* creature = ToCreature();
11092 // ignore pets, player owned vehicles, and mobs immune to snare
11093 if (creature
11094 && !IsPet()
11095 && !(IsControlledByPlayer() && IsVehicle())
11096 && !(creature->HasMechanicTemplateImmunity(1ULL << MECHANIC_SNARE))
11097 && !(creature->IsDungeonBoss()))
11098 {
11099 // 1.6% for each % under 30.
11100 // use min(0, health-30) so that we don't boost mobs above 30.
11101 slowFromHealth = (int32) std::min(0.0f, (1.66f * (GetHealthPct() - 30.0f)));
11102 }
11103
11104 if (slowFromHealth)
11105 {
11106 AddPct(speed, slowFromHealth);
11107 }
11108
11109 // Apply strongest slow aura mod to speed
11111 if (slow)
11112 AddPct(speed, slow);
11113
11114 if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
11115 {
11116 float base_speed = (IsCreature() ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f);
11117 float min_speed = base_speed * (minSpeedMod / 100.0f);
11118 if (speed < min_speed)
11119 speed = min_speed;
11120 }
11121
11122 SetSpeed(mtype, speed, forced);
11123}
@ MECHANIC_DAZE
Definition SharedDefines.h:1340
@ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
Definition SpellAuraDefines.h:269
@ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:272
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition SpellAuraDefines.h:94
@ SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:271
@ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
Definition SpellAuraDefines.h:235
@ SPELL_AURA_MOD_SPEED_NOT_STACK
Definition SpellAuraDefines.h:234
@ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING
Definition SpellAuraDefines.h:273
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
Definition SpellAuraDefines.h:121
@ SPELL_AURA_MOD_MINIMUM_SPEED
Definition SpellAuraDefines.h:368
@ SPELL_AURA_MOD_SPEED_ALWAYS
Definition SpellAuraDefines.h:192
@ SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING
Definition SpellAuraDefines.h:274
@ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
Definition SpellAuraDefines.h:193
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition SpellAuraDefines.h:254
@ MOVE_FLIGHT
Definition UnitDefines.h:362
@ MOVE_SWIM
Definition UnitDefines.h:359
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:363
@ MOVE_SWIM_BACK
Definition UnitDefines.h:360
@ MOVE_RUN_BACK
Definition UnitDefines.h:358
bool HasMechanicTemplateImmunity(uint64 mask) const
Definition Creature.cpp:2265
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:11130
float speed_run
Definition CreatureData.h:202

References AddPct(), baseMoveSpeed, GetAuraEffectsByType(), GetCharmer(), Creature::GetCreatureTemplate(), GetHealthPct(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), GetVehicle(), GetVehicleBase(), Creature::HasMechanicTemplateImmunity(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsDungeonBoss(), IsMounted(), IsPet(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MECHANIC_DAZE, MECHANIC_SNARE, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, playerBaseMoveSpeed, SetSpeed(), CreatureTemplate::speed_run, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING, SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, SPELL_AURA_MOD_MINIMUM_SPEED, SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK, SPELL_AURA_MOD_SPEED_ALWAYS, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, Object::ToCreature(), ToPet(), and UpdateSpeed().

Referenced by Creature::AtDisengage(), Creature::AtEngage(), Dismount(), Creature::DoFleeToGetAssistance(), AuraEffect::HandleAuraModDecreaseSpeed(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModIncreaseSpeed(), AuraEffect::HandleAuraModIncreaseSwimSpeed(), AuraEffect::HandleAuraModUseNormalSpeed(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), SetHealth(), SetSpeed(), and UpdateSpeed().

◆ UpdateSplineMovement()

void Unit::UpdateSplineMovement ( uint32  t_diff)
private
703{
704 if (movespline->Finalized())
705 return;
706
707 // xinef: process movementinform
708 // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated
709 SplineHandler handler(this);
710 movespline->updateState(t_diff, handler);
711 // Xinef: Spline was cleared by StopMoving, return
712 if (!movespline->Initialized())
713 {
715 return;
716 }
717
718 bool arrived = movespline->Finalized();
719
720 if (arrived)
721 {
723
724 if (movespline->HasAnimation() && IsCreature() && IsAlive())
726 }
727
728 // pussywizard: update always! not every 400ms, because movement generators need the actual position
729 //m_movesplineTimer.Update(t_diff);
730 //if (m_movesplineTimer.Passed() || arrived)
732}
AnimTier
Definition MotionMaster.h:101
uint8 GetAnimationType() const
Definition MoveSpline.h:128
void updateState(int32 difftime, UpdateHandler &handler)
Definition MoveSpline.h:100
bool HasAnimation() const
Definition MoveSpline.h:127
Definition Unit.cpp:682
void SetAnimTier(AnimTier animTier)
Definition Unit.cpp:11610

References DisableSpline(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::GetAnimationType(), Movement::MoveSpline::HasAnimation(), Movement::MoveSpline::Initialized(), IsAlive(), Object::IsCreature(), movespline, SetAnimTier(), UpdateSplinePosition(), and Movement::MoveSpline::updateState().

Referenced by Update().

◆ UpdateSplinePosition()

void Unit::UpdateSplinePosition ( )
private
735{
736 //static uint32 const positionUpdateDelay = 400;
737
738 //m_movesplineTimer.Reset(positionUpdateDelay);
740
742 {
744 pos.m_positionX = loc.x;
745 pos.m_positionY = loc.y;
746 pos.m_positionZ = loc.z;
748
749 if (TransportBase* transport = GetDirectTransport())
750 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
751 }
752
753 // Xinef: if we had spline running update orientation along with position
754 //if (HasUnitState(UNIT_STATE_CANNOT_TURN))
755 // loc.orientation = GetOrientation();
756
757 if (IsPlayer() || IsPet())
758 UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
759 else
760 ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation);
761}
void SetPosition(float x, float y, float z, float o)
Definition Creature.cpp:3374
Location ComputePosition() const
Definition MoveSpline.cpp:26
bool onTransport
Definition MoveSpline.h:130
Definition VehicleDefines.h:130
TransportBase * GetDirectTransport() const
Definition Unit.cpp:14745
Position pos
Definition Object.h:316
Definition MoveSpline.h:27
float orientation
Definition MoveSpline.h:33
float m_positionX
Definition Position.h:55
float m_positionY
Definition Position.h:56

References Movement::MoveSpline::ComputePosition(), GetDirectTransport(), IsPet(), Object::IsPlayer(), WorldObject::m_movementInfo, Position::m_positionX, Position::m_positionY, Position::m_positionZ, movespline, Movement::MoveSpline::onTransport, Movement::Location::orientation, MovementInfo::TransportInfo::pos, Position::SetOrientation(), Creature::SetPosition(), Object::ToCreature(), MovementInfo::transport, and UpdatePosition().

Referenced by StopMoving(), and UpdateSplineMovement().

◆ UpdateStatBuffMod()

void Unit::UpdateStatBuffMod ( Stats  stat)
6273{
6274 float modPos = 0.0f;
6275 float modNeg = 0.0f;
6276 float factor = 0.0f;
6277
6278 UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
6279
6280 // includes value from items and enchantments
6281 float modValue = GetFlatModifierValue(unitMod, BASE_VALUE);
6282 if (modValue > 0.f)
6283 modPos += modValue;
6284 else
6285 modNeg += modValue;
6286
6287 modPos += GetTotalAuraModifier(SPELL_AURA_MOD_STAT, [stat](AuraEffect const* aurEff) -> bool
6288 {
6289 if ((aurEff->GetMiscValue() < 0 || aurEff->GetMiscValue() == stat) && aurEff->GetAmount() > 0)
6290 return true;
6291 return false;
6292 });
6293
6294 modNeg += GetTotalAuraModifier(SPELL_AURA_MOD_STAT, [stat](AuraEffect const* aurEff) -> bool
6295 {
6296 if ((aurEff->GetMiscValue() < 0 || aurEff->GetMiscValue() == stat) && aurEff->GetAmount() < 0)
6297 return true;
6298 return false;
6299 });
6300
6301 factor = GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [stat](AuraEffect const* aurEff) -> bool
6302 {
6303 if (aurEff->GetMiscValue() == -1 || aurEff->GetMiscValue() == stat)
6304 return true;
6305 return false;
6306 });
6307
6308 factor *= GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [stat](AuraEffect const* aurEff) -> bool
6309 {
6310 if (aurEff->GetMiscValue() == -1 || aurEff->GetMiscValue() == stat)
6311 return true;
6312 return false;
6313 });
6314
6315 modPos *= factor;
6316 modNeg *= factor;
6317
6320}
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
Definition SpellAuraDefines.h:200
@ SPELL_AURA_MOD_STAT
Definition SpellAuraDefines.h:92
@ SPELL_AURA_MOD_PERCENT_STAT
Definition SpellAuraDefines.h:143

References AsUnderlyingType(), BASE_VALUE, AuraEffect::GetAmount(), GetFlatModifierValue(), AuraEffect::GetMiscValue(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), Object::SetFloatValue(), SPELL_AURA_MOD_PERCENT_STAT, SPELL_AURA_MOD_STAT, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_POSSTAT0, and UNIT_MOD_STAT_START.

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), AuraEffect::HandleAuraModStat(), and AuraEffect::HandleModTotalPercentStat().

◆ UpdateStats()

virtual bool Unit::UpdateStats ( Stats  stat)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by UpdateUnitMod().

◆ UpdateUnitMod()

void Unit::UpdateUnitMod ( UnitMods  unitMod)
11727{
11728 if (!CanModifyStats())
11729 return;
11730
11731 switch (unitMod)
11732 {
11739 break;
11740
11741 case UNIT_MOD_ARMOR:
11742 UpdateArmor();
11743 break;
11744 case UNIT_MOD_HEALTH:
11746 break;
11747
11748 case UNIT_MOD_MANA:
11749 case UNIT_MOD_RAGE:
11750 case UNIT_MOD_FOCUS:
11751 case UNIT_MOD_ENERGY:
11752 case UNIT_MOD_HAPPINESS:
11753 case UNIT_MOD_RUNE:
11756 break;
11757
11765 break;
11766
11769 break;
11772 break;
11773
11776 break;
11779 break;
11782 break;
11783
11784 default:
11785 break;
11786 }
11787}
@ UNIT_MOD_ARMOR
Definition Unit.h:166
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:173
@ UNIT_MOD_HEALTH
Definition Unit.h:158
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:174
SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:11903
Stats GetStatByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:11935
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:11964
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
virtual void UpdateArmor()=0
virtual void UpdateMaxPower(Powers power)=0
virtual bool UpdateStats(Stats stat)=0
bool CanModifyStats() const
Definition Unit.h:1112
virtual void UpdateMaxHealth()=0

References BASE_ATTACK, CanModifyStats(), GetPowerTypeByAuraGroup(), GetSpellSchoolByAuraGroup(), GetStatByAuraGroup(), OFF_ATTACK, RANGED_ATTACK, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_RUNE, UNIT_MOD_RUNIC_POWER, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_STRENGTH, UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDamagePhysical(), UpdateMaxHealth(), UpdateMaxPower(), UpdateResistances(), and UpdateStats().

Referenced by ApplyStatPctModifier(), HandleStatFlatModifier(), SetStatFlatModifier(), and SetStatPctModifier().

◆ Whisper() [1/2]

void Unit::Whisper ( std::string_view  text,
Language  language,
Player *  target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

16939{
16940 if (!target)
16941 {
16942 return;
16943 }
16944
16946 WorldPacket data;
16947 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
16948 target->SendDirectMessage(&data);
16949}
LocaleConstant
Definition Common.h:125
@ CHAT_MSG_MONSTER_WHISPER
Definition SharedDefines.h:3400
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3427
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:273
LocaleConstant GetSessionDbLocaleIndex() const
Definition WorldSession.h:647

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), and Player::SendDirectMessage().

Referenced by boss_zuramat::ExecuteEvent(), npc_commandscript::HandleNpcWhisperCommand(), spell_lich_king_whisper::HandleScript(), and Map::ScriptsProcess().

◆ Whisper() [2/2]

void Unit::Whisper ( uint32  textId,
Player *  target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

16997{
16998 if (!target)
16999 {
17000 return;
17001 }
17002
17003 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
17004 if (!bct)
17005 {
17006 LOG_ERROR("entities.unit", "Unit::Whisper: `broadcast_text` was not {} found", textId);
17007 return;
17008 }
17009
17011 WorldPacket data;
17012 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
17013 target->SendDirectMessage(&data);
17014}
Definition ObjectMgr.h:438

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, getGender(), Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, Player::SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Unit::Yell ( std::string_view  text,
Language  language,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

16929{
16930 Talk(text, CHAT_MSG_MONSTER_YELL, language, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
16931}
@ CHAT_MSG_MONSTER_YELL
Definition SharedDefines.h:3399
@ CONFIG_LISTEN_RANGE_YELL
Definition WorldConfig.h:158

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Referenced by npc_commandscript::HandleNpcYellCommand(), and Map::ScriptsProcess().

◆ Yell() [2/2]

void Unit::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

16987{
16988 Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
16989}

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Member Data Documentation

◆ _charmStartSpeedRate

float Unit::_charmStartSpeedRate[MAX_MOVE_TYPE] {}
protected
2210{};

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ _charmThreatInfo

CharmThreatMap Unit::_charmThreatInfo
protected

Referenced by RemoveCharmedBy().

◆ _displayScale

std::optional<float> Unit::_displayScale
private

scale passed with the current display, empty = native scale

Referenced by RecalculateObjectScale(), and SetDisplayId().

◆ _dualWieldMode

◆ _instantCast

bool Unit::_instantCast
protected

◆ _isCombatDisallowed

bool Unit::_isCombatDisallowed
private

◆ _isWalkingBeforeCharm

bool Unit::_isWalkingBeforeCharm
private

Are we walking before we were charmed?

Referenced by SetCharm(), and Unit().

◆ _lastDamagedTargetGuid

◆ _lastExtraAttackSpell

uint32 Unit::_lastExtraAttackSpell
private

◆ _lastLiquid

LiquidTypeEntry const* Unit::_lastLiquid
protected

◆ _oldFactionId

uint32 Unit::_oldFactionId
private

faction before charm

Referenced by GetOldFactionId(), RemoveCharmedBy(), SetCharmedBy(), and Unit().

◆ _valuesUpdateCache

ValuesUpdateCache Unit::_valuesUpdateCache
private

◆ bRequestForcedVisibilityUpdate

◆ extraAttacksTargets

std::unordered_map<ObjectGuid , uint32 > Unit::extraAttacksTargets
private

Referenced by AddExtraAttacks(), and Update().

◆ i_AI

◆ i_disabledAI

UnitAI* Unit::i_disabledAI
protected

Referenced by UpdateCharmAI().

◆ i_motionMaster

MotionMaster* Unit::i_motionMaster
protected

◆ IsAIEnabled

◆ LastCharmerGUID

ObjectGuid Unit::LastCharmerGUID

◆ m_appliedAuras

◆ m_applyResilience

bool Unit::m_applyResilience
protected

◆ m_attackers

◆ m_attacking

Unit* Unit::m_attacking
protected

◆ m_attackTimer

◆ m_auraFlatModifiersGroup

float Unit::m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END]
protected

◆ m_auraPctModifiersGroup

float Unit::m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END]
protected

◆ m_auraStateAuras

◆ m_auraUpdateSnapshot

std::vector<Aura*> Unit::m_auraUpdateSnapshot
protected

Referenced by _UpdateSpells().

◆ m_AutoRepeatFirstCast

bool Unit::m_AutoRepeatFirstCast
protected

◆ m_baseSpellCritChance

◆ m_canModifyStats

bool Unit::m_canModifyStats
protected

◆ m_charmInfo

◆ m_cleanupDone

bool Unit::m_cleanupDone
private

◆ m_combatManager

◆ m_CombatTimer

uint32 Unit::m_CombatTimer
private

◆ m_ComboPointHolders

std::unordered_set<Unit*> Unit::m_ComboPointHolders
private

◆ m_comboPoints

int8 Unit::m_comboPoints
private

◆ m_comboTarget

◆ m_Controlled

◆ m_ControlledByPlayer

◆ m_CreatedByPlayer

bool Unit::m_CreatedByPlayer

◆ m_createStats

float Unit::m_createStats[MAX_STATS]
protected

◆ m_currentSpells

◆ m_deathState

◆ m_delayed_unit_ai_notify_timer

uint16 Unit::m_delayed_unit_ai_notify_timer

Referenced by Unit(), and Update().

◆ m_delayed_unit_relocation_timer

uint16 Unit::m_delayed_unit_relocation_timer

Referenced by Unit(), Player::Update(), and Update().

◆ m_Diminishing

◆ m_duringRemoveFromWorld

bool Unit::m_duringRemoveFromWorld
private

◆ m_dynObj

◆ m_extraAttacks

uint32 Unit::m_extraAttacks

◆ m_followingMe

std::unordered_set<AbstractFollower*> Unit::m_followingMe
private

◆ m_gameObj

◆ m_inPreDeathAuraTick

bool Unit::m_inPreDeathAuraTick {false}
protected
2176{false};

Referenced by IsInPreDeathAuraTick(), and SetInPreDeathAuraTick().

◆ m_interruptableAuras

◆ m_interruptMask

◆ m_last_notify_mstime

uint32 Unit::m_last_notify_mstime

Referenced by Unit().

◆ m_last_notify_position

◆ m_lastDeathTime

Milliseconds Unit::m_lastDeathTime {Milliseconds::min()}
protected
2175{Milliseconds::min()};

Referenced by GetLastDeathTime(), and setDeathState().

◆ m_lastManaUse

uint32 Unit::m_lastManaUse
private

◆ m_lastSanctuaryTime

uint32 Unit::m_lastSanctuaryTime

◆ m_modAttackSpeedPct

◆ m_modAuras

◆ m_modMeleeHitChance

◆ m_modRangedHitChance

◆ m_modSpellHitChance

◆ m_movedByPlayer

◆ m_ObjectSlot

◆ m_ownedAuras

◆ m_petAuras

PetAuraSet Unit::m_petAuras

◆ m_procDeep

int32 Unit::m_procDeep
protected

Referenced by CanProc(), and SetCantProc().

◆ m_race

uint8 Unit::m_race
protected

◆ m_reactiveTimer

uint32 Unit::m_reactiveTimer[MAX_REACTIVE]
protected

◆ m_realRace

uint8 Unit::m_realRace
protected

◆ m_regenTimer

◆ m_removedAuras

AuraList Unit::m_removedAuras
protected

◆ m_removedAurasCount

◆ m_scAuras

AuraList Unit::m_scAuras
protected

◆ m_sharedVision

◆ m_speed_rate

float Unit::m_speed_rate[MAX_MOVE_TYPE]
protected

◆ m_spellImmune

◆ m_state

uint32 Unit::m_state
private

◆ m_SummonSlot

◆ m_threatManager

◆ m_transform

uint32 Unit::m_transform
protected

Referenced by getTransForm(), setTransForm(), and Unit().

◆ m_unitTypeMask

◆ m_vehicle

◆ m_vehicleKit

Vehicle* Unit::m_vehicleKit
protected

◆ m_visibleAuras

◆ m_weaponDamage

◆ movespline

◆ NeedChangeAI

bool Unit::NeedChangeAI

◆ SafeUnitPointerSet

std::set<SafeUnitPointer*> Unit::SafeUnitPointerSet

The documentation for this class was generated from the following files: