mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
*Try to fix a crash caused by charm spells. Do not allow to apply charm aura on invalid target.
--HG-- branch : trunk
This commit is contained in:
@@ -5008,13 +5008,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
}
|
||||
|
||||
// Skip TARGET_UNIT_PET - pet is always valid
|
||||
if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_UNIT_PET
|
||||
&& m_spellInfo->EffectImplicitTargetB[i] != TARGET_UNIT_PET)
|
||||
if(Unit *target = m_targets.getUnitTarget())
|
||||
{
|
||||
Unit *target = m_targets.getUnitTarget();
|
||||
if(!target || target->GetTypeId() == TYPEID_UNIT
|
||||
&& ((Creature*)target)->isVehicle())
|
||||
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isVehicle())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(target->GetCharmerGUID())
|
||||
@@ -6078,6 +6074,25 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(m_spellInfo->EffectApplyAuraName[eff])
|
||||
{
|
||||
case SPELL_AURA_NONE:
|
||||
default:
|
||||
break;
|
||||
case SPELL_AURA_MOD_POSSESS:
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
case SPELL_AURA_AOE_CHARM:
|
||||
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isVehicle())
|
||||
return false;
|
||||
if(target->GetCharmerGUID())
|
||||
return false;
|
||||
if(int32 damage = CalculateDamage(eff, target))
|
||||
if((int32)target->getLevel() > damage)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
//Do not do further checks for triggered spells
|
||||
if(m_IsTriggeredSpell)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user