fix(Core/Spells): Revive Pet cannot be cast if there is not pet to resurrect (#12818)

- Closes #12776
This commit is contained in:
UltraNix
2022-09-12 03:01:53 +02:00
committed by GitHub
parent d40e3340fb
commit 2ef8d2e1e2

View File

@@ -6336,11 +6336,26 @@ SpellCastResult Spell::CheckCast(bool strict)
{
Unit* unitCaster = m_caster->ToUnit();
if (!unitCaster)
{
return SPELL_FAILED_BAD_TARGETS;
}
Creature* pet = unitCaster->GetGuardianPet();
if (pet && pet->IsAlive())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (pet)
{
if (pet->IsAlive())
{
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
}
}
else if (Player* playerCaster = m_caster->ToPlayer())
{
PetStable& petStable = playerCaster->GetOrInitPetStable();
if (!petStable.CurrentPet && petStable.UnslottedPets.empty())
{
return SPELL_FAILED_NO_PET;
}
}
break;
}