Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-09-13 10:44:15 -06:00
committed by GitHub

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;
}