Fixed addDamageHate method NPE.

This commit is contained in:
MobiusDevelopment
2022-01-19 22:43:53 +00:00
parent 406c54f14e
commit 0723e0e365
2 changed files with 10 additions and 8 deletions

View File

@@ -964,17 +964,18 @@ public class Attackable extends Npc
ai._damage += damage;
// Set the intention to the Attackable to AI_INTENTION_ACTIVE
if ((getAI() != null) && (aggro > 0) && (getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE))
final CreatureAI activeAI = getAI();
if ((activeAI != null) && (aggro > 0) && (activeAI.getIntention() == CtrlIntention.AI_INTENTION_IDLE))
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
activeAI.setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
}
// Notify the Attackable AI with EVT_ATTACKED
if (damage > 0)
{
if (getAI() != null)
if (activeAI != null)
{
getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker);
activeAI.notifyEvent(CtrlEvent.EVT_ATTACKED, attacker);
}
try