fix(Scripts/Pet): Fix crash when spawning lightwell by hand (#18660)
Co-authored-by: Pagani Walter <paganiwalter@gmail.com>
This commit is contained in:
parent
eced002ef9
commit
ef0ebe38d0
1 changed files with 8 additions and 5 deletions
|
|
@ -40,12 +40,15 @@ struct npc_pet_pri_lightwell : public TotemAI
|
|||
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (TempSummon* tempSummon = me->ToTempSummon())
|
||||
{
|
||||
uint32 hp = uint32(owner->GetMaxHealth() * 0.3f);
|
||||
me->SetMaxHealth(hp);
|
||||
me->SetHealth(hp);
|
||||
me->SetLevel(owner->GetLevel());
|
||||
if (Unit* owner = tempSummon->GetSummonerUnit())
|
||||
{
|
||||
uint32 hp = uint32(owner->GetMaxHealth() * 0.3f);
|
||||
me->SetMaxHealth(hp);
|
||||
me->SetHealth(hp);
|
||||
me->SetLevel(owner->GetLevel());
|
||||
}
|
||||
}
|
||||
|
||||
me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue