Stop monsters casting when deleted.

Contributed by Liamxroy.
This commit is contained in:
MobiusDev
2017-09-27 00:11:22 +00:00
parent b3d4fcf3d3
commit 2708997611
4 changed files with 24 additions and 24 deletions

View File

@@ -744,11 +744,14 @@ public class L2CharacterAI extends AbstractAI
protected void onEvtForgetObject(L2Object object) protected void onEvtForgetObject(L2Object object)
{ {
final L2Object target = getTarget(); final L2Object target = getTarget();
// Stop any casting pointing to this object.
getActor().abortCast(sc -> sc.getTarget() == object);
// If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE // If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE
if (target == object) if (target == object)
{ {
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
if (isFollowing()) if (isFollowing())
{ {
@@ -759,10 +762,8 @@ public class L2CharacterAI extends AbstractAI
stopFollow(); stopFollow();
} }
if ((getIntention() == AI_INTENTION_INTERACT) || (getIntention() == AI_INTENTION_PICK_UP)) // Stop any intention that has target we want to forget.
{ setIntention(AI_INTENTION_ACTIVE);
setIntention(AI_INTENTION_ACTIVE);
}
} }
// Check if the targeted object was the actor // Check if the targeted object was the actor
@@ -770,7 +771,6 @@ public class L2CharacterAI extends AbstractAI
{ {
// Cancel AI target // Cancel AI target
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
// Stop an AI Follow Task // Stop an AI Follow Task
stopFollow(); stopFollow();

View File

@@ -744,11 +744,14 @@ public class L2CharacterAI extends AbstractAI
protected void onEvtForgetObject(L2Object object) protected void onEvtForgetObject(L2Object object)
{ {
final L2Object target = getTarget(); final L2Object target = getTarget();
// Stop any casting pointing to this object.
getActor().abortCast(sc -> sc.getTarget() == object);
// If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE // If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE
if (target == object) if (target == object)
{ {
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
if (isFollowing()) if (isFollowing())
{ {
@@ -759,10 +762,8 @@ public class L2CharacterAI extends AbstractAI
stopFollow(); stopFollow();
} }
if ((getIntention() == AI_INTENTION_INTERACT) || (getIntention() == AI_INTENTION_PICK_UP)) // Stop any intention that has target we want to forget.
{ setIntention(AI_INTENTION_ACTIVE);
setIntention(AI_INTENTION_ACTIVE);
}
} }
// Check if the targeted object was the actor // Check if the targeted object was the actor
@@ -770,7 +771,6 @@ public class L2CharacterAI extends AbstractAI
{ {
// Cancel AI target // Cancel AI target
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
// Stop an AI Follow Task // Stop an AI Follow Task
stopFollow(); stopFollow();

View File

@@ -744,11 +744,14 @@ public class L2CharacterAI extends AbstractAI
protected void onEvtForgetObject(L2Object object) protected void onEvtForgetObject(L2Object object)
{ {
final L2Object target = getTarget(); final L2Object target = getTarget();
// Stop any casting pointing to this object.
getActor().abortCast(sc -> sc.getTarget() == object);
// If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE // If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE
if (target == object) if (target == object)
{ {
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
if (isFollowing()) if (isFollowing())
{ {
@@ -759,10 +762,8 @@ public class L2CharacterAI extends AbstractAI
stopFollow(); stopFollow();
} }
if ((getIntention() == AI_INTENTION_INTERACT) || (getIntention() == AI_INTENTION_PICK_UP)) // Stop any intention that has target we want to forget.
{ setIntention(AI_INTENTION_ACTIVE);
setIntention(AI_INTENTION_ACTIVE);
}
} }
// Check if the targeted object was the actor // Check if the targeted object was the actor
@@ -770,7 +771,6 @@ public class L2CharacterAI extends AbstractAI
{ {
// Cancel AI target // Cancel AI target
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
// Stop an AI Follow Task // Stop an AI Follow Task
stopFollow(); stopFollow();

View File

@@ -744,11 +744,14 @@ public class L2CharacterAI extends AbstractAI
protected void onEvtForgetObject(L2Object object) protected void onEvtForgetObject(L2Object object)
{ {
final L2Object target = getTarget(); final L2Object target = getTarget();
// Stop any casting pointing to this object.
getActor().abortCast(sc -> sc.getTarget() == object);
// If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE // If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE
if (target == object) if (target == object)
{ {
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
if (isFollowing()) if (isFollowing())
{ {
@@ -759,10 +762,8 @@ public class L2CharacterAI extends AbstractAI
stopFollow(); stopFollow();
} }
if ((getIntention() == AI_INTENTION_INTERACT) || (getIntention() == AI_INTENTION_PICK_UP)) // Stop any intention that has target we want to forget.
{ setIntention(AI_INTENTION_ACTIVE);
setIntention(AI_INTENTION_ACTIVE);
}
} }
// Check if the targeted object was the actor // Check if the targeted object was the actor
@@ -770,7 +771,6 @@ public class L2CharacterAI extends AbstractAI
{ {
// Cancel AI target // Cancel AI target
setTarget(null); setTarget(null);
getActor().abortCast(sc -> sc.getTarget() == object);
// Stop an AI Follow Task // Stop an AI Follow Task
stopFollow(); stopFollow();