fix(Core/Scripts): Ayamiss crashfix (#12610)

This commit is contained in:
Nefertumm
2022-08-03 09:06:51 -03:00
committed by GitHub
parent cee21c022a
commit e6dd5d3e22
@@ -141,7 +141,7 @@ public:
me->GetMotionMaster()->MovePoint(POINT_AIR, AyamissAirPos); me->GetMotionMaster()->MovePoint(POINT_AIR, AyamissAirPos);
} }
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType, SpellSchoolMask) override
{ {
if (_phase == PHASE_AIR && me->GetHealthPct() < 70.0f) if (_phase == PHASE_AIR && me->GetHealthPct() < 70.0f)
{ {
@@ -150,8 +150,11 @@ public:
me->ClearUnitState(UNIT_STATE_ROOT); me->ClearUnitState(UNIT_STATE_ROOT);
me->SetCanFly(false); me->SetCanFly(false);
me->SetDisableGravity(false); me->SetDisableGravity(false);
Position VictimPos = me->GetVictim()->GetPosition(); if (Unit* victim = me->GetVictim())
me->GetMotionMaster()->MovePoint(POINT_GROUND, VictimPos); {
Position victimPos = victim->GetPosition();
me->GetMotionMaster()->MovePoint(POINT_GROUND, victimPos);
}
events.ScheduleEvent(EVENT_LASH, urand(5000, 8000)); events.ScheduleEvent(EVENT_LASH, urand(5000, 8000));
events.CancelEvent(EVENT_POISON_STINGER); events.CancelEvent(EVENT_POISON_STINGER);
DoResetThreat(); DoResetThreat();