Core/Spell: move attribute helpers to spellInfo
This commit is contained in:
@@ -2573,7 +2573,7 @@ namespace Game.Spells
|
||||
|
||||
if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.HasFlag(UnitFields.Flags, UnitFlags.PlayerControlled)) // _UNIT actually means creature. for some reason.
|
||||
{
|
||||
if (!(IsNextMeleeSwingSpell() || IsAutoRepeat() || _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreSetFacing)))
|
||||
if (!(m_spellInfo.IsNextMeleeSwingSpell() || IsAutoRepeat() || _triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreSetFacing)))
|
||||
{
|
||||
if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
|
||||
m_caster.ToCreature().FocusTarget(this, m_targets.GetObjectTarget());
|
||||
@@ -2589,8 +2589,8 @@ namespace Game.Spells
|
||||
if (((m_spellInfo.IsChanneled() || m_casttime != 0) && m_caster.IsTypeId(TypeId.Player) && !(m_caster.IsCharmed() && m_caster.GetCharmerGUID().IsCreature()) && m_caster.isMoving() &&
|
||||
m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)))
|
||||
{
|
||||
// 1. Is a channel spell, 2. Has no casttime, 3. And has flag to allow movement during channel
|
||||
if (!(m_spellInfo.IsChanneled() && m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr5.CanChannelWhenMoving)))
|
||||
// 1. Has casttime, 2. Or doesn't have flag to allow movement during channel
|
||||
if (m_casttime != 0 || !m_spellInfo.IsMoveAllowedChannel())
|
||||
{
|
||||
SendCastResult(SpellCastResult.Moving);
|
||||
finish(false);
|
||||
@@ -3172,7 +3172,7 @@ namespace Game.Spells
|
||||
!m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
|
||||
{
|
||||
// don't cancel for melee, autorepeat, triggered and instant spells
|
||||
if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !IsTriggered() && !(IsChannelActive() && m_spellInfo.HasAttribute(SpellAttr5.CanChannelWhenMoving)))
|
||||
if (!m_spellInfo.IsNextMeleeSwingSpell() && !IsAutoRepeat() && !IsTriggered() && !(IsChannelActive() && m_spellInfo.IsMoveAllowedChannel()))
|
||||
{
|
||||
// if charmed by creature, trust the AI not to cheat and allow the cast to proceed
|
||||
// @todo this is a hack, "creature" movesplines don't differentiate turning/moving right now
|
||||
@@ -3194,7 +3194,7 @@ namespace Game.Spells
|
||||
m_timer -= (int)difftime;
|
||||
}
|
||||
|
||||
if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat())
|
||||
if (m_timer == 0 && !m_spellInfo.IsNextMeleeSwingSpell() && !IsAutoRepeat())
|
||||
// don't CheckCast for instant spells - done in spell.prepare, skip duplicate checks, needed for range checks for example
|
||||
cast(m_casttime == 0);
|
||||
break;
|
||||
@@ -5643,7 +5643,7 @@ namespace Game.Spells
|
||||
float minRange = 0.0f;
|
||||
float maxRange = 0.0f;
|
||||
|
||||
if (strict && IsNextMeleeSwingSpell())
|
||||
if (strict && m_spellInfo.IsNextMeleeSwingSpell())
|
||||
{
|
||||
maxRange = 100.0f;
|
||||
return Tuple.Create(minRange, maxRange);
|
||||
@@ -6333,14 +6333,14 @@ namespace Game.Spells
|
||||
|
||||
public CurrentSpellTypes GetCurrentContainer()
|
||||
{
|
||||
if (IsNextMeleeSwingSpell())
|
||||
if (m_spellInfo.IsNextMeleeSwingSpell())
|
||||
return CurrentSpellTypes.Melee;
|
||||
else if (IsAutoRepeat())
|
||||
return CurrentSpellTypes.AutoRepeat;
|
||||
else if (m_spellInfo.IsChanneled())
|
||||
return CurrentSpellTypes.Channeled;
|
||||
else
|
||||
return CurrentSpellTypes.Generic;
|
||||
|
||||
return CurrentSpellTypes.Generic;
|
||||
}
|
||||
|
||||
bool CheckEffectTarget(Unit target, SpellEffectInfo effect, Position losPosition)
|
||||
@@ -6423,11 +6423,6 @@ namespace Game.Spells
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsNextMeleeSwingSpell()
|
||||
{
|
||||
return m_spellInfo.HasAttribute(SpellAttr0.OnNextSwing | SpellAttr0.OnNextSwing2);
|
||||
}
|
||||
|
||||
bool IsAutoActionResetSpell()
|
||||
{
|
||||
// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK . SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
|
||||
|
||||
@@ -571,11 +571,21 @@ namespace Game.Spells
|
||||
return HasAttribute(SpellAttr1.Channeled1 | SpellAttr1.Channeled2);
|
||||
}
|
||||
|
||||
public bool IsMoveAllowedChannel()
|
||||
{
|
||||
return IsChanneled() && HasAttribute(SpellAttr5.CanChannelWhenMoving);
|
||||
}
|
||||
|
||||
public bool NeedsComboPoints()
|
||||
{
|
||||
return HasAttribute(SpellAttr1.ReqComboPoints1 | SpellAttr1.ReqComboPoints2);
|
||||
}
|
||||
|
||||
public bool IsNextMeleeSwingSpell()
|
||||
{
|
||||
return HasAttribute(SpellAttr0.OnNextSwing | SpellAttr0.OnNextSwing2);
|
||||
}
|
||||
|
||||
public bool IsBreakingStealth()
|
||||
{
|
||||
return !HasAttribute(SpellAttr1.NotBreakStealth);
|
||||
|
||||
@@ -2436,6 +2436,10 @@ namespace Game.Entities
|
||||
case 121093:
|
||||
spellInfo.SpellFamilyFlags[2] = 0x80000000;
|
||||
break;
|
||||
// Unleashed Souls
|
||||
case 68979:
|
||||
spellInfo.RangeEntry = CliDB.SpellRangeStorage.LookupByKey(13); // 50000yd
|
||||
break;
|
||||
// VIOLET HOLD SPELLS
|
||||
//
|
||||
case 54258: // Water Globule (Ichoron)
|
||||
|
||||
Reference in New Issue
Block a user