Core/Spells: Implemented CAST_FLAG_IMMUNITY

This commit is contained in:
Shauren committed 2015-06-30 11:44:11 +02:00
1 parent 879af88d21
commit efad3a3123
4 files changed
+34 -4

No files matched your search

+21 -1
View File
@@ -11136,6 +11136,26 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const
return false;
}
uint32 Unit::GetSchoolImmunityMask() const
{
uint32 mask = 0;
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_SCHOOL];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
mask |= itr->type;
return mask;
}
uint32 Unit::GetMechanicImmunityMask() const
{
uint32 mask = 0;
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
mask |= (1 << itr->type);
return mask;
}
bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
if (!spellInfo || !spellInfo->Effects[index].IsEffect())
@@ -16464,7 +16484,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
data << float(-speedZ); // Z Movement speed (vertical)
player->GetSession()->SendPacket(&data);
if (player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_FLY))
player->SetCanFly(true, true);
}
+2
View File
@@ -1958,6 +1958,8 @@ class Unit : public WorldObject
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // redefined in Creature
uint32 GetSchoolImmunityMask() const;
uint32 GetMechanicImmunityMask() const;
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const;
bool IsImmunedToDamage(SpellInfo const* spellInfo) const;
@@ -3020,6 +3020,10 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
switch (miscVal)
{
case 27:
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SILENCE, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_SILENCE);
break;
case 96:
case 1615:
{
+7 -3
View File
@@ -3754,6 +3754,10 @@ void Spell::SendSpellStart()
//TC_LOG_DEBUG("spells", "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN_2;
uint32 schoolImmunityMask = m_caster->GetSchoolImmunityMask();
uint32 mechanicImmunityMask = m_caster->GetMechanicImmunityMask();
if (schoolImmunityMask || mechanicImmunityMask)
castFlags |= CAST_FLAG_IMMUNITY;
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
@@ -3788,10 +3792,10 @@ void Spell::SendSpellStart()
if (castFlags & CAST_FLAG_AMMO)
WriteAmmoToPacket(&data);
if (castFlags & CAST_FLAG_UNKNOWN_23)
if (castFlags & CAST_FLAG_IMMUNITY)
{
data << uint32(0);
data << uint32(0);
data << uint32(schoolImmunityMask);
data << uint32(mechanicImmunityMask);
}
m_caster->SendMessageToSet(&data, true);