mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
refactor(Core): replace NULL with nullptr (#4593)
This commit is contained in:
@@ -1224,9 +1224,9 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
|
||||
if (CanApplyResilience())
|
||||
{
|
||||
if (attackType != RANGED_ATTACK)
|
||||
Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE);
|
||||
Unit::ApplyResilience(victim, nullptr, &damage, crit, CR_CRIT_TAKEN_MELEE);
|
||||
else
|
||||
Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED);
|
||||
Unit::ApplyResilience(victim, nullptr, &damage, crit, CR_CRIT_TAKEN_RANGED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1242,7 +1242,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
|
||||
}
|
||||
|
||||
if (CanApplyResilience())
|
||||
Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL);
|
||||
Unit::ApplyResilience(victim, nullptr, &damage, crit, CR_CRIT_TAKEN_SPELL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1354,7 +1354,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
|
||||
// Calculate armor reduction
|
||||
if (IsDamageReducedByArmor((SpellSchoolMask)(damageInfo->damageSchoolMask)))
|
||||
{
|
||||
damageInfo->damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, NULL, 0, damageInfo->attackType);
|
||||
damageInfo->damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
|
||||
damageInfo->cleanDamage += damage - damageInfo->damage;
|
||||
}
|
||||
else
|
||||
@@ -1473,7 +1473,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
|
||||
|
||||
// attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
|
||||
if (CanApplyResilience())
|
||||
Unit::ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
|
||||
Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
|
||||
|
||||
resilienceReduction = damageInfo->damage - resilienceReduction;
|
||||
damageInfo->damage -= resilienceReduction;
|
||||
@@ -1548,7 +1548,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||
|
||||
// Call default DealDamage
|
||||
CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, damageInfo->attackType, damageInfo->hitOutCome);
|
||||
Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damageSchoolMask), NULL, durabilityLoss);
|
||||
Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damageSchoolMask), nullptr, durabilityLoss);
|
||||
|
||||
// If this is a creature and it attacks from behind it has a probability to daze it's victim
|
||||
if (damageInfo->damage && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
|
||||
@@ -3214,9 +3214,9 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victi
|
||||
|
||||
// reduce crit chance from Rating for players
|
||||
if (attackType != RANGED_ATTACK)
|
||||
Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_MELEE);
|
||||
Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
|
||||
else
|
||||
Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_RANGED);
|
||||
Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
|
||||
|
||||
// Apply crit chance from defence skill
|
||||
crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f;
|
||||
@@ -3398,7 +3398,7 @@ void Unit::_UpdateAutoRepeatSpell()
|
||||
|
||||
void Unit::SetCurrentCastedSpell(Spell* pSpell)
|
||||
{
|
||||
ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
|
||||
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
|
||||
|
||||
@@ -3936,7 +3936,7 @@ void Unit::DeMorph()
|
||||
SetDisplayId(GetNativeDisplayId());
|
||||
}
|
||||
|
||||
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool periodicReset /*= false*/)
|
||||
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, uint64 casterGUID /*= 0*/, bool periodicReset /*= false*/)
|
||||
{
|
||||
ASSERT(casterGUID || caster);
|
||||
if (!casterGUID)
|
||||
@@ -4570,7 +4570,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
|
||||
// Xinef: if stealer has same aura
|
||||
Aura* curAura = stealer->GetAura(aura->GetId());
|
||||
if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
|
||||
if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID()))
|
||||
if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, aura->GetCasterGUID()))
|
||||
{
|
||||
// created aura must not be single target aura,, so stealer won't loose it on recast
|
||||
if (newAura->IsSingleTarget())
|
||||
@@ -5657,7 +5657,7 @@ void Unit::AddGameObject(GameObject* gameObj)
|
||||
// Need disable spell use for owner
|
||||
if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
|
||||
ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, NULL, true);
|
||||
ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5972,7 +5972,7 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
|
||||
SendAttackStateUpdate(&dmgInfo);
|
||||
}
|
||||
|
||||
//victim may be NULL
|
||||
//victim may be nullptr
|
||||
bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
|
||||
{
|
||||
SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
|
||||
@@ -6726,7 +6726,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
int32 total = CalculatePct(int32(damage), triggerAmount);
|
||||
int32 team = total / 5;
|
||||
int32 self = total - team;
|
||||
CastCustomSpell(this, 15290, &team, &self, NULL, true, castItem, triggeredByAura);
|
||||
CastCustomSpell(this, 15290, &team, &self, nullptr, true, castItem, triggeredByAura);
|
||||
return true; // no hidden cooldown
|
||||
}
|
||||
// Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
|
||||
@@ -7404,7 +7404,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
if (!victim || !victim->IsAlive())
|
||||
return false;
|
||||
|
||||
CastSpell(this, 71432, true, NULL, triggeredByAura);
|
||||
CastSpell(this, 71432, true, nullptr, triggeredByAura);
|
||||
|
||||
Aura const* dummy = GetAura(71432);
|
||||
if (!dummy || dummy->GetStackAmount() < (dummySpell->Id == 71406 ? 8 : 7))
|
||||
@@ -8104,7 +8104,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
continue;
|
||||
|
||||
basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f);
|
||||
CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, NULL, triggeredByAura);
|
||||
CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, nullptr, triggeredByAura);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -8266,7 +8266,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
|
||||
return false;
|
||||
|
||||
int32 bp0 = int32(CalculatePct(GetMaxPower(POWER_MANA), spInfo->Effects[0].CalcValue()));
|
||||
CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
|
||||
CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, nullptr, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8707,14 +8707,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown);
|
||||
}
|
||||
|
||||
CastSpell(this, stack_spell_id, true, NULL, triggeredByAura);
|
||||
CastSpell(this, stack_spell_id, true, nullptr, triggeredByAura);
|
||||
|
||||
Aura* dummy = GetAura(stack_spell_id);
|
||||
if (!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(stack_spell_id);
|
||||
CastSpell(victim, trigger_spell_id, true, NULL, triggeredByAura);
|
||||
CastSpell(victim, trigger_spell_id, true, nullptr, triggeredByAura);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
@@ -9158,7 +9158,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0))
|
||||
{
|
||||
basepoints0 = int32((aurEff->GetAmount() * owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC)) + 100.0f) / 100.0f); // TODO: Is it right?
|
||||
CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura);
|
||||
CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, nullptr, true, castItem, triggeredByAura);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -9316,7 +9316,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
}
|
||||
|
||||
if(basepoints0)
|
||||
CastCustomSpell(target, triggerEntry->Id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
|
||||
CastCustomSpell(target, triggerEntry->Id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
|
||||
else
|
||||
CastSpell(target, triggerEntry->Id, true, castItem, triggeredByAura);
|
||||
|
||||
@@ -10170,7 +10170,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||
|
||||
if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
|
||||
ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, NULL, true);
|
||||
ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -11417,7 +11417,7 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
|
||||
crit_chance += GetMaxPositiveAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
|
||||
}
|
||||
|
||||
Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_SPELL);
|
||||
Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
|
||||
}
|
||||
// scripted (increase crit chance ... against ... target by x%
|
||||
if (caster)
|
||||
@@ -11560,10 +11560,10 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
|
||||
if (attackType != RANGED_ATTACK)
|
||||
{
|
||||
// xinef: little hack, crit chance dont require caster to calculate, pass victim
|
||||
Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_MELEE);
|
||||
Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
|
||||
}
|
||||
else
|
||||
Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_RANGED);
|
||||
Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
|
||||
|
||||
// Apply crit chance from defence skill
|
||||
if (caster)
|
||||
@@ -15465,7 +15465,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
||||
|
||||
DamageInfo damageInfo = DamageInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL, SPELL_DIRECT_DAMAGE);
|
||||
HealInfo healInfo = HealInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL);
|
||||
ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, NULL, &damageInfo, &healInfo, procAura);
|
||||
ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, nullptr, &damageInfo, &healInfo, procAura);
|
||||
|
||||
ProcTriggeredList procTriggered;
|
||||
// Fill procTriggered list
|
||||
@@ -15522,7 +15522,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
||||
// Skip this auras
|
||||
if (isNonTriggerAura[aurEff->GetAuraType()])
|
||||
continue;
|
||||
// If not trigger by default and spellProcEvent == NULL - skip
|
||||
// If not trigger by default and spellProcEvent == nullptr - skip
|
||||
if (!isTriggerAura[aurEff->GetAuraType()] && triggerData.spellProcEvent == nullptr)
|
||||
continue;
|
||||
// Some spells must always trigger
|
||||
@@ -15808,7 +15808,7 @@ void Unit::GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTrigge
|
||||
void Unit::TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo)
|
||||
{
|
||||
DamageInfo dmgInfo = DamageInfo(damageInfo);
|
||||
TriggerAurasProcOnEvent(nullptr, NULL, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, NULL, &dmgInfo, nullptr);
|
||||
TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, nullptr, &dmgInfo, nullptr);
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -16706,7 +16706,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
|
||||
if (Unit* target = nearMembers.front())
|
||||
{
|
||||
CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
|
||||
CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, NULL, triggeredByAura, caster_guid);
|
||||
CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
|
||||
if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
|
||||
aura->SetCharges(jumps);
|
||||
}
|
||||
@@ -16758,14 +16758,14 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
|
||||
float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
|
||||
if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
|
||||
{
|
||||
CastSpell(target, spellProto, true, NULL, triggeredByAura, caster_guid);
|
||||
CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
|
||||
if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
|
||||
aura->SetCharges(jumps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CastSpell(this, damageSpellId, true, NULL, triggeredByAura, caster_guid);
|
||||
CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -16938,7 +16938,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
|
||||
victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
|
||||
|
||||
// FORM_SPIRITOFREDEMPTION and related auras
|
||||
victim->CastSpell(victim, 27827, true, NULL, aurEff);
|
||||
victim->CastSpell(victim, 27827, true, nullptr, aurEff);
|
||||
spiritOfRedemption = true;
|
||||
}
|
||||
}
|
||||
@@ -17336,7 +17336,7 @@ void Unit::SetFeared(bool apply)
|
||||
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
|
||||
if (!caster)
|
||||
caster = getAttackerForHelper();
|
||||
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster == NULL processed in MoveFleeing
|
||||
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster == nullptr processed in MoveFleeing
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -18599,7 +18599,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
|
||||
bp0[j] = spellEntry->Effects[j].BasePoints;
|
||||
|
||||
bp0[i] = seatId;
|
||||
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, NULL, origCasterGUID);
|
||||
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user