refactor(Core/Spells): Improved logic and DX Spell::EffectSummonPet (#2634)

This commit is contained in:
Yehonal
2020-02-20 07:55:04 +01:00
committed by GitHub
parent 32dcb3bf63
commit 0cabb8e7e1

View File

@@ -3130,25 +3130,24 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
Player* owner = NULL;
if (m_originalCaster)
{
owner = m_originalCaster->ToPlayer();
if (!owner && m_originalCaster->ToCreature()->IsTotem())
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
}
if (!m_originalCaster)
return;
uint32 petentry = m_spellInfo->Effects[effIndex].MiscValue;
int32 duration = m_spellInfo->GetDuration();
if (m_originalCaster)
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
Player* owner = m_originalCaster->ToPlayer();
if (!owner && m_originalCaster->ToCreature()->IsTotem())
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!owner)
{
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
if (properties && m_originalCaster)
if (properties)
{
// Xinef: unsummon old guardian
if (Guardian* oldPet = m_originalCaster->GetGuardianPet())