Core/Spell: Undefined SPELL_ATTR7_USABLE_IN_STUN_FEAR_CONFUSION attr for now

This commit is contained in:
ariel-
2016-12-10 00:37:23 -03:00
committed by roc13x
parent 50c04aad05
commit 307b736768
5 changed files with 41 additions and 45 deletions

View File

@@ -557,7 +557,7 @@ enum SpellAttr7
SPELL_ATTR7_UNK17 = 0x00020000, // 17 Only 27965 (Suicide) spell.
SPELL_ATTR7_HAS_CHARGE_EFFECT = 0x00040000, // 18 Only spells that have Charge among effects.
SPELL_ATTR7_ZONE_TELEPORT = 0x00080000, // 19 Teleports to specific zones.
SPELL_ATTR7_USABLE_IN_STUN_FEAR_CONFUSION = 0x00100000, // 20 Blink, Divine Shield, Ice Block
SPELL_ATTR7_UNK20 = 0x00100000, // 20 Blink, Divine Shield, Ice Block
SPELL_ATTR7_UNK21 = 0x00200000, // 21 Not set
SPELL_ATTR7_UNK22 = 0x00400000, // 22
SPELL_ATTR7_UNK23 = 0x00800000, // 23 Motivate, Mutilate, Shattering Throw

View File

@@ -5854,12 +5854,6 @@ SpellCastResult Spell::CheckCasterAuras(uint32* param1) const
bool usableWhileStunned = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_STUNNED);
bool usableWhileFeared = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_FEARED);
bool usableWhileConfused = m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_CONFUSED);
if (m_spellInfo->HasAttribute(SPELL_ATTR7_USABLE_IN_STUN_FEAR_CONFUSION))
{
usableWhileStunned = true;
usableWhileFeared = true;
usableWhileConfused = true;
}
// Glyph of Pain Suppression
// Allow Pain Suppression and Guardian Spirit to be cast while stunned
@@ -5875,18 +5869,18 @@ SpellCastResult Spell::CheckCasterAuras(uint32* param1) const
if (m_caster->GetCharmerGUID())
{
if (Unit* charmer = m_caster->GetCharmer())
if (charmer->GetUnitBeingMoved() != m_caster && CheckCasterNotImmunedCharmAuras(param1))
if (charmer->GetUnitBeingMoved() != m_caster && !CheckSpellCancelsCharm(param1))
result = SPELL_FAILED_CHARMED;
}
else if (unitflag & UNIT_FLAG_STUNNED && !usableWhileStunned && CheckCasterNotImmunedStunAuras(param1))
else if (unitflag & UNIT_FLAG_STUNNED && !usableWhileStunned && !CheckSpellCancelsStun(param1))
result = SPELL_FAILED_STUNNED;
else if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && CheckCasterNotImmunedSilenceAuras(param1))
else if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && !CheckSpellCancelsSilence(param1))
result = SPELL_FAILED_SILENCED;
else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && CheckCasterNotImmunedPacifyAuras(param1))
else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && !CheckSpellCancelsPacify(param1))
result = SPELL_FAILED_PACIFIED;
else if (unitflag & UNIT_FLAG_FLEEING && !usableWhileFeared && CheckCasterNotImmunedFearAuras(param1))
else if (unitflag & UNIT_FLAG_FLEEING && !usableWhileFeared && !CheckSpellCancelsFear(param1))
result = SPELL_FAILED_FLEEING;
else if (unitflag & UNIT_FLAG_CONFUSED && !usableWhileConfused && CheckCasterNotImmunedDisorientAuras(param1))
else if (unitflag & UNIT_FLAG_CONFUSED && !usableWhileConfused && !CheckSpellCancelsConfuse(param1))
result = SPELL_FAILED_CONFUSED;
// Attr must make flag drop spell totally immune from all effects
@@ -5896,18 +5890,17 @@ SpellCastResult Spell::CheckCasterAuras(uint32* param1) const
return SPELL_CAST_OK;
}
// based on sub_00804430 from 12340 client
bool Spell::CheckCasterHasNotImmunedAuraType(AuraType auraType, uint32* param1) const
bool Spell::CheckSpellCancelsAuraEffect(AuraType auraType, uint32* param1) const
{
// Checking auras is needed now, because you are prevented by some state but the spell grants immunity.
Unit::AuraEffectList const& auraEffects = m_caster->GetAuraEffectsByType(auraType);
if (auraEffects.empty())
return false;
return true;
for (AuraEffect const* aurEff : auraEffects)
{
SpellInfo const* auraInfo = aurEff->GetSpellInfo();
if (m_spellInfo->CanSpellCastOverrideAuraEffect(auraInfo, aurEff->GetEffIndex()))
if (m_spellInfo->SpellCancelsAuraEffect(auraInfo, aurEff->GetEffIndex()))
continue;
if (param1)
@@ -5916,43 +5909,46 @@ bool Spell::CheckCasterHasNotImmunedAuraType(AuraType auraType, uint32* param1)
if (!*param1)
*param1 = auraInfo->Mechanic;
}
return true;
return false;
}
return false;
return true;
}
bool Spell::CheckCasterNotImmunedCharmAuras(uint32* param1) const
bool Spell::CheckSpellCancelsCharm(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_CHARM, param1) ||
CheckCasterHasNotImmunedAuraType(SPELL_AURA_AOE_CHARM, param1) ||
CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_POSSESS, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_CHARM, param1) &&
CheckSpellCancelsAuraEffect(SPELL_AURA_AOE_CHARM, param1) &&
CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_POSSESS, param1);
}
bool Spell::CheckCasterNotImmunedStunAuras(uint32* param1) const
bool Spell::CheckSpellCancelsStun(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_STUN, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_STUN, param1) &&
CheckSpellCancelsAuraEffect(SPELL_AURA_STRANGULATE, param1);
}
bool Spell::CheckCasterNotImmunedSilenceAuras(uint32* param1) const
bool Spell::CheckSpellCancelsSilence(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_SILENCE, param1) ||
CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_PACIFY_SILENCE, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_SILENCE, param1) &&
CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_PACIFY_SILENCE, param1);
}
bool Spell::CheckCasterNotImmunedPacifyAuras(uint32* param1) const
bool Spell::CheckSpellCancelsPacify(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_PACIFY, param1) ||
CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_PACIFY_SILENCE, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_PACIFY, param1) &&
CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_PACIFY_SILENCE, param1);
}
bool Spell::CheckCasterNotImmunedFearAuras(uint32* param1) const
bool Spell::CheckSpellCancelsFear(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_FEAR, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_FEAR, param1);
}
bool Spell::CheckCasterNotImmunedDisorientAuras(uint32* param1) const
bool Spell::CheckSpellCancelsConfuse(uint32* param1) const
{
return CheckCasterHasNotImmunedAuraType(SPELL_AURA_MOD_CONFUSE, param1);
return CheckSpellCancelsAuraEffect(SPELL_AURA_MOD_CONFUSE, param1);
}
SpellCastResult Spell::CheckArenaAndRatedBattlegroundCastRules() const

View File

@@ -424,13 +424,13 @@ class TC_GAME_API Spell
SpellCastResult CheckCasterAuras(uint32* param1) const;
SpellCastResult CheckArenaAndRatedBattlegroundCastRules() const;
bool CheckCasterHasNotImmunedAuraType(AuraType auraType, uint32* param1) const;
bool CheckCasterNotImmunedCharmAuras(uint32* param1) const;
bool CheckCasterNotImmunedStunAuras(uint32* param1) const;
bool CheckCasterNotImmunedSilenceAuras(uint32* param1) const;
bool CheckCasterNotImmunedPacifyAuras(uint32* param1) const;
bool CheckCasterNotImmunedFearAuras(uint32* param1) const;
bool CheckCasterNotImmunedDisorientAuras(uint32* param1) const;
bool CheckSpellCancelsAuraEffect(AuraType auraType, uint32* param1) const;
bool CheckSpellCancelsCharm(uint32* param1) const;
bool CheckSpellCancelsStun(uint32* param1) const;
bool CheckSpellCancelsSilence(uint32* param1) const;
bool CheckSpellCancelsPacify(uint32* param1) const;
bool CheckSpellCancelsFear(uint32* param1) const;
bool CheckSpellCancelsConfuse(uint32* param1) const;
int32 CalculateDamage(uint8 i, Unit const* target) const { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i]); }

View File

@@ -3054,8 +3054,8 @@ bool SpellInfo::CanSpellProvideImmunityAgainstAura(SpellInfo const* auraSpellInf
return false;
}
// based on client sub_007FDFA0
bool SpellInfo::CanSpellCastOverrideAuraEffect(SpellInfo const* auraSpellInfo, uint8 auraEffIndex) const
// based on client Spell_C::CancelsAuraEffect
bool SpellInfo::SpellCancelsAuraEffect(SpellInfo const* auraSpellInfo, uint8 auraEffIndex) const
{
if (!HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY))
return false;

View File

@@ -570,7 +570,7 @@ class TC_GAME_API SpellInfo
// spell immunities
void ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool apply) const;
bool CanSpellProvideImmunityAgainstAura(SpellInfo const* auraSpellInfo) const;
bool CanSpellCastOverrideAuraEffect(SpellInfo const* auraSpellInfo, uint8 auraEffIndex) const;
bool SpellCancelsAuraEffect(SpellInfo const* auraSpellInfo, uint8 auraEffIndex) const;
private:
// loading helpers