AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit.cpp File Reference
#include "Unit.h"
#include "AccountMgr.h"
#include "ArenaSpectator.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "CellImpl.h"
#include "CharacterCache.h"
#include "CharmInfo.h"
#include "Chat.h"
#include "ChatPackets.h"
#include "ChatTextBuilder.h"
#include "Common.h"
#include "ConditionMgr.h"
#include "Creature.h"
#include "CreatureAIImpl.h"
#include "CreatureGroups.h"
#include "DisableMgr.h"
#include "DynamicVisibility.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Log.h"
#include "MapMgr.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "MovementGenerator.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "PassiveAI.h"
#include "Pet.h"
#include "PetAI.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "TargetedMovementGenerator.h"
#include "TemporarySummon.h"
#include "Tokenize.h"
#include "Totem.h"
#include "TotemAI.h"
#include "Transport.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.h"
#include <cmath>

Go to the source code of this file.

Classes

class  SplineHandler
 
class  spellIdImmunityPredicate
 
struct  ProcTriggeredData
 
class  AuraMunchingQueue
 

Typedefs

typedef std::list< ProcTriggeredDataProcTriggeredList
 

Functions

static bool InitTriggerAuraData ()
 
void createProcFlags (SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
 
uint32 createProcExtendMask (SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
 

Variables

float baseMoveSpeed [MAX_MOVE_TYPE]
 
float playerBaseMoveSpeed [MAX_MOVE_TYPE]
 
static bool isTriggerAura [TOTAL_AURAS]
 
static bool isNonTriggerAura [TOTAL_AURAS]
 
static bool isAlwaysTriggeredAura [TOTAL_AURAS]
 
static bool procPrepared = InitTriggerAuraData()
 

Typedef Documentation

◆ ProcTriggeredList

typedef std::list< ProcTriggeredData > ProcTriggeredList

Function Documentation

◆ createProcExtendMask()

uint32 createProcExtendMask ( SpellNonMeleeDamage damageInfo,
SpellMissInfo  missCondition 
)
15960{
15961 uint32 procEx = PROC_EX_NONE;
15962 // Check victim state
15963 if (missCondition != SPELL_MISS_NONE)
15964 switch (missCondition)
15965 {
15966 case SPELL_MISS_MISS:
15967 procEx |= PROC_EX_MISS;
15968 break;
15969 case SPELL_MISS_RESIST:
15970 procEx |= PROC_EX_RESIST;
15971 break;
15972 case SPELL_MISS_DODGE:
15973 procEx |= PROC_EX_DODGE;
15974 break;
15975 case SPELL_MISS_PARRY:
15976 procEx |= PROC_EX_PARRY;
15977 break;
15978 case SPELL_MISS_BLOCK:
15979 procEx |= PROC_EX_BLOCK;
15980 break;
15981 case SPELL_MISS_EVADE:
15982 procEx |= PROC_EX_EVADE;
15983 break;
15984 case SPELL_MISS_IMMUNE:
15985 procEx |= PROC_EX_IMMUNE;
15986 break;
15987 case SPELL_MISS_IMMUNE2:
15988 procEx |= PROC_EX_IMMUNE;
15989 break;
15990 case SPELL_MISS_DEFLECT:
15991 procEx |= PROC_EX_DEFLECT;
15992 break;
15993 case SPELL_MISS_ABSORB:
15994 procEx |= PROC_EX_ABSORB;
15995 break;
15996 case SPELL_MISS_REFLECT:
15997 procEx |= PROC_EX_REFLECT;
15998 break;
15999 default:
16000 break;
16001 }
16002 else
16003 {
16004 // On block
16005 if (damageInfo->blocked)
16006 procEx |= PROC_EX_BLOCK;
16007 // On absorb
16008 if (damageInfo->absorb)
16009 procEx |= PROC_EX_ABSORB;
16010 // On crit
16011 if (damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT)
16012 procEx |= PROC_EX_CRITICAL_HIT;
16013 else
16014 procEx |= PROC_EX_NORMAL_HIT;
16015 }
16016 return procEx;
16017}
std::uint32_t uint32
Definition: Define.h:107
@ PROC_EX_NONE
Definition: SpellMgr.h:193
@ PROC_EX_DODGE
Definition: SpellMgr.h:198
@ PROC_EX_DEFLECT
Definition: SpellMgr.h:203
@ PROC_EX_BLOCK
Definition: SpellMgr.h:200
@ PROC_EX_CRITICAL_HIT
Definition: SpellMgr.h:195
@ PROC_EX_NORMAL_HIT
Definition: SpellMgr.h:194
@ PROC_EX_IMMUNE
Definition: SpellMgr.h:202
@ PROC_EX_MISS
Definition: SpellMgr.h:196
@ PROC_EX_RESIST
Definition: SpellMgr.h:197
@ PROC_EX_REFLECT
Definition: SpellMgr.h:205
@ PROC_EX_ABSORB
Definition: SpellMgr.h:204
@ PROC_EX_PARRY
Definition: SpellMgr.h:199
@ PROC_EX_EVADE
Definition: SpellMgr.h:201
@ SPELL_HIT_TYPE_CRIT
Definition: SharedDefines.h:1536
@ SPELL_MISS_PARRY
Definition: SharedDefines.h:1523
@ SPELL_MISS_IMMUNE
Definition: SharedDefines.h:1526
@ SPELL_MISS_ABSORB
Definition: SharedDefines.h:1529
@ SPELL_MISS_DODGE
Definition: SharedDefines.h:1522
@ SPELL_MISS_IMMUNE2
Definition: SharedDefines.h:1527
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1519
@ SPELL_MISS_RESIST
Definition: SharedDefines.h:1521
@ SPELL_MISS_MISS
Definition: SharedDefines.h:1520
@ SPELL_MISS_EVADE
Definition: SharedDefines.h:1525
@ SPELL_MISS_REFLECT
Definition: SharedDefines.h:1530
@ SPELL_MISS_BLOCK
Definition: SharedDefines.h:1524
@ SPELL_MISS_DEFLECT
Definition: SharedDefines.h:1528
uint32 HitInfo
Definition: Unit.h:506
uint32 absorb
Definition: Unit.h:501
uint32 blocked
Definition: Unit.h:505

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::HitInfo, PROC_EX_ABSORB, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DEFLECT, PROC_EX_DODGE, PROC_EX_EVADE, PROC_EX_IMMUNE, PROC_EX_MISS, PROC_EX_NONE, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_REFLECT, PROC_EX_RESIST, SPELL_HIT_TYPE_CRIT, SPELL_MISS_ABSORB, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_IMMUNE2, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_REFLECT, and SPELL_MISS_RESIST.

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

◆ createProcFlags()

void createProcFlags ( SpellInfo const *  spellInfo,
WeaponAttackType  attackType,
bool  positive,
uint32 procAttacker,
uint32 procVictim 
)
15886{
15887 if (spellInfo)
15888 {
15889 switch (spellInfo->DmgClass)
15890 {
15892 if (positive)
15893 {
15896 }
15897 else
15898 {
15901 }
15902 break;
15904 if (positive)
15905 {
15908 }
15909 else
15910 {
15913 }
15914 break;
15917 if (attackType == OFF_ATTACK)
15918 procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK;
15919 else
15920 procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK;
15922 break;
15924 // Auto attack
15925 if (spellInfo->HasAttribute(SPELL_ATTR2_AUTO_REPEAT))
15926 {
15927 procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK;
15929 }
15930 else // Ranged spell attack
15931 {
15934 }
15935 break;
15936 default:
15937 if (spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON &&
15938 spellInfo->EquippedItemSubClassMask & (1 << ITEM_SUBCLASS_WEAPON_WAND)
15939 && spellInfo->HasAttribute(SPELL_ATTR2_AUTO_REPEAT)) // Wands auto attack
15940 {
15941 procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK;
15943 }
15944 break;
15945 }
15946 }
15947 else if (attackType == BASE_ATTACK)
15948 {
15951 }
15952 else if (attackType == OFF_ATTACK)
15953 {
15956 }
15957}
@ OFF_ATTACK
Definition: Unit.h:210
@ BASE_ATTACK
Definition: Unit.h:209
@ ITEM_SUBCLASS_WEAPON_WAND
Definition: ItemTemplate.h:363
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:293
@ PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS
Definition: SpellMgr.h:119
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:128
@ PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
Definition: SpellMgr.h:117
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:110
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition: SpellMgr.h:122
@ PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS
Definition: SpellMgr.h:113
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
Definition: SpellMgr.h:132
@ PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
Definition: SpellMgr.h:120
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition: SpellMgr.h:140
@ PROC_FLAG_DONE_RANGED_AUTO_ATTACK
Definition: SpellMgr.h:116
@ PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
Definition: SpellMgr.h:126
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
Definition: SpellMgr.h:125
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:129
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:111
@ PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS
Definition: SpellMgr.h:123
@ PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
Definition: SpellMgr.h:114
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition: SpellMgr.h:141
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
Definition: SpellMgr.h:131
@ SPELL_ATTR2_AUTO_REPEAT
Definition: SharedDefines.h:461
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1548
@ SPELL_DAMAGE_CLASS_MAGIC
Definition: SharedDefines.h:1546
@ SPELL_DAMAGE_CLASS_NONE
Definition: SharedDefines.h:1545
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:1547

References BASE_ATTACK, SpellInfo::DmgClass, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, SpellInfo::HasAttribute(), ITEM_CLASS_WEAPON, ITEM_SUBCLASS_WEAPON_WAND, OFF_ATTACK, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_RANGED_AUTO_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS, PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG, PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS, PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS, SPELL_ATTR2_AUTO_REPEAT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, and SPELL_DAMAGE_CLASS_RANGED.

Referenced by Unit::CalcAbsorbResist().

◆ InitTriggerAuraData()

bool InitTriggerAuraData ( )
static
15826{
15827 for (uint16 i = 0; i < TOTAL_AURAS; ++i)
15828 {
15829 isTriggerAura[i] = false;
15830 isNonTriggerAura[i] = false;
15831 isAlwaysTriggeredAura[i] = false;
15832 }
15836 isTriggerAura[SPELL_AURA_MOD_STUN] = true; // Aura does not have charges but needs to be removed on trigger
15841 isTriggerAura[SPELL_AURA_MOD_FEAR] = true; // Aura does not have charges but needs to be removed on trigger
15849 isTriggerAura[SPELL_AURA_SCHOOL_ABSORB] = true; // Savage Defense untested
15869
15872
15881
15882 return true;
15883}
std::uint16_t uint16
Definition: Define.h:108
static bool isAlwaysTriggeredAura[TOTAL_AURAS]
Definition: Unit.cpp:106
static bool isNonTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:104
static bool isTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:102
@ SPELL_AURA_MOD_ATTACK_POWER
Definition: SpellAuraDefines.h:162
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition: SpellAuraDefines.h:247
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition: SpellAuraDefines.h:325
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition: SpellAuraDefines.h:288
@ SPELL_AURA_MOD_THREAT
Definition: SpellAuraDefines.h:73
@ TOTAL_AURAS
Definition: SpellAuraDefines.h:380
@ SPELL_AURA_MOD_RESISTANCE
Definition: SpellAuraDefines.h:85
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:190
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ SPELL_AURA_MOD_FEAR
Definition: SpellAuraDefines.h:70
@ SPELL_AURA_MOD_POWER_REGEN
Definition: SpellAuraDefines.h:148
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition: SpellAuraDefines.h:174
@ SPELL_AURA_REFLECT_SPELLS
Definition: SpellAuraDefines.h:91
@ SPELL_AURA_MOD_MELEE_HASTE
Definition: SpellAuraDefines.h:201
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:120
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:294
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition: SpellAuraDefines.h:150
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition: SpellAuraDefines.h:135
@ SPELL_AURA_MOD_ROOT
Definition: SpellAuraDefines.h:89
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition: SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition: SpellAuraDefines.h:140
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition: SpellAuraDefines.h:286
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:77
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
@ SPELL_AURA_SCHOOL_ABSORB
Definition: SpellAuraDefines.h:132
@ SPELL_AURA_REDUCE_PUSHBACK
Definition: SpellAuraDefines.h:212
@ SPELL_AURA_SPELL_MAGNET
Definition: SpellAuraDefines.h:159
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition: SpellAuraDefines.h:106
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition: SpellAuraDefines.h:334
@ SPELL_AURA_DAMAGE_IMMUNITY
Definition: SpellAuraDefines.h:103
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition: SpellAuraDefines.h:76
@ SPELL_AURA_MOD_CONFUSE
Definition: SpellAuraDefines.h:68
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition: SpellAuraDefines.h:137
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition: SpellAuraDefines.h:180
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition: SpellAuraDefines.h:175
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:128
@ SPELL_AURA_MOD_STUN
Definition: SpellAuraDefines.h:75

References isAlwaysTriggeredAura, isNonTriggerAura, isTriggerAura, SPELL_AURA_ABILITY_IGNORE_AURASTATE, SPELL_AURA_ADD_CASTER_HIT_TRIGGER, SPELL_AURA_DAMAGE_IMMUNITY, SPELL_AURA_DUMMY, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_ATTACK_POWER, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_MECHANIC_RESISTANCE, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_MOD_POWER_COST_SCHOOL, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_RESISTANCE, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_STEALTH, SPELL_AURA_MOD_STUN, SPELL_AURA_MOD_THREAT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_REDUCE_PUSHBACK, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPELL_MAGNET, SPELL_AURA_TRANSFORM, and TOTAL_AURAS.

Variable Documentation

◆ baseMoveSpeed

float baseMoveSpeed[MAX_MOVE_TYPE]
Initial value:
=
{
2.5f,
7.0f,
4.5f,
4.722222f,
2.5f,
3.141594f,
7.0f,
4.5f,
3.14f
}

Referenced by Unit::GetSpeed(), World::LoadConfigSettings(), and Unit::UpdateSpeed().

◆ isAlwaysTriggeredAura

bool isAlwaysTriggeredAura[TOTAL_AURAS]
static

Referenced by InitTriggerAuraData().

◆ isNonTriggerAura

bool isNonTriggerAura[TOTAL_AURAS]
static

◆ isTriggerAura

bool isTriggerAura[TOTAL_AURAS]
static

◆ playerBaseMoveSpeed

float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Initial value:
=
{
2.5f,
7.0f,
4.5f,
4.722222f,
2.5f,
3.141594f,
7.0f,
4.5f,
3.14f
}

Referenced by Unit::GetSpeed(), World::LoadConfigSettings(), and Unit::UpdateSpeed().

◆ procPrepared

bool procPrepared = InitTriggerAuraData()
static