Some misc cleansup.

This commit is contained in:
hondacrx
2023-10-06 17:33:20 -04:00
parent 85f37f6edf
commit ccb5341c21
13 changed files with 30 additions and 42 deletions
+3 -3
View File
@@ -3178,7 +3178,7 @@ namespace Game.Entities
return false;
}
if (focusSpell)
if (focusSpell != null)
return focusSpell == _spellFocusInfo.Spell;
else
return _spellFocusInfo.Spell != null || _spellFocusInfo.Delay != 0;
@@ -3186,11 +3186,11 @@ namespace Game.Entities
public void ReleaseSpellFocus(Spell focusSpell = null, bool withDelay = true)
{
if (!_spellFocusInfo.Spell)
if (_spellFocusInfo.Spell == null)
return;
// focused to something else
if (focusSpell && focusSpell != _spellFocusInfo.Spell)
if (focusSpell != null && focusSpell != _spellFocusInfo.Spell)
return;
if (_spellFocusInfo.Spell.GetSpellInfo().HasAttribute(SpellAttr5.AiDoesntFaceTarget))
+1 -1
View File
@@ -2453,7 +2453,7 @@ namespace Game.Entities
if (spell.m_CastItem == null && info.HasAttribute(SpellAttr2.RetainItemCast))
{
if (args.TriggeringSpell)
if (args.TriggeringSpell != null)
spell.m_CastItem = args.TriggeringSpell.m_CastItem;
else if (args.TriggeringAura != null && !args.TriggeringAura.GetBase().GetCastItemGUID().IsEmpty())
{
+3 -3
View File
@@ -1000,7 +1000,7 @@ namespace Game.Entities
return;
// Call not from spell cast, send cooldown event for item spells if no in combat
if (!spell)
if (spell == null)
{
// spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions)
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(m_lastPotionId);
@@ -2946,7 +2946,7 @@ namespace Game.Entities
pct = 1.0f;
// Drop charges for triggering spells instead of triggered ones
if (m_spellModTakingSpell)
if (m_spellModTakingSpell != null)
spell = m_spellModTakingSpell;
switch (op)
@@ -3114,7 +3114,7 @@ namespace Game.Entities
return false;
// First time this aura applies a mod to us and is out of charges
if (spell && mod.ownerAura.IsUsingCharges() && mod.ownerAura.GetCharges() == 0 && !spell.m_appliedMods.Contains(mod.ownerAura))
if (spell != null && mod.ownerAura.IsUsingCharges() && mod.ownerAura.GetCharges() == 0 && !spell.m_appliedMods.Contains(mod.ownerAura))
return false;
switch (mod.op)
+2 -2
View File
@@ -198,7 +198,7 @@ namespace Game.Entities
public SpellInfo GetSpellInfo()
{
if (_spell)
if (_spell != null)
return _spell.GetSpellInfo();
if (_damageInfo != null)
return _damageInfo.GetSpellInfo();
@@ -209,7 +209,7 @@ namespace Game.Entities
}
public SpellSchoolMask GetSchoolMask()
{
if (_spell)
if (_spell != null)
return _spell.GetSpellInfo().GetSchoolMask();
if (_damageInfo != null)
return _damageInfo.GetSchoolMask();
+9 -10
View File
@@ -733,7 +733,7 @@ namespace Game.Entities
}
// call script handlers
if (spell)
if (spell != null)
spell.CallScriptCalcCritChanceHandlers(this, ref crit_chance);
else
aurEff.GetBase().CallScriptEffectCalcCritChanceHandlers(aurEff, aurEff.GetBase().GetApplicationOfTarget(GetGUID()), this, ref crit_chance);
@@ -1620,7 +1620,7 @@ namespace Game.Entities
Player modOwner = GetSpellModOwner();
if (modOwner)
{
if (modOwner != this && spell)
if (modOwner != this && spell != null)
{
List<AuraApplication> modAuras = new();
foreach (var itr in modOwner.GetAppliedAuras())
@@ -1648,7 +1648,7 @@ namespace Game.Entities
void TriggerAurasProcOnEvent(ProcEventInfo eventInfo, List<Tuple<uint, AuraApplication>> aurasTriggeringProc)
{
Spell triggeringSpell = eventInfo.GetProcSpell();
bool disableProcs = triggeringSpell && triggeringSpell.IsProcDisabled();
bool disableProcs = triggeringSpell != null && triggeringSpell.IsProcDisabled();
int oldProcChainLength = m_procChainLength;
@@ -1746,7 +1746,7 @@ namespace Game.Entities
}
case CurrentSpellTypes.AutoRepeat:
{
if (GetCurrentSpell(CSpellType) && GetCurrentSpell(CSpellType).GetState() == SpellState.Idle)
if (GetCurrentSpell(CSpellType) != null && GetCurrentSpell(CSpellType).GetState() == SpellState.Idle)
GetCurrentSpell(CSpellType).SetState(SpellState.Finished);
// only Auto Shoot does not break anything
@@ -1780,9 +1780,7 @@ namespace Game.Entities
// generic spells are cast when they are not finished and not delayed
var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic);
if (currentSpell &&
(currentSpell.GetState() != SpellState.Finished) &&
(withDelayed || currentSpell.GetState() != SpellState.Delayed))
if (currentSpell != null && (currentSpell.GetState() != SpellState.Finished) && (withDelayed || currentSpell.GetState() != SpellState.Delayed))
{
if (!skipInstant || currentSpell.GetCastTime() != 0)
{
@@ -1790,17 +1788,18 @@ namespace Game.Entities
return true;
}
}
currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled);
// channeled spells may be delayed, but they are still considered cast
if (!skipChanneled && currentSpell &&
(currentSpell.GetState() != SpellState.Finished))
if (!skipChanneled && currentSpell != null && (currentSpell.GetState() != SpellState.Finished))
{
if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.DoNotResetCombatTimers))
return true;
}
currentSpell = GetCurrentSpell(CurrentSpellTypes.AutoRepeat);
// autorepeat spells may be finished or delayed, but they are still considered cast
if (!skipAutorepeat && currentSpell)
if (!skipAutorepeat && currentSpell != null)
return true;
return false;