Core/Spell: move attribute helpers to spellInfo

This commit is contained in:
hondacrx
2017-12-26 12:32:14 -05:00
parent 7a4d4ad945
commit 58333b9f1f
3 changed files with 23 additions and 14 deletions
+8 -13
View File
@@ -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 (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()) if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
m_caster.ToCreature().FocusTarget(this, 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() && 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))) 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 // 1. Has casttime, 2. Or doesn't have flag to allow movement during channel
if (!(m_spellInfo.IsChanneled() && m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr5.CanChannelWhenMoving))) if (m_casttime != 0 || !m_spellInfo.IsMoveAllowedChannel())
{ {
SendCastResult(SpellCastResult.Moving); SendCastResult(SpellCastResult.Moving);
finish(false); finish(false);
@@ -3172,7 +3172,7 @@ namespace Game.Spells
!m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)) !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
{ {
// don't cancel for melee, autorepeat, triggered and instant spells // 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 // 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 // @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; 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 // don't CheckCast for instant spells - done in spell.prepare, skip duplicate checks, needed for range checks for example
cast(m_casttime == 0); cast(m_casttime == 0);
break; break;
@@ -5643,7 +5643,7 @@ namespace Game.Spells
float minRange = 0.0f; float minRange = 0.0f;
float maxRange = 0.0f; float maxRange = 0.0f;
if (strict && IsNextMeleeSwingSpell()) if (strict && m_spellInfo.IsNextMeleeSwingSpell())
{ {
maxRange = 100.0f; maxRange = 100.0f;
return Tuple.Create(minRange, maxRange); return Tuple.Create(minRange, maxRange);
@@ -6333,13 +6333,13 @@ namespace Game.Spells
public CurrentSpellTypes GetCurrentContainer() public CurrentSpellTypes GetCurrentContainer()
{ {
if (IsNextMeleeSwingSpell()) if (m_spellInfo.IsNextMeleeSwingSpell())
return CurrentSpellTypes.Melee; return CurrentSpellTypes.Melee;
else if (IsAutoRepeat()) else if (IsAutoRepeat())
return CurrentSpellTypes.AutoRepeat; return CurrentSpellTypes.AutoRepeat;
else if (m_spellInfo.IsChanneled()) else if (m_spellInfo.IsChanneled())
return CurrentSpellTypes.Channeled; return CurrentSpellTypes.Channeled;
else
return CurrentSpellTypes.Generic; return CurrentSpellTypes.Generic;
} }
@@ -6423,11 +6423,6 @@ namespace Game.Spells
return true; return true;
} }
bool IsNextMeleeSwingSpell()
{
return m_spellInfo.HasAttribute(SpellAttr0.OnNextSwing | SpellAttr0.OnNextSwing2);
}
bool IsAutoActionResetSpell() bool IsAutoActionResetSpell()
{ {
// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK . SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all? // @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK . SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
+10
View File
@@ -571,11 +571,21 @@ namespace Game.Spells
return HasAttribute(SpellAttr1.Channeled1 | SpellAttr1.Channeled2); return HasAttribute(SpellAttr1.Channeled1 | SpellAttr1.Channeled2);
} }
public bool IsMoveAllowedChannel()
{
return IsChanneled() && HasAttribute(SpellAttr5.CanChannelWhenMoving);
}
public bool NeedsComboPoints() public bool NeedsComboPoints()
{ {
return HasAttribute(SpellAttr1.ReqComboPoints1 | SpellAttr1.ReqComboPoints2); return HasAttribute(SpellAttr1.ReqComboPoints1 | SpellAttr1.ReqComboPoints2);
} }
public bool IsNextMeleeSwingSpell()
{
return HasAttribute(SpellAttr0.OnNextSwing | SpellAttr0.OnNextSwing2);
}
public bool IsBreakingStealth() public bool IsBreakingStealth()
{ {
return !HasAttribute(SpellAttr1.NotBreakStealth); return !HasAttribute(SpellAttr1.NotBreakStealth);
+4
View File
@@ -2436,6 +2436,10 @@ namespace Game.Entities
case 121093: case 121093:
spellInfo.SpellFamilyFlags[2] = 0x80000000; spellInfo.SpellFamilyFlags[2] = 0x80000000;
break; break;
// Unleashed Souls
case 68979:
spellInfo.RangeEntry = CliDB.SpellRangeStorage.LookupByKey(13); // 50000yd
break;
// VIOLET HOLD SPELLS // VIOLET HOLD SPELLS
// //
case 54258: // Water Globule (Ichoron) case 54258: // Water Globule (Ichoron)