Sync between different project ai package classes.
This commit is contained in:
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mother class of all objects AI in the world.<br>
|
* Mother class of all objects AI in the world.<br>
|
||||||
* <br>
|
|
||||||
* AbastractAI:<br>
|
* AbastractAI:<br>
|
||||||
* <li>CreatureAI</li>
|
* <li>CreatureAI</li>
|
||||||
*/
|
*/
|
||||||
@@ -93,7 +92,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Creature managed by this Accessor AI.
|
* @return the Creature managed by this Accessor AI.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Creature getActor()
|
public Creature getActor()
|
||||||
@@ -103,12 +102,10 @@ abstract class AbstractAI implements Ctrl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Intention of this AbstractAI.<br>
|
* Set the Intention of this AbstractAI.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
||||||
* <br>
|
* Overridden in</u>:</b><br>
|
||||||
* <b><u>Overriden in</u>:</b><br>
|
|
||||||
* <br>
|
|
||||||
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
||||||
* <b>L2PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary
|
* <b>PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
||||||
* @param intention The new Intention to set to the AI
|
* @param intention The new Intention to set to the AI
|
||||||
* @param arg0 The first parameter of the Intention
|
* @param arg0 The first parameter of the Intention
|
||||||
* @param arg1 The second parameter of the Intention
|
* @param arg1 The second parameter of the Intention
|
||||||
@@ -222,7 +219,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -592,7 +589,9 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client has already arrived to target, no need to force StopMove packet
|
/**
|
||||||
|
* Client has already arrived to target, no need to force StopMove packet.
|
||||||
|
*/
|
||||||
protected void clientStoppedMoving()
|
protected void clientStoppedMoving()
|
||||||
{
|
{
|
||||||
if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
|
if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
|
||||||
|
|||||||
@@ -89,35 +89,41 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <ul>
|
||||||
|
* <li>The target isn't a Folk, a Door or another Npc</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -366,13 +372,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink). <b><u>Actions</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actions</u>:</b><br>
|
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor is a GuardInstance that can't attack, order to it to return to its home location</li>
|
* <li>If the actor is a GuardInstance that can't attack, order to it to return to its home location</li>
|
||||||
* <li>If the actor is a MonsterInstance that can't attack, order to it to random walk (1/100)</li>
|
* <li>If the actor is a MonsterInstance that can't attack, order to it to random walk (1/100)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -503,15 +509,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
// for Raids - need correction
|
|
||||||
if (_actor.isRaid())
|
if (_actor.isRaid())
|
||||||
{
|
{
|
||||||
offset = 500;
|
offset = 500; // for Raids - need correction
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for normal minions - need correction :)
|
offset = 200; // for normal minions - need correction :)
|
||||||
offset = 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((MinionInstance) _actor).getLeader().isRunning())
|
if (((MinionInstance) _actor).getLeader().isRunning())
|
||||||
@@ -591,12 +595,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update the attack timeout if actor is running</li>
|
* <li>Update the attack timeout if actor is running</li>
|
||||||
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
||||||
* <li>Chose a target and order to attack it with magic skill or physical attack</li><br>
|
* <li>Chose a target and order to attack it with magic skill or physical attack</li>
|
||||||
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkAttack()
|
private void thinkAttack()
|
||||||
{
|
{
|
||||||
@@ -1034,10 +1039,12 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -1080,9 +1087,11 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
|
* </ul>
|
||||||
* @param target the Creature that attacks
|
* @param target the Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
import org.l2jmobius.gameserver.util.Util;
|
import org.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author littlecrow AI for controllable mobs
|
* AI for controllable mobs
|
||||||
|
* @author littlecrow
|
||||||
*/
|
*/
|
||||||
public class ControllableMobAI extends AttackableAI
|
public class ControllableMobAI extends AttackableAI
|
||||||
{
|
{
|
||||||
@@ -203,6 +204,7 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
_accessor.doCast(sk);
|
_accessor.doCast(sk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxRange = Math.max(maxRange, castRange);
|
maxRange = Math.max(maxRange, castRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +241,7 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
_accessor.doCast(sk);
|
_accessor.doCast(sk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxRange = Math.max(maxRange, castRange);
|
maxRange = Math.max(maxRange, castRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +249,10 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
{
|
{
|
||||||
moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */);
|
moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_accessor.doAttack(getForcedTarget());
|
_accessor.doAttack(getForcedTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +266,6 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
final Attackable npc = (Attackable) _actor;
|
final Attackable npc = (Attackable) _actor;
|
||||||
npc.stopHating(getAttackTarget());
|
npc.stopHating(getAttackTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_ACTIVE);
|
setIntention(AI_INTENTION_ACTIVE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -45,12 +45,13 @@ import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages AI of Creature.<br>
|
* This class manages AI of Creature.<br>
|
||||||
* <br>
|
* CreatureAI :
|
||||||
* CreatureAI:<br>
|
* <ul>
|
||||||
* <li>AttackableAI</li>
|
* <li>AttackableAI</li>
|
||||||
* <li>DoorAI</li>
|
* <li>DoorAI</li>
|
||||||
* <li>PlayerAI</li>
|
* <li>PlayerAI</li>
|
||||||
* <li>SummonAI</li>
|
* <li>SummonAI</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class CreatureAI extends AbstractAI
|
public class CreatureAI extends AbstractAI
|
||||||
{
|
{
|
||||||
@@ -75,12 +76,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Idle Intention : Stop Attack, Movement and Stand Up the actor.<br>
|
* Manage the Idle Intention : Stop Attack, Movement and Stand Up the actor.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
||||||
* <li>Init cast and attack target</li>
|
* <li>Init cast and attack target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Stand up the actor server side AND client side by sending Server->Client packet ChangeWaitType (broadcast)</li>
|
* <li>Stand up the actor server side AND client side by sending Server->Client packet ChangeWaitType (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionIdle()
|
protected void onIntentionIdle()
|
||||||
@@ -102,12 +105,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Active Intention : Stop Attack, Movement and Launch Think Event.<br>
|
* Manage the Active Intention : Stop Attack, Movement and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>if the Intention is not already Active</i></b><br>
|
* <b><u>Actions</u> : <i>if the Intention is not already Active</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_ACTIVE</li>
|
* <li>Set the AI Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Init cast and attack target</li>
|
* <li>Init cast and attack target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch the Think Event</li><br>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
* @param target
|
* @param target
|
||||||
*/
|
*/
|
||||||
protected void onIntentionActive(Creature target)
|
protected void onIntentionActive(Creature target)
|
||||||
@@ -143,8 +148,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Rest Intention.<br>
|
* Manage the Rest Intention.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
@@ -156,15 +163,19 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event.<br>
|
* Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_ATTACK</li>
|
||||||
* <li>Set or change the AI attack target</li>
|
* <li>Set or change the AI attack target</li>
|
||||||
* <li>Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart (broadcast)</li>
|
* <li>Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart (broadcast)</li>
|
||||||
* <li>Launch the Think Event</li><br>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Overridden in</u>:</b><br>
|
* <b><u>Overridden in</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>AttackableAI : Calculate attack timeout</li>
|
* <li>AttackableAI : Calculate attack timeout</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionAttack(Creature target)
|
protected void onIntentionAttack(Creature target)
|
||||||
@@ -226,13 +237,15 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Cast Intention : Stop current Attack, Init the AI in order to cast and Launch Think Event.<br>
|
* Manage the Cast Intention : Stop current Attack, Init the AI in order to cast and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI cast target</li>
|
* <li>Set the AI cast target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor</li>
|
* <li>Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor</li>
|
||||||
* <li>Set the AI skill used by INTENTION_CAST</li>
|
* <li>Set the AI skill used by INTENTION_CAST</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_CAST</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_CAST</li>
|
||||||
* <li>Launch the Think Event</li>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionCast(Skill skill, WorldObject target)
|
protected void onIntentionCast(Skill skill, WorldObject target)
|
||||||
@@ -291,10 +304,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<br>
|
* Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionMoveTo(Location pos)
|
protected void onIntentionMoveTo(Location pos)
|
||||||
@@ -382,10 +397,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<br>
|
* Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_FOLLOW</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_FOLLOW</li>
|
||||||
* <li>Create and Launch an AI Follow Task to execute every 1s</li>
|
* <li>Create and Launch an AI Follow Task to execute every 1s</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionFollow(Creature target)
|
protected void onIntentionFollow(Creature target)
|
||||||
@@ -438,10 +455,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the PickUp Intention : Set the pick up target and Launch a Move To Pawn Task (offset=20).<br>
|
* Manage the PickUp Intention : Set the pick up target and Launch a Move To Pawn Task (offset=20).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI pick up target</li>
|
* <li>Set the AI pick up target</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_PICK_UP</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_PICK_UP</li>
|
||||||
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionPickUp(WorldObject object)
|
protected void onIntentionPickUp(WorldObject object)
|
||||||
@@ -494,11 +513,13 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Interact Intention : Set the interact target and Launch a Move To Pawn Task (offset=60).<br>
|
* Manage the Interact Intention : Set the interact target and Launch a Move To Pawn Task (offset=60).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the AI interact target</li>
|
* <li>Set the AI interact target</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_INTERACT</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_INTERACT</li>
|
||||||
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionInteract(WorldObject object)
|
protected void onIntentionInteract(WorldObject object)
|
||||||
@@ -554,12 +575,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Stunned then onAttacked Event.<br>
|
* Launch actions corresponding to the Event Stunned then onAttacked Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked (only for AttackableAI after the stunning periode)</li>
|
* <li>Launch actions corresponding to the Event onAttacked (only for AttackableAI after the stunning periode)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtStunned(Creature attacker)
|
protected void onEvtStunned(Creature attacker)
|
||||||
@@ -584,11 +607,13 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Sleeping.<br>
|
* Launch actions corresponding to the Event Sleeping.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtSleeping(Creature attacker)
|
protected void onEvtSleeping(Creature attacker)
|
||||||
@@ -610,9 +635,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Rooted.<br>
|
* Launch actions corresponding to the Event Rooted.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked</li>
|
* <li>Launch actions corresponding to the Event onAttacked</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtRooted(Creature attacker)
|
protected void onEvtRooted(Creature attacker)
|
||||||
@@ -632,9 +659,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Confused.<br>
|
* Launch actions corresponding to the Event Confused.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked</li>
|
* <li>Launch actions corresponding to the Event onAttacked</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtConfused(Creature attacker)
|
protected void onEvtConfused(Creature attacker)
|
||||||
@@ -649,8 +678,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Muted.<br>
|
* Launch actions corresponding to the Event Muted.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtMuted(Creature attacker)
|
protected void onEvtMuted(Creature attacker)
|
||||||
@@ -662,8 +693,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ReadyToAct.<br>
|
* Launch actions corresponding to the Event ReadyToAct.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtReadyToAct()
|
protected void onEvtReadyToAct()
|
||||||
@@ -684,9 +717,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Arrived.<br>
|
* Launch actions corresponding to the Event Arrived.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrived()
|
protected void onEvtArrived()
|
||||||
@@ -726,8 +761,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ArrivedRevalidate.<br>
|
* Launch actions corresponding to the Event ArrivedRevalidate.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedRevalidate()
|
protected void onEvtArrivedRevalidate()
|
||||||
@@ -739,10 +776,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ArrivedBlocked.<br>
|
* Launch actions corresponding to the Event ArrivedBlocked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedBlocked(Location location)
|
protected void onEvtArrivedBlocked(Location location)
|
||||||
@@ -763,12 +802,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ForgetObject.<br>
|
* Launch actions corresponding to the Event ForgetObject.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to attack, stop the auto-attack, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to attack, stop the auto-attack, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to cast, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to cast, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to follow, stop the movement, cancel AI Follow Task and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to follow, stop the movement, cancel AI Follow Task and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the targeted object was the actor , cancel AI target, stop AI Follow Task, stop the movement and set the Intention to AI_INTENTION_IDLE</li>
|
* <li>If the targeted object was the actor , cancel AI target, stop AI Follow Task, stop the movement and set the Intention to AI_INTENTION_IDLE</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtForgetObject(WorldObject object)
|
protected void onEvtForgetObject(WorldObject object)
|
||||||
@@ -822,30 +863,34 @@ public class CreatureAI extends AbstractAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the targeted object was the actor
|
// Check if the targeted object was the actor
|
||||||
if (_actor == object)
|
if (_actor != object)
|
||||||
{
|
{
|
||||||
// Cancel AI target
|
return;
|
||||||
setTarget(null);
|
|
||||||
setAttackTarget(null);
|
|
||||||
setCastTarget(null);
|
|
||||||
|
|
||||||
// Stop an AI Follow Task
|
|
||||||
stopFollow();
|
|
||||||
|
|
||||||
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
|
|
||||||
clientStopMoving(null);
|
|
||||||
|
|
||||||
// Set the Intention of this AbstractAI to AI_INTENTION_IDLE
|
|
||||||
changeIntention(AI_INTENTION_IDLE, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cancel AI target
|
||||||
|
setTarget(null);
|
||||||
|
setAttackTarget(null);
|
||||||
|
setCastTarget(null);
|
||||||
|
|
||||||
|
// Stop an AI Follow Task
|
||||||
|
stopFollow();
|
||||||
|
|
||||||
|
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
|
||||||
|
clientStopMoving(null);
|
||||||
|
|
||||||
|
// Set the Intention of this AbstractAI to AI_INTENTION_IDLE
|
||||||
|
changeIntention(AI_INTENTION_IDLE, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Cancel.<br>
|
* Launch actions corresponding to the Event Cancel.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtCancel()
|
protected void onEvtCancel()
|
||||||
@@ -865,9 +910,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Dead.<br>
|
* Launch actions corresponding to the Event Dead.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
* <li>Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die (broadcast)</li>
|
* <li>Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtDead()
|
protected void onEvtDead()
|
||||||
@@ -887,8 +934,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Fake Death.<br>
|
* Launch actions corresponding to the Event Fake Death.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtFakeDeath()
|
protected void onEvtFakeDeath()
|
||||||
@@ -918,13 +967,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Move to Pawn action in function of the distance and of the Interact area.<br>
|
* Manage the Move to Pawn action in function of the distance and of the Interact area.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Get the distance between the current position of the Creature and the target (x,y)</li>
|
* <li>Get the distance between the current position of the Creature and the target (x,y)</li>
|
||||||
* <li>If the distance > offset+20, move the actor (by running) to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>If the distance > offset+20, move the actor (by running) to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
* <li>If the distance <= offset+20, Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li><br>
|
* <li>If the distance <= offset+20, Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PLayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @param offsetValue The Interact area radius
|
* @param offsetValue The Interact area radius
|
||||||
* @return True if a movement must be done
|
* @return True if a movement must be done
|
||||||
@@ -937,11 +990,9 @@ public class CreatureAI extends AbstractAI
|
|||||||
// LOGGER.warning("maybeMoveToPawn: target == NULL!");
|
// LOGGER.warning("maybeMoveToPawn: target == NULL!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skill radius -1
|
|
||||||
if (offsetValue < 0)
|
if (offsetValue < 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false; // skill radius -1
|
||||||
}
|
}
|
||||||
|
|
||||||
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
|
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
|
||||||
@@ -1031,15 +1082,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Modify current Intention and actions if the target is lost or dead.<br>
|
* Modify current Intention and actions if the target is lost or dead.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>If the target is lost or dead</i></b><br>
|
* <b><u>Actions</u> : <i>If the target is lost or dead</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li><br>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation<br>
|
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li>
|
||||||
* (broadcast)</li>
|
* </ul>
|
||||||
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li><br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PLayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost or dead (false if fakedeath)
|
* @return True if the target is lost or dead (false if fakedeath)
|
||||||
*/
|
*/
|
||||||
@@ -1056,7 +1109,6 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE
|
// Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE
|
||||||
setIntention(AI_INTENTION_ACTIVE);
|
setIntention(AI_INTENTION_ACTIVE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1065,13 +1117,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Modify current Intention and actions if the target is lost.<br>
|
* Modify current Intention and actions if the target is lost.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>If the target is lost</i></b><br>
|
* <b><u>Actions</u> : <i>If the target is lost</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li><br>
|
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PlayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,48 +19,86 @@ package org.l2jmobius.gameserver.ai;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface of AI and client state. To correctly send messages to client we need it's state. For example, if we've sent 'StartAutoAttack' message, we need to send 'StopAutoAttack' message before any other action. Or if we've sent 'MoveToPawn', we need to send 'StopMove' when the movement of a
|
* Interface of AI and client state.<br>
|
||||||
* character is canceled (by Root spell or any other reason). Thus, we need to know the state of client, i.e. which messages we've sent and how the client will show the scene. Close to this task is the task of AI. If a player's character is attacking a mob, his ATTACK may be interrupted by an event,
|
* To correctly send messages to client we need it's state.<br>
|
||||||
* that temporary disable attacking. But when the possibility to ATTACK will be enabled, the character must continue the ATTACK. For mobs it may be more complex, since we want them to decide when to use magic, or when to follow the player for physical combat, or when to escape, to help another mob,
|
* For example, if we've sent 'StartAutoAttack' message, we need to send 'StopAutoAttack' message before any other action.<br>
|
||||||
* etc. This interface is hiding complexity of server<->client interaction and multiple states of a character. It allows to set a desired, simple "wish" of a character, and the implementation of this interface will take care about the rest. The goal of a character may be like "ATTACK", "random walk"
|
* Or if we've sent 'MoveToPawn', we need to send 'StopMove' when the movement of a character is canceled (by Root spell or any other reason).<br>
|
||||||
* and so on. To reach the goal implementation will split it into several small actions, several steps (possibly repeatable). Like "run to target" then "hit it", then if target is not dead - repeat. This flow of simpler steps may be interrupted by incoming events. Like a character's movement was
|
* Thus, we need to know the state of client, i.e. which messages we've sent and how the client will show the scene.<br>
|
||||||
* disabled (by Root spell, for instance). Depending on character's ability AI may choose to wait, or to use magic ATTACK and so on. Additionally incoming events are compared with client's state of the character, and required network messages are sent to client's, i.e. if we have incoming event that
|
* Close to this task is the task of AI.<br>
|
||||||
* character's movement was disabled, it causes changing if its Behavior, and if client's state for the character is "moving" we send messages to clients to stop the avatar/mob.
|
* If a player's character is attacking a mob, his ATTACK may be interrupted by an event, that temporary disable attacking.<br>
|
||||||
|
* But when the possibility to ATTACK will be enabled, the character must continue the ATTACK.<br>
|
||||||
|
* For mobs it may be more complex, since we want them to decide when to use magic, or when to follow the player for physical combat, or when to escape, to help another mob, etc.<br>
|
||||||
|
* This interface is hiding complexity of server<->client interaction and multiple states of a character.<br>
|
||||||
|
* It allows to set a desired, simple "wish" of a character, and the implementation of this interface will take care about the rest.<br>
|
||||||
|
* The goal of a character may be like "ATTACK", "random walk" and so on.<br>
|
||||||
|
* To reach the goal implementation will split it into several small actions, several steps (possibly repeatable).<br>
|
||||||
|
* Like "run to target" then "hit it", then if target is not dead - repeat.<br>
|
||||||
|
* This flow of simpler steps may be interrupted by incoming events.<br>
|
||||||
|
* Like a character's movement was disabled (by Root spell, for instance).<br>
|
||||||
|
* Depending on character's ability AI may choose to wait, or to use magic ATTACK and so on.<br>
|
||||||
|
* Additionally incoming events are compared with client's state of the character,<br>
|
||||||
|
* and required network messages are sent to client's, i.e. if we have incoming event that character's movement was disabled, it causes changing if its behavior,<br>
|
||||||
|
* and if client's state for the character is "moving" we send messages to clients to stop the avatar/mob.
|
||||||
*/
|
*/
|
||||||
public interface Ctrl
|
public interface Ctrl
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return the character this AI serves
|
* Gets the actor.
|
||||||
|
* @return the actor
|
||||||
*/
|
*/
|
||||||
Creature getActor();
|
Creature getActor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current intention.
|
* Gets the intention.
|
||||||
|
* @return the intention
|
||||||
*/
|
*/
|
||||||
CtrlIntention getIntention();
|
CtrlIntention getIntention();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current attack target.
|
* Gets the attack target.
|
||||||
|
* @return the attack target
|
||||||
*/
|
*/
|
||||||
Creature getAttackTarget();
|
Creature getAttackTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set general state/intention for AI, with optional data
|
* Set general state/intention for AI, with optional data.
|
||||||
* @param intention
|
* @param intention the new intention
|
||||||
*/
|
*/
|
||||||
void setIntention(CtrlIntention intention);
|
void setIntention(CtrlIntention intention);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the intention.
|
||||||
|
* @param intention the intention
|
||||||
|
* @param arg0 the arg0
|
||||||
|
*/
|
||||||
void setIntention(CtrlIntention intention, Object arg0);
|
void setIntention(CtrlIntention intention, Object arg0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the intention.
|
||||||
|
* @param intention the intention
|
||||||
|
* @param arg0 the arg0
|
||||||
|
* @param arg1 the arg1
|
||||||
|
*/
|
||||||
void setIntention(CtrlIntention intention, Object arg0, Object arg1);
|
void setIntention(CtrlIntention intention, Object arg0, Object arg1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event, that notifies about previous step result, or user command, that does not change current general intention
|
* Event, that notifies about previous step result, or user command, that does not change current general intention.
|
||||||
* @param evt
|
* @param evt the event
|
||||||
*/
|
*/
|
||||||
void notifyEvent(CtrlEvent evt);
|
void notifyEvent(CtrlEvent evt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify an event.
|
||||||
|
* @param evt the event
|
||||||
|
* @param arg0 the arg0
|
||||||
|
*/
|
||||||
void notifyEvent(CtrlEvent evt, Object arg0);
|
void notifyEvent(CtrlEvent evt, Object arg0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify an event.
|
||||||
|
* @param evt the event
|
||||||
|
* @param arg0 the arg0
|
||||||
|
* @param arg1 the arg1
|
||||||
|
*/
|
||||||
void notifyEvent(CtrlEvent evt, Object arg0, Object arg1);
|
void notifyEvent(CtrlEvent evt, Object arg0, Object arg1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,31 +17,40 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains an enum of each possibles evenements that can happen on an AI character.
|
* This class contains an enum of each possibles events that can happen on an AI character.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CtrlEvent
|
public enum CtrlEvent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action
|
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
||||||
*/
|
*/
|
||||||
EVT_THINK,
|
EVT_THINK,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor was attacked. This event comes each time a physical or magical attack was done on the actor. NPC may start attack in responce, or ignore this event if they already attack someone, or change target and so on.
|
* The actor was attacked. This event comes each time a physical or magical<br>
|
||||||
|
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
||||||
|
* this event if they already attack someone, or change target and so on.
|
||||||
*/
|
*/
|
||||||
EVT_ATTACKED,
|
EVT_ATTACKED,
|
||||||
|
|
||||||
/** Increase/decrease aggression towards a target, or reduce global aggression if target is null */
|
/**
|
||||||
|
* Increase/decrease aggression towards a target, or reduce global aggression if target is null
|
||||||
|
*/
|
||||||
EVT_AGGRESSION,
|
EVT_AGGRESSION,
|
||||||
|
|
||||||
/** Actor is in stun state */
|
/**
|
||||||
|
* Actor is in stun state
|
||||||
|
*/
|
||||||
EVT_STUNNED,
|
EVT_STUNNED,
|
||||||
|
|
||||||
/** Actor starts/stops sleeping */
|
/**
|
||||||
|
* Actor starts/stops sleeping
|
||||||
|
*/
|
||||||
EVT_SLEEPING,
|
EVT_SLEEPING,
|
||||||
|
|
||||||
/** Actor is in rooted state (cannot move) */
|
/**
|
||||||
|
* Actor is in rooted state (cannot move)
|
||||||
|
*/
|
||||||
EVT_ROOTED,
|
EVT_ROOTED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,40 +69,61 @@ public enum CtrlEvent
|
|||||||
EVT_ARRIVED,
|
EVT_ARRIVED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to an intermidiate point, and needs revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED_REVALIDATE,
|
EVT_ARRIVED_REVALIDATE,
|
||||||
|
|
||||||
/** The actor cannot move anymore. */
|
/**
|
||||||
|
* The actor cannot move anymore.
|
||||||
|
*/
|
||||||
EVT_ARRIVED_BLOCKED,
|
EVT_ARRIVED_BLOCKED,
|
||||||
|
|
||||||
/** Forgets an object (if it's used as attack target, follow target and so on */
|
/**
|
||||||
|
* Forgets an object (if it's used as attack target, follow target and so on
|
||||||
|
*/
|
||||||
EVT_FORGET_OBJECT,
|
EVT_FORGET_OBJECT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to cancel current step execution, but not change the intention. For example, the actor was putted into a stun, so it's current attack or movement has to be canceled. But after the stun state expired, the actor may try to attack again. Another usage for CANCEL is a user's attempt to
|
* Attempt to cancel current step execution, but not change the intention.<br>
|
||||||
* cancel a cast/bow attack and so on.
|
* For example, the actor was put into a stun, so it's current attack<br>
|
||||||
|
* or movement has to be canceled. But after the stun state expired,<br>
|
||||||
|
* the actor may try to attack again. Another usage for CANCEL is a user's<br>
|
||||||
|
* attempt to cancel a cast/bow attack and so on.
|
||||||
*/
|
*/
|
||||||
EVT_CANCEL,
|
EVT_CANCEL,
|
||||||
|
|
||||||
/** The creature is dead */
|
/**
|
||||||
|
* The creature is dead
|
||||||
|
*/
|
||||||
EVT_DEAD,
|
EVT_DEAD,
|
||||||
|
|
||||||
/** The creature looks like dead */
|
/**
|
||||||
|
* The creature looks like dead
|
||||||
|
*/
|
||||||
EVT_FAKE_DEATH,
|
EVT_FAKE_DEATH,
|
||||||
|
|
||||||
/** The creature attack anyone randomly **/
|
/**
|
||||||
|
* The creature attack anyone randomly
|
||||||
|
*/
|
||||||
EVT_CONFUSED,
|
EVT_CONFUSED,
|
||||||
|
|
||||||
/** The creature cannot cast spells anymore **/
|
/**
|
||||||
|
* The creature cannot cast spells anymore
|
||||||
|
*/
|
||||||
EVT_MUTED,
|
EVT_MUTED,
|
||||||
|
|
||||||
/** The creature flee in randoms directions **/
|
/**
|
||||||
EVT_AFFRAID,
|
* The creature flee in random directions
|
||||||
|
*/
|
||||||
|
EVT_AFRAID,
|
||||||
|
|
||||||
/** The creature finish casting **/
|
/**
|
||||||
|
* The creature finish casting
|
||||||
|
*/
|
||||||
EVT_FINISH_CASTING,
|
EVT_FINISH_CASTING,
|
||||||
|
|
||||||
/** The creature betrayed its master */
|
/**
|
||||||
|
* The creature betrayed its master
|
||||||
|
*/
|
||||||
EVT_BETRAYED
|
EVT_BETRAYED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,8 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumaration of generic intentions of an NPC/PC, an intention may require several steps to be completed
|
* Enumeration of generic intentions of an NPC/PC, an intention may require several steps to be completed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CtrlIntention
|
public enum CtrlIntention
|
||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
@@ -31,9 +30,7 @@ public enum CtrlIntention
|
|||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/**
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
* Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peacefull zone and so on
|
|
||||||
*/
|
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
|
|||||||
@@ -35,144 +35,120 @@ public class DoorAI extends CreatureAI
|
|||||||
super(accessor);
|
super(accessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rather stupid AI... well, it's for doors :D
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionIdle()
|
protected void onIntentionIdle()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionActive()
|
protected void onIntentionActive()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionAttack(Creature target)
|
protected void onIntentionAttack(Creature target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionCast(Skill skill, WorldObject target)
|
protected void onIntentionCast(Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionMoveTo(Location destination)
|
protected void onIntentionMoveTo(Location destination)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionFollow(Creature target)
|
protected void onIntentionFollow(Creature target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionPickUp(WorldObject item)
|
protected void onIntentionPickUp(WorldObject item)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionInteract(WorldObject object)
|
protected void onIntentionInteract(WorldObject object)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvtThink()
|
public void onEvtThink()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtAttacked(Creature attacker)
|
protected void onEvtAttacked(Creature attacker)
|
||||||
{
|
{
|
||||||
final DoorInstance me = (DoorInstance) _actor;
|
ThreadPool.execute(new onEventAttackedDoorTask((DoorInstance) _actor, attacker));
|
||||||
ThreadPool.execute(new onEventAttackedDoorTask(me, attacker));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtAggression(Creature target, int aggro)
|
protected void onEvtAggression(Creature target, int aggro)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtStunned(Creature attacker)
|
protected void onEvtStunned(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtSleeping(Creature attacker)
|
protected void onEvtSleeping(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtRooted(Creature attacker)
|
protected void onEvtRooted(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtReadyToAct()
|
protected void onEvtReadyToAct()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtUserCmd(Object arg0, Object arg1)
|
protected void onEvtUserCmd(Object arg0, Object arg1)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrived()
|
protected void onEvtArrived()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedRevalidate()
|
protected void onEvtArrivedRevalidate()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedBlocked(Location blocked_at_pos)
|
protected void onEvtArrivedBlocked(Location blocked_at_loc)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtForgetObject(WorldObject object)
|
protected void onEvtForgetObject(WorldObject object)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtCancel()
|
protected void onEvtCancel()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtDead()
|
protected void onEvtDead()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class onEventAttackedDoorTask implements Runnable
|
private class onEventAttackedDoorTask implements Runnable
|
||||||
|
|||||||
@@ -104,35 +104,41 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -268,10 +274,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor can't attack, order to it to return to its home location</li>
|
* <li>If the actor can't attack, order to it to return to its home location</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -362,11 +370,13 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update the attack timeout if actor is running</li>
|
* <li>Update the attack timeout if actor is running</li>
|
||||||
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
||||||
* <li>Chose a target and order to attack it with magic skill or physical attack</li><br>
|
* <li>Chose a target and order to attack it with magic skill or physical attack</li>
|
||||||
|
* </ul>
|
||||||
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
||||||
*/
|
*/
|
||||||
private void thinkAttack()
|
private void thinkAttack()
|
||||||
@@ -592,7 +602,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
FortSiegeGuardInstance sGuard;
|
FortSiegeGuardInstance sGuard;
|
||||||
sGuard = (FortSiegeGuardInstance) _actor;
|
sGuard = (FortSiegeGuardInstance) _actor;
|
||||||
Creature attackTarget = getAttackTarget();
|
Creature attackTarget = getAttackTarget();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_actor.setTarget(attackTarget);
|
_actor.setTarget(attackTarget);
|
||||||
@@ -854,10 +863,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -893,9 +904,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
|
* </ul>
|
||||||
* @param target The Creature that attacks
|
* @param target The Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -143,18 +143,18 @@ public class PlayerAI extends CreatureAI
|
|||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
{
|
{
|
||||||
if (getIntention() != AI_INTENTION_REST)
|
if (getIntention() == AI_INTENTION_REST)
|
||||||
{
|
{
|
||||||
changeIntention(AI_INTENTION_REST, null, null);
|
return;
|
||||||
setTarget(null);
|
|
||||||
|
|
||||||
if (getAttackTarget() != null)
|
|
||||||
{
|
|
||||||
setAttackTarget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
clientStopMoving(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeIntention(AI_INTENTION_REST, null, null);
|
||||||
|
setTarget(null);
|
||||||
|
if (getAttackTarget() != null)
|
||||||
|
{
|
||||||
|
setAttackTarget(null);
|
||||||
|
}
|
||||||
|
clientStopMoving(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,14 +46,12 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class SiegeGuardAI extends CreatureAI implements Runnable
|
public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||||
{
|
{
|
||||||
// protected static final Logger LOGGER = Logger.getLogger(SiegeGuardAI.class);
|
|
||||||
|
|
||||||
private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
|
private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
|
||||||
|
|
||||||
/** The Attackable AI task executed every 1s (call onEvtThink method) */
|
/** The Attackable AI task executed every 1s (call onEvtThink method) */
|
||||||
private Future<?> _aiTask;
|
private Future<?> _aiTask;
|
||||||
|
|
||||||
/** The delay after wich the attacked is stopped */
|
/** The delay after which the attacked is stopped */
|
||||||
private int _attackTimeout;
|
private int _attackTimeout;
|
||||||
|
|
||||||
/** The Attackable aggro counter */
|
/** The Attackable aggro counter */
|
||||||
@@ -85,35 +83,41 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -221,10 +225,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor can't attack, order to it to return to its home location</li>
|
* <li>If the actor can't attack, order to it to return to its home location</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -661,10 +667,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -700,10 +708,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* @param target The Creature that attacks
|
* </ul>
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,11 +17,8 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_CAST;
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_INTERACT;
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.Skill;
|
import org.l2jmobius.gameserver.model.Skill;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -162,21 +159,28 @@ public class SummonAI extends CreatureAI
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (getIntention() == AI_INTENTION_ATTACK)
|
switch (getIntention())
|
||||||
{
|
{
|
||||||
thinkAttack();
|
case AI_INTENTION_ATTACK:
|
||||||
}
|
{
|
||||||
else if (getIntention() == AI_INTENTION_CAST)
|
thinkAttack();
|
||||||
{
|
break;
|
||||||
thinkCast();
|
}
|
||||||
}
|
case AI_INTENTION_CAST:
|
||||||
else if (getIntention() == AI_INTENTION_PICK_UP)
|
{
|
||||||
{
|
thinkCast();
|
||||||
thinkPickUp();
|
break;
|
||||||
}
|
}
|
||||||
else if (getIntention() == AI_INTENTION_INTERACT)
|
case AI_INTENTION_PICK_UP:
|
||||||
{
|
{
|
||||||
thinkInteract();
|
thinkPickUp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AI_INTENTION_INTERACT:
|
||||||
|
{
|
||||||
|
thinkInteract();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -3321,7 +3321,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public void startFear()
|
public void startFear()
|
||||||
{
|
{
|
||||||
setAfraid(true);
|
setAfraid(true);
|
||||||
getAI().notifyEvent(CtrlEvent.EVT_AFFRAID);
|
getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
|
||||||
updateAbnormalEffect();
|
updateAbnormalEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mother class of all objects AI in the world.<br>
|
* Mother class of all objects AI in the world.<br>
|
||||||
* <br>
|
|
||||||
* AbastractAI:<br>
|
* AbastractAI:<br>
|
||||||
* <li>CreatureAI</li>
|
* <li>CreatureAI</li>
|
||||||
*/
|
*/
|
||||||
@@ -93,7 +92,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Creature managed by this Accessor AI.
|
* @return the Creature managed by this Accessor AI.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Creature getActor()
|
public Creature getActor()
|
||||||
@@ -103,12 +102,10 @@ abstract class AbstractAI implements Ctrl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Intention of this AbstractAI.<br>
|
* Set the Intention of this AbstractAI.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
||||||
* <br>
|
* Overridden in</u>:</b><br>
|
||||||
* <b><u>Overriden in</u>:</b><br>
|
|
||||||
* <br>
|
|
||||||
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
||||||
* <b>L2PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary
|
* <b>PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
||||||
* @param intention The new Intention to set to the AI
|
* @param intention The new Intention to set to the AI
|
||||||
* @param arg0 The first parameter of the Intention
|
* @param arg0 The first parameter of the Intention
|
||||||
* @param arg1 The second parameter of the Intention
|
* @param arg1 The second parameter of the Intention
|
||||||
@@ -222,7 +219,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -592,7 +589,9 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client has already arrived to target, no need to force StopMove packet
|
/**
|
||||||
|
* Client has already arrived to target, no need to force StopMove packet.
|
||||||
|
*/
|
||||||
protected void clientStoppedMoving()
|
protected void clientStoppedMoving()
|
||||||
{
|
{
|
||||||
if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
|
if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped
|
||||||
|
|||||||
@@ -89,35 +89,41 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <ul>
|
||||||
|
* <li>The target isn't a Folk, a Door or another Npc</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -366,13 +372,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink). <b><u>Actions</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actions</u>:</b><br>
|
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor is a GuardInstance that can't attack, order to it to return to its home location</li>
|
* <li>If the actor is a GuardInstance that can't attack, order to it to return to its home location</li>
|
||||||
* <li>If the actor is a MonsterInstance that can't attack, order to it to random walk (1/100)</li>
|
* <li>If the actor is a MonsterInstance that can't attack, order to it to random walk (1/100)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -503,15 +509,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
// for Raids - need correction
|
|
||||||
if (_actor.isRaid())
|
if (_actor.isRaid())
|
||||||
{
|
{
|
||||||
offset = 500;
|
offset = 500; // for Raids - need correction
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for normal minions - need correction :)
|
offset = 200; // for normal minions - need correction :)
|
||||||
offset = 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((MinionInstance) _actor).getLeader().isRunning())
|
if (((MinionInstance) _actor).getLeader().isRunning())
|
||||||
@@ -591,12 +595,13 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update the attack timeout if actor is running</li>
|
* <li>Update the attack timeout if actor is running</li>
|
||||||
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
||||||
* <li>Chose a target and order to attack it with magic skill or physical attack</li><br>
|
* <li>Chose a target and order to attack it with magic skill or physical attack</li>
|
||||||
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkAttack()
|
private void thinkAttack()
|
||||||
{
|
{
|
||||||
@@ -1034,10 +1039,12 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -1080,9 +1087,11 @@ public class AttackableAI extends CreatureAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
|
* </ul>
|
||||||
* @param target the Creature that attacks
|
* @param target the Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
import org.l2jmobius.gameserver.util.Util;
|
import org.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author littlecrow AI for controllable mobs
|
* AI for controllable mobs
|
||||||
|
* @author littlecrow
|
||||||
*/
|
*/
|
||||||
public class ControllableMobAI extends AttackableAI
|
public class ControllableMobAI extends AttackableAI
|
||||||
{
|
{
|
||||||
@@ -203,6 +204,7 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
_accessor.doCast(sk);
|
_accessor.doCast(sk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxRange = Math.max(maxRange, castRange);
|
maxRange = Math.max(maxRange, castRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +241,7 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
_accessor.doCast(sk);
|
_accessor.doCast(sk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxRange = Math.max(maxRange, castRange);
|
maxRange = Math.max(maxRange, castRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +249,10 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
{
|
{
|
||||||
moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */);
|
moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_accessor.doAttack(getForcedTarget());
|
_accessor.doAttack(getForcedTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +266,6 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
final Attackable npc = (Attackable) _actor;
|
final Attackable npc = (Attackable) _actor;
|
||||||
npc.stopHating(getAttackTarget());
|
npc.stopHating(getAttackTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_ACTIVE);
|
setIntention(AI_INTENTION_ACTIVE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -45,12 +45,13 @@ import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages AI of Creature.<br>
|
* This class manages AI of Creature.<br>
|
||||||
* <br>
|
* CreatureAI :
|
||||||
* CreatureAI:<br>
|
* <ul>
|
||||||
* <li>AttackableAI</li>
|
* <li>AttackableAI</li>
|
||||||
* <li>DoorAI</li>
|
* <li>DoorAI</li>
|
||||||
* <li>PlayerAI</li>
|
* <li>PlayerAI</li>
|
||||||
* <li>SummonAI</li>
|
* <li>SummonAI</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class CreatureAI extends AbstractAI
|
public class CreatureAI extends AbstractAI
|
||||||
{
|
{
|
||||||
@@ -75,12 +76,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Idle Intention : Stop Attack, Movement and Stand Up the actor.<br>
|
* Manage the Idle Intention : Stop Attack, Movement and Stand Up the actor.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
||||||
* <li>Init cast and attack target</li>
|
* <li>Init cast and attack target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Stand up the actor server side AND client side by sending Server->Client packet ChangeWaitType (broadcast)</li>
|
* <li>Stand up the actor server side AND client side by sending Server->Client packet ChangeWaitType (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionIdle()
|
protected void onIntentionIdle()
|
||||||
@@ -102,12 +105,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Active Intention : Stop Attack, Movement and Launch Think Event.<br>
|
* Manage the Active Intention : Stop Attack, Movement and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>if the Intention is not already Active</i></b><br>
|
* <b><u>Actions</u> : <i>if the Intention is not already Active</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_ACTIVE</li>
|
* <li>Set the AI Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Init cast and attack target</li>
|
* <li>Init cast and attack target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch the Think Event</li><br>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
* @param target
|
* @param target
|
||||||
*/
|
*/
|
||||||
protected void onIntentionActive(Creature target)
|
protected void onIntentionActive(Creature target)
|
||||||
@@ -143,8 +148,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Rest Intention.<br>
|
* Manage the Rest Intention.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
* <li>Set the AI Intention to AI_INTENTION_IDLE</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
@@ -156,15 +163,19 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event.<br>
|
* Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_ATTACK</li>
|
||||||
* <li>Set or change the AI attack target</li>
|
* <li>Set or change the AI attack target</li>
|
||||||
* <li>Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart (broadcast)</li>
|
* <li>Start the actor Auto Attack client side by sending Server->Client packet AutoAttackStart (broadcast)</li>
|
||||||
* <li>Launch the Think Event</li><br>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Overridden in</u>:</b><br>
|
* <b><u>Overridden in</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>AttackableAI : Calculate attack timeout</li>
|
* <li>AttackableAI : Calculate attack timeout</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionAttack(Creature target)
|
protected void onIntentionAttack(Creature target)
|
||||||
@@ -226,13 +237,15 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Cast Intention : Stop current Attack, Init the AI in order to cast and Launch Think Event.<br>
|
* Manage the Cast Intention : Stop current Attack, Init the AI in order to cast and Launch Think Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI cast target</li>
|
* <li>Set the AI cast target</li>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor</li>
|
* <li>Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor</li>
|
||||||
* <li>Set the AI skill used by INTENTION_CAST</li>
|
* <li>Set the AI skill used by INTENTION_CAST</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_CAST</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_CAST</li>
|
||||||
* <li>Launch the Think Event</li>
|
* <li>Launch the Think Event</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionCast(Skill skill, WorldObject target)
|
protected void onIntentionCast(Skill skill, WorldObject target)
|
||||||
@@ -291,10 +304,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<br>
|
* Manage the Move To Intention : Stop current Attack and Launch a Move to Location Task.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionMoveTo(Location pos)
|
protected void onIntentionMoveTo(Location pos)
|
||||||
@@ -382,10 +397,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<br>
|
* Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_FOLLOW</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_FOLLOW</li>
|
||||||
* <li>Create and Launch an AI Follow Task to execute every 1s</li>
|
* <li>Create and Launch an AI Follow Task to execute every 1s</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionFollow(Creature target)
|
protected void onIntentionFollow(Creature target)
|
||||||
@@ -438,10 +455,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the PickUp Intention : Set the pick up target and Launch a Move To Pawn Task (offset=20).<br>
|
* Manage the PickUp Intention : Set the pick up target and Launch a Move To Pawn Task (offset=20).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Set the AI pick up target</li>
|
* <li>Set the AI pick up target</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_PICK_UP</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_PICK_UP</li>
|
||||||
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionPickUp(WorldObject object)
|
protected void onIntentionPickUp(WorldObject object)
|
||||||
@@ -494,11 +513,13 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Interact Intention : Set the interact target and Launch a Move To Pawn Task (offset=60).<br>
|
* Manage the Interact Intention : Set the interact target and Launch a Move To Pawn Task (offset=60).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : </b><br>
|
* <b><u>Actions</u> : </b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the AI interact target</li>
|
* <li>Set the AI interact target</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_INTERACT</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_INTERACT</li>
|
||||||
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionInteract(WorldObject object)
|
protected void onIntentionInteract(WorldObject object)
|
||||||
@@ -554,12 +575,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Stunned then onAttacked Event.<br>
|
* Launch actions corresponding to the Event Stunned then onAttacked Event.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked (only for AttackableAI after the stunning periode)</li>
|
* <li>Launch actions corresponding to the Event onAttacked (only for AttackableAI after the stunning periode)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtStunned(Creature attacker)
|
protected void onEvtStunned(Creature attacker)
|
||||||
@@ -584,11 +607,13 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Sleeping.<br>
|
* Launch actions corresponding to the Event Sleeping.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break an attack and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtSleeping(Creature attacker)
|
protected void onEvtSleeping(Creature attacker)
|
||||||
@@ -610,9 +635,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Rooted.<br>
|
* Launch actions corresponding to the Event Rooted.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked</li>
|
* <li>Launch actions corresponding to the Event onAttacked</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtRooted(Creature attacker)
|
protected void onEvtRooted(Creature attacker)
|
||||||
@@ -632,9 +659,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Confused.<br>
|
* Launch actions corresponding to the Event Confused.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Launch actions corresponding to the Event onAttacked</li>
|
* <li>Launch actions corresponding to the Event onAttacked</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtConfused(Creature attacker)
|
protected void onEvtConfused(Creature attacker)
|
||||||
@@ -649,8 +678,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Muted.<br>
|
* Launch actions corresponding to the Event Muted.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
* <li>Break a cast and send Server->Client ActionFailed packet and a System Message to the Creature</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtMuted(Creature attacker)
|
protected void onEvtMuted(Creature attacker)
|
||||||
@@ -662,8 +693,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ReadyToAct.<br>
|
* Launch actions corresponding to the Event ReadyToAct.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtReadyToAct()
|
protected void onEvtReadyToAct()
|
||||||
@@ -684,9 +717,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Arrived.<br>
|
* Launch actions corresponding to the Event Arrived.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrived()
|
protected void onEvtArrived()
|
||||||
@@ -726,8 +761,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ArrivedRevalidate.<br>
|
* Launch actions corresponding to the Event ArrivedRevalidate.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedRevalidate()
|
protected void onEvtArrivedRevalidate()
|
||||||
@@ -739,10 +776,12 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ArrivedBlocked.<br>
|
* Launch actions corresponding to the Event ArrivedBlocked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedBlocked(Location location)
|
protected void onEvtArrivedBlocked(Location location)
|
||||||
@@ -763,12 +802,14 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event ForgetObject.<br>
|
* Launch actions corresponding to the Event ForgetObject.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted and the Intention was AI_INTENTION_INTERACT or AI_INTENTION_PICK_UP, set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to attack, stop the auto-attack, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to attack, stop the auto-attack, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to cast, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to cast, cancel target and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the object was targeted to follow, stop the movement, cancel AI Follow Task and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If the object was targeted to follow, stop the movement, cancel AI Follow Task and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>If the targeted object was the actor , cancel AI target, stop AI Follow Task, stop the movement and set the Intention to AI_INTENTION_IDLE</li>
|
* <li>If the targeted object was the actor , cancel AI target, stop AI Follow Task, stop the movement and set the Intention to AI_INTENTION_IDLE</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtForgetObject(WorldObject object)
|
protected void onEvtForgetObject(WorldObject object)
|
||||||
@@ -822,30 +863,34 @@ public class CreatureAI extends AbstractAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the targeted object was the actor
|
// Check if the targeted object was the actor
|
||||||
if (_actor == object)
|
if (_actor != object)
|
||||||
{
|
{
|
||||||
// Cancel AI target
|
return;
|
||||||
setTarget(null);
|
|
||||||
setAttackTarget(null);
|
|
||||||
setCastTarget(null);
|
|
||||||
|
|
||||||
// Stop an AI Follow Task
|
|
||||||
stopFollow();
|
|
||||||
|
|
||||||
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
|
|
||||||
clientStopMoving(null);
|
|
||||||
|
|
||||||
// Set the Intention of this AbstractAI to AI_INTENTION_IDLE
|
|
||||||
changeIntention(AI_INTENTION_IDLE, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cancel AI target
|
||||||
|
setTarget(null);
|
||||||
|
setAttackTarget(null);
|
||||||
|
setCastTarget(null);
|
||||||
|
|
||||||
|
// Stop an AI Follow Task
|
||||||
|
stopFollow();
|
||||||
|
|
||||||
|
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
|
||||||
|
clientStopMoving(null);
|
||||||
|
|
||||||
|
// Set the Intention of this AbstractAI to AI_INTENTION_IDLE
|
||||||
|
changeIntention(AI_INTENTION_IDLE, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Cancel.<br>
|
* Launch actions corresponding to the Event Cancel.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
* <li>Launch actions corresponding to the Event Think</li>
|
* <li>Launch actions corresponding to the Event Think</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtCancel()
|
protected void onEvtCancel()
|
||||||
@@ -865,9 +910,11 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Dead.<br>
|
* Launch actions corresponding to the Event Dead.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
* <li>Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die (broadcast)</li>
|
* <li>Kill the actor client side by sending Server->Client packet AutoAttackStop, StopMove/StopRotation, Die (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtDead()
|
protected void onEvtDead()
|
||||||
@@ -887,8 +934,10 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Fake Death.<br>
|
* Launch actions corresponding to the Event Fake Death.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop an AI Follow Task</li>
|
* <li>Stop an AI Follow Task</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtFakeDeath()
|
protected void onEvtFakeDeath()
|
||||||
@@ -918,13 +967,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Manage the Move to Pawn action in function of the distance and of the Interact area.<br>
|
* Manage the Move to Pawn action in function of the distance and of the Interact area.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Get the distance between the current position of the Creature and the target (x,y)</li>
|
* <li>Get the distance between the current position of the Creature and the target (x,y)</li>
|
||||||
* <li>If the distance > offset+20, move the actor (by running) to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
* <li>If the distance > offset+20, move the actor (by running) to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)</li>
|
||||||
* <li>If the distance <= offset+20, Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li><br>
|
* <li>If the distance <= offset+20, Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PLayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @param offsetValue The Interact area radius
|
* @param offsetValue The Interact area radius
|
||||||
* @return True if a movement must be done
|
* @return True if a movement must be done
|
||||||
@@ -937,11 +990,9 @@ public class CreatureAI extends AbstractAI
|
|||||||
// LOGGER.warning("maybeMoveToPawn: target == NULL!");
|
// LOGGER.warning("maybeMoveToPawn: target == NULL!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skill radius -1
|
|
||||||
if (offsetValue < 0)
|
if (offsetValue < 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false; // skill radius -1
|
||||||
}
|
}
|
||||||
|
|
||||||
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
|
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
|
||||||
@@ -1031,15 +1082,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Modify current Intention and actions if the target is lost or dead.<br>
|
* Modify current Intention and actions if the target is lost or dead.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>If the target is lost or dead</i></b><br>
|
* <b><u>Actions</u> : <i>If the target is lost or dead</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li><br>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation<br>
|
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li>
|
||||||
* (broadcast)</li>
|
* </ul>
|
||||||
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li><br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PLayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost or dead (false if fakedeath)
|
* @return True if the target is lost or dead (false if fakedeath)
|
||||||
*/
|
*/
|
||||||
@@ -1056,7 +1109,6 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE
|
// Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE
|
||||||
setIntention(AI_INTENTION_ACTIVE);
|
setIntention(AI_INTENTION_ACTIVE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1065,13 +1117,17 @@ public class CreatureAI extends AbstractAI
|
|||||||
/**
|
/**
|
||||||
* Modify current Intention and actions if the target is lost.<br>
|
* Modify current Intention and actions if the target is lost.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u> : <i>If the target is lost</i></b><br>
|
* <b><u>Actions</u> : <i>If the target is lost</i></b>
|
||||||
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
* <li>Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)</li>
|
||||||
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li><br>
|
* <li>Set the Intention of this AbstractAI to AI_INTENTION_ACTIVE</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <li>PLayerAI, SummonAI</li><br>
|
* <ul>
|
||||||
|
* <li>PlayerAI, SummonAI</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,48 +19,86 @@ package org.l2jmobius.gameserver.ai;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface of AI and client state. To correctly send messages to client we need it's state. For example, if we've sent 'StartAutoAttack' message, we need to send 'StopAutoAttack' message before any other action. Or if we've sent 'MoveToPawn', we need to send 'StopMove' when the movement of a
|
* Interface of AI and client state.<br>
|
||||||
* character is canceled (by Root spell or any other reason). Thus, we need to know the state of client, i.e. which messages we've sent and how the client will show the scene. Close to this task is the task of AI. If a player's character is attacking a mob, his ATTACK may be interrupted by an event,
|
* To correctly send messages to client we need it's state.<br>
|
||||||
* that temporary disable attacking. But when the possibility to ATTACK will be enabled, the character must continue the ATTACK. For mobs it may be more complex, since we want them to decide when to use magic, or when to follow the player for physical combat, or when to escape, to help another mob,
|
* For example, if we've sent 'StartAutoAttack' message, we need to send 'StopAutoAttack' message before any other action.<br>
|
||||||
* etc. This interface is hiding complexity of server<->client interaction and multiple states of a character. It allows to set a desired, simple "wish" of a character, and the implementation of this interface will take care about the rest. The goal of a character may be like "ATTACK", "random walk"
|
* Or if we've sent 'MoveToPawn', we need to send 'StopMove' when the movement of a character is canceled (by Root spell or any other reason).<br>
|
||||||
* and so on. To reach the goal implementation will split it into several small actions, several steps (possibly repeatable). Like "run to target" then "hit it", then if target is not dead - repeat. This flow of simpler steps may be interrupted by incoming events. Like a character's movement was
|
* Thus, we need to know the state of client, i.e. which messages we've sent and how the client will show the scene.<br>
|
||||||
* disabled (by Root spell, for instance). Depending on character's ability AI may choose to wait, or to use magic ATTACK and so on. Additionally incoming events are compared with client's state of the character, and required network messages are sent to client's, i.e. if we have incoming event that
|
* Close to this task is the task of AI.<br>
|
||||||
* character's movement was disabled, it causes changing if its Behavior, and if client's state for the character is "moving" we send messages to clients to stop the avatar/mob.
|
* If a player's character is attacking a mob, his ATTACK may be interrupted by an event, that temporary disable attacking.<br>
|
||||||
|
* But when the possibility to ATTACK will be enabled, the character must continue the ATTACK.<br>
|
||||||
|
* For mobs it may be more complex, since we want them to decide when to use magic, or when to follow the player for physical combat, or when to escape, to help another mob, etc.<br>
|
||||||
|
* This interface is hiding complexity of server<->client interaction and multiple states of a character.<br>
|
||||||
|
* It allows to set a desired, simple "wish" of a character, and the implementation of this interface will take care about the rest.<br>
|
||||||
|
* The goal of a character may be like "ATTACK", "random walk" and so on.<br>
|
||||||
|
* To reach the goal implementation will split it into several small actions, several steps (possibly repeatable).<br>
|
||||||
|
* Like "run to target" then "hit it", then if target is not dead - repeat.<br>
|
||||||
|
* This flow of simpler steps may be interrupted by incoming events.<br>
|
||||||
|
* Like a character's movement was disabled (by Root spell, for instance).<br>
|
||||||
|
* Depending on character's ability AI may choose to wait, or to use magic ATTACK and so on.<br>
|
||||||
|
* Additionally incoming events are compared with client's state of the character,<br>
|
||||||
|
* and required network messages are sent to client's, i.e. if we have incoming event that character's movement was disabled, it causes changing if its behavior,<br>
|
||||||
|
* and if client's state for the character is "moving" we send messages to clients to stop the avatar/mob.
|
||||||
*/
|
*/
|
||||||
public interface Ctrl
|
public interface Ctrl
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return the character this AI serves
|
* Gets the actor.
|
||||||
|
* @return the actor
|
||||||
*/
|
*/
|
||||||
Creature getActor();
|
Creature getActor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current intention.
|
* Gets the intention.
|
||||||
|
* @return the intention
|
||||||
*/
|
*/
|
||||||
CtrlIntention getIntention();
|
CtrlIntention getIntention();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current attack target.
|
* Gets the attack target.
|
||||||
|
* @return the attack target
|
||||||
*/
|
*/
|
||||||
Creature getAttackTarget();
|
Creature getAttackTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set general state/intention for AI, with optional data
|
* Set general state/intention for AI, with optional data.
|
||||||
* @param intention
|
* @param intention the new intention
|
||||||
*/
|
*/
|
||||||
void setIntention(CtrlIntention intention);
|
void setIntention(CtrlIntention intention);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the intention.
|
||||||
|
* @param intention the intention
|
||||||
|
* @param arg0 the arg0
|
||||||
|
*/
|
||||||
void setIntention(CtrlIntention intention, Object arg0);
|
void setIntention(CtrlIntention intention, Object arg0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the intention.
|
||||||
|
* @param intention the intention
|
||||||
|
* @param arg0 the arg0
|
||||||
|
* @param arg1 the arg1
|
||||||
|
*/
|
||||||
void setIntention(CtrlIntention intention, Object arg0, Object arg1);
|
void setIntention(CtrlIntention intention, Object arg0, Object arg1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event, that notifies about previous step result, or user command, that does not change current general intention
|
* Event, that notifies about previous step result, or user command, that does not change current general intention.
|
||||||
* @param evt
|
* @param evt the event
|
||||||
*/
|
*/
|
||||||
void notifyEvent(CtrlEvent evt);
|
void notifyEvent(CtrlEvent evt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify an event.
|
||||||
|
* @param evt the event
|
||||||
|
* @param arg0 the arg0
|
||||||
|
*/
|
||||||
void notifyEvent(CtrlEvent evt, Object arg0);
|
void notifyEvent(CtrlEvent evt, Object arg0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify an event.
|
||||||
|
* @param evt the event
|
||||||
|
* @param arg0 the arg0
|
||||||
|
* @param arg1 the arg1
|
||||||
|
*/
|
||||||
void notifyEvent(CtrlEvent evt, Object arg0, Object arg1);
|
void notifyEvent(CtrlEvent evt, Object arg0, Object arg1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,31 +17,40 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains an enum of each possibles evenements that can happen on an AI character.
|
* This class contains an enum of each possibles events that can happen on an AI character.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CtrlEvent
|
public enum CtrlEvent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action
|
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
||||||
*/
|
*/
|
||||||
EVT_THINK,
|
EVT_THINK,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor was attacked. This event comes each time a physical or magical attack was done on the actor. NPC may start attack in responce, or ignore this event if they already attack someone, or change target and so on.
|
* The actor was attacked. This event comes each time a physical or magical<br>
|
||||||
|
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
||||||
|
* this event if they already attack someone, or change target and so on.
|
||||||
*/
|
*/
|
||||||
EVT_ATTACKED,
|
EVT_ATTACKED,
|
||||||
|
|
||||||
/** Increase/decrease aggression towards a target, or reduce global aggression if target is null */
|
/**
|
||||||
|
* Increase/decrease aggression towards a target, or reduce global aggression if target is null
|
||||||
|
*/
|
||||||
EVT_AGGRESSION,
|
EVT_AGGRESSION,
|
||||||
|
|
||||||
/** Actor is in stun state */
|
/**
|
||||||
|
* Actor is in stun state
|
||||||
|
*/
|
||||||
EVT_STUNNED,
|
EVT_STUNNED,
|
||||||
|
|
||||||
/** Actor starts/stops sleeping */
|
/**
|
||||||
|
* Actor starts/stops sleeping
|
||||||
|
*/
|
||||||
EVT_SLEEPING,
|
EVT_SLEEPING,
|
||||||
|
|
||||||
/** Actor is in rooted state (cannot move) */
|
/**
|
||||||
|
* Actor is in rooted state (cannot move)
|
||||||
|
*/
|
||||||
EVT_ROOTED,
|
EVT_ROOTED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,40 +69,61 @@ public enum CtrlEvent
|
|||||||
EVT_ARRIVED,
|
EVT_ARRIVED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to an intermidiate point, and needs revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED_REVALIDATE,
|
EVT_ARRIVED_REVALIDATE,
|
||||||
|
|
||||||
/** The actor cannot move anymore. */
|
/**
|
||||||
|
* The actor cannot move anymore.
|
||||||
|
*/
|
||||||
EVT_ARRIVED_BLOCKED,
|
EVT_ARRIVED_BLOCKED,
|
||||||
|
|
||||||
/** Forgets an object (if it's used as attack target, follow target and so on */
|
/**
|
||||||
|
* Forgets an object (if it's used as attack target, follow target and so on
|
||||||
|
*/
|
||||||
EVT_FORGET_OBJECT,
|
EVT_FORGET_OBJECT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to cancel current step execution, but not change the intention. For example, the actor was putted into a stun, so it's current attack or movement has to be canceled. But after the stun state expired, the actor may try to attack again. Another usage for CANCEL is a user's attempt to
|
* Attempt to cancel current step execution, but not change the intention.<br>
|
||||||
* cancel a cast/bow attack and so on.
|
* For example, the actor was put into a stun, so it's current attack<br>
|
||||||
|
* or movement has to be canceled. But after the stun state expired,<br>
|
||||||
|
* the actor may try to attack again. Another usage for CANCEL is a user's<br>
|
||||||
|
* attempt to cancel a cast/bow attack and so on.
|
||||||
*/
|
*/
|
||||||
EVT_CANCEL,
|
EVT_CANCEL,
|
||||||
|
|
||||||
/** The creature is dead */
|
/**
|
||||||
|
* The creature is dead
|
||||||
|
*/
|
||||||
EVT_DEAD,
|
EVT_DEAD,
|
||||||
|
|
||||||
/** The creature looks like dead */
|
/**
|
||||||
|
* The creature looks like dead
|
||||||
|
*/
|
||||||
EVT_FAKE_DEATH,
|
EVT_FAKE_DEATH,
|
||||||
|
|
||||||
/** The creature attack anyone randomly **/
|
/**
|
||||||
|
* The creature attack anyone randomly
|
||||||
|
*/
|
||||||
EVT_CONFUSED,
|
EVT_CONFUSED,
|
||||||
|
|
||||||
/** The creature cannot cast spells anymore **/
|
/**
|
||||||
|
* The creature cannot cast spells anymore
|
||||||
|
*/
|
||||||
EVT_MUTED,
|
EVT_MUTED,
|
||||||
|
|
||||||
/** The creature flee in randoms directions **/
|
/**
|
||||||
EVT_AFFRAID,
|
* The creature flee in random directions
|
||||||
|
*/
|
||||||
|
EVT_AFRAID,
|
||||||
|
|
||||||
/** The creature finish casting **/
|
/**
|
||||||
|
* The creature finish casting
|
||||||
|
*/
|
||||||
EVT_FINISH_CASTING,
|
EVT_FINISH_CASTING,
|
||||||
|
|
||||||
/** The creature betrayed its master */
|
/**
|
||||||
|
* The creature betrayed its master
|
||||||
|
*/
|
||||||
EVT_BETRAYED
|
EVT_BETRAYED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,8 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumaration of generic intentions of an NPC/PC, an intention may require several steps to be completed
|
* Enumeration of generic intentions of an NPC/PC, an intention may require several steps to be completed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CtrlIntention
|
public enum CtrlIntention
|
||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
@@ -31,9 +30,7 @@ public enum CtrlIntention
|
|||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/**
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
* Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peacefull zone and so on
|
|
||||||
*/
|
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
|
|||||||
@@ -35,144 +35,120 @@ public class DoorAI extends CreatureAI
|
|||||||
super(accessor);
|
super(accessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rather stupid AI... well, it's for doors :D
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionIdle()
|
protected void onIntentionIdle()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionActive()
|
protected void onIntentionActive()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionAttack(Creature target)
|
protected void onIntentionAttack(Creature target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionCast(Skill skill, WorldObject target)
|
protected void onIntentionCast(Skill skill, WorldObject target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionMoveTo(Location destination)
|
protected void onIntentionMoveTo(Location destination)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionFollow(Creature target)
|
protected void onIntentionFollow(Creature target)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionPickUp(WorldObject item)
|
protected void onIntentionPickUp(WorldObject item)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onIntentionInteract(WorldObject object)
|
protected void onIntentionInteract(WorldObject object)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvtThink()
|
public void onEvtThink()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtAttacked(Creature attacker)
|
protected void onEvtAttacked(Creature attacker)
|
||||||
{
|
{
|
||||||
final DoorInstance me = (DoorInstance) _actor;
|
ThreadPool.execute(new onEventAttackedDoorTask((DoorInstance) _actor, attacker));
|
||||||
ThreadPool.execute(new onEventAttackedDoorTask(me, attacker));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtAggression(Creature target, int aggro)
|
protected void onEvtAggression(Creature target, int aggro)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtStunned(Creature attacker)
|
protected void onEvtStunned(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtSleeping(Creature attacker)
|
protected void onEvtSleeping(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtRooted(Creature attacker)
|
protected void onEvtRooted(Creature attacker)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtReadyToAct()
|
protected void onEvtReadyToAct()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtUserCmd(Object arg0, Object arg1)
|
protected void onEvtUserCmd(Object arg0, Object arg1)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrived()
|
protected void onEvtArrived()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedRevalidate()
|
protected void onEvtArrivedRevalidate()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtArrivedBlocked(Location blocked_at_pos)
|
protected void onEvtArrivedBlocked(Location blocked_at_loc)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtForgetObject(WorldObject object)
|
protected void onEvtForgetObject(WorldObject object)
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtCancel()
|
protected void onEvtCancel()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEvtDead()
|
protected void onEvtDead()
|
||||||
{
|
{
|
||||||
// null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class onEventAttackedDoorTask implements Runnable
|
private class onEventAttackedDoorTask implements Runnable
|
||||||
|
|||||||
@@ -104,35 +104,41 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -268,10 +274,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor can't attack, order to it to return to its home location</li>
|
* <li>If the actor can't attack, order to it to return to its home location</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -362,11 +370,13 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI attack thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update the attack timeout if actor is running</li>
|
* <li>Update the attack timeout if actor is running</li>
|
||||||
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
* <li>If target is dead or timeout is expired, stop this attack and set the Intention to AI_INTENTION_ACTIVE</li>
|
||||||
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
* <li>Call all WorldObject of its Faction inside the Faction Range</li>
|
||||||
* <li>Chose a target and order to attack it with magic skill or physical attack</li><br>
|
* <li>Chose a target and order to attack it with magic skill or physical attack</li>
|
||||||
|
* </ul>
|
||||||
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
* TODO: Manage casting rules to healer mobs (like Ant Nurses)
|
||||||
*/
|
*/
|
||||||
private void thinkAttack()
|
private void thinkAttack()
|
||||||
@@ -592,7 +602,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
FortSiegeGuardInstance sGuard;
|
FortSiegeGuardInstance sGuard;
|
||||||
sGuard = (FortSiegeGuardInstance) _actor;
|
sGuard = (FortSiegeGuardInstance) _actor;
|
||||||
Creature attackTarget = getAttackTarget();
|
Creature attackTarget = getAttackTarget();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_actor.setTarget(attackTarget);
|
_actor.setTarget(attackTarget);
|
||||||
@@ -854,10 +863,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -893,9 +904,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
|
* </ul>
|
||||||
* @param target The Creature that attacks
|
* @param target The Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -143,18 +143,18 @@ public class PlayerAI extends CreatureAI
|
|||||||
@Override
|
@Override
|
||||||
protected void onIntentionRest()
|
protected void onIntentionRest()
|
||||||
{
|
{
|
||||||
if (getIntention() != AI_INTENTION_REST)
|
if (getIntention() == AI_INTENTION_REST)
|
||||||
{
|
{
|
||||||
changeIntention(AI_INTENTION_REST, null, null);
|
return;
|
||||||
setTarget(null);
|
|
||||||
|
|
||||||
if (getAttackTarget() != null)
|
|
||||||
{
|
|
||||||
setAttackTarget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
clientStopMoving(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeIntention(AI_INTENTION_REST, null, null);
|
||||||
|
setTarget(null);
|
||||||
|
if (getAttackTarget() != null)
|
||||||
|
{
|
||||||
|
setAttackTarget(null);
|
||||||
|
}
|
||||||
|
clientStopMoving(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,14 +46,12 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class SiegeGuardAI extends CreatureAI implements Runnable
|
public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||||
{
|
{
|
||||||
// protected static final Logger LOGGER = Logger.getLogger(SiegeGuardAI.class);
|
|
||||||
|
|
||||||
private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
|
private static final int MAX_ATTACK_TIMEOUT = 300; // int ticks, i.e. 30 seconds
|
||||||
|
|
||||||
/** The Attackable AI task executed every 1s (call onEvtThink method) */
|
/** The Attackable AI task executed every 1s (call onEvtThink method) */
|
||||||
private Future<?> _aiTask;
|
private Future<?> _aiTask;
|
||||||
|
|
||||||
/** The delay after wich the attacked is stopped */
|
/** The delay after which the attacked is stopped */
|
||||||
private int _attackTimeout;
|
private int _attackTimeout;
|
||||||
|
|
||||||
/** The Attackable aggro counter */
|
/** The Attackable aggro counter */
|
||||||
@@ -85,35 +83,41 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return True if the target is autoattackable (depends on the actor type).<br>
|
* <b><u>Actor is a GuardInstance</u>:</b>
|
||||||
* <br>
|
* <ul>
|
||||||
* <b><u>Actor is a GuardInstance</u>:</b><br>
|
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
* <li>The MonsterInstance target is aggressive</li><br>
|
* <li>The MonsterInstance target is aggressive</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a SiegeGuardInstance</u>:</b><br>
|
* <b><u>Actor is a SiegeGuardInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk or a Door</li>
|
* <li>The target isn't a Folk or a Door</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>A siege is in progress</li>
|
* <li>A siege is in progress</li>
|
||||||
* <li>The PlayerInstance target isn't a Defender</li><br>
|
* <li>The PlayerInstance target isn't a Defender</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a FriendlyMobInstance</u>:</b><br>
|
* <b><u>Actor is a FriendlyMobInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The PlayerInstance target has karma (=PK)</li><br>
|
* <li>The PlayerInstance target has karma (=PK)</li>
|
||||||
|
* </ul>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actor is a MonsterInstance</u>:</b><br>
|
* <b><u>Actor is a MonsterInstance</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
* <li>The target isn't a Folk, a Door or another NpcInstance</li>
|
||||||
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
* <li>The target isn't dead, isn't invulnerable, isn't in silent moving mode AND too far (>100)</li>
|
||||||
* <li>The target is in the actor Aggro range and is at the same height</li>
|
* <li>The target is in the actor Aggro range and is at the same height</li>
|
||||||
* <li>The actor is Aggressive</li><br>
|
* <li>The actor is Aggressive</li>
|
||||||
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return
|
* @return True if the target is autoattackable (depends on the actor type).
|
||||||
*/
|
*/
|
||||||
private boolean autoAttackCondition(Creature target)
|
private boolean autoAttackCondition(Creature target)
|
||||||
{
|
{
|
||||||
@@ -221,10 +225,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
* Manage AI standard thinks of a Attackable (called by onEvtThink).<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
* <li>Update every 1s the _globalAggro counter to come close to 0</li>
|
||||||
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
* <li>If the actor is Aggressive and can attack, add all autoAttackable Creature in its Aggro Range to its _aggroList, chose a target and order to attack it</li>
|
||||||
* <li>If the actor can't attack, order to it to return to its home location</li>
|
* <li>If the actor can't attack, order to it to return to its home location</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private void thinkActive()
|
private void thinkActive()
|
||||||
{
|
{
|
||||||
@@ -661,10 +667,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Attacked.<br>
|
* Launch actions corresponding to the Event Attacked.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
* <li>Init the attack : Calculate the attack timeout, Set the _globalAggro to 0, Add the attacker to the actor _aggroList</li>
|
||||||
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
* <li>Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance</li>
|
||||||
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
* <li>Set the Intention to AI_INTENTION_ATTACK</li>
|
||||||
|
* </ul>
|
||||||
* @param attacker The Creature that attacks the actor
|
* @param attacker The Creature that attacks the actor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -700,10 +708,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
/**
|
/**
|
||||||
* Launch actions corresponding to the Event Aggression.<br>
|
* Launch actions corresponding to the Event Aggression.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Actions</u>:</b><br>
|
* <b><u>Actions</u>:</b>
|
||||||
|
* <ul>
|
||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li><br>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* @param target The Creature that attacks
|
* </ul>
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,11 +17,8 @@
|
|||||||
package org.l2jmobius.gameserver.ai;
|
package org.l2jmobius.gameserver.ai;
|
||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_CAST;
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_INTERACT;
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.Skill;
|
import org.l2jmobius.gameserver.model.Skill;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -162,21 +159,28 @@ public class SummonAI extends CreatureAI
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (getIntention() == AI_INTENTION_ATTACK)
|
switch (getIntention())
|
||||||
{
|
{
|
||||||
thinkAttack();
|
case AI_INTENTION_ATTACK:
|
||||||
}
|
{
|
||||||
else if (getIntention() == AI_INTENTION_CAST)
|
thinkAttack();
|
||||||
{
|
break;
|
||||||
thinkCast();
|
}
|
||||||
}
|
case AI_INTENTION_CAST:
|
||||||
else if (getIntention() == AI_INTENTION_PICK_UP)
|
{
|
||||||
{
|
thinkCast();
|
||||||
thinkPickUp();
|
break;
|
||||||
}
|
}
|
||||||
else if (getIntention() == AI_INTENTION_INTERACT)
|
case AI_INTENTION_PICK_UP:
|
||||||
{
|
{
|
||||||
thinkInteract();
|
thinkPickUp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AI_INTENTION_INTERACT:
|
||||||
|
{
|
||||||
|
thinkInteract();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -3373,7 +3373,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
public void startFear()
|
public void startFear()
|
||||||
{
|
{
|
||||||
setAfraid(true);
|
setAfraid(true);
|
||||||
getAI().notifyEvent(CtrlEvent.EVT_AFFRAID);
|
getAI().notifyEvent(CtrlEvent.EVT_AFRAID);
|
||||||
updateAbnormalEffect();
|
updateAbnormalEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
||||||
* Overridden in</u>:</b><br>
|
* Overridden in</u>:</b><br>
|
||||||
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
||||||
* <b>L2PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
* <b>PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
||||||
* @param intention The new Intention to set to the AI
|
* @param intention The new Intention to set to the AI
|
||||||
* @param arg0 The first parameter of the Intention
|
* @param arg0 The first parameter of the Intention
|
||||||
* @param arg1 The second parameter of the Intention
|
* @param arg1 The second parameter of the Intention
|
||||||
@@ -184,6 +184,13 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
setIntention(intention, arg0, null);
|
setIntention(intention, arg0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the CreatureAI onIntention method corresponding to the new Intention.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: Stop the FOLLOW mode if necessary</b></font>
|
||||||
|
* @param intention The new Intention to set to the AI
|
||||||
|
* @param arg0 The first parameter of the Intention (optional target)
|
||||||
|
* @param arg1 The second parameter of the Intention (optional target)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||||
{
|
{
|
||||||
@@ -262,7 +269,8 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event. <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
* @param arg0 The first parameter of the Event (optional target)
|
* @param arg0 The first parameter of the Event (optional target)
|
||||||
*/
|
*/
|
||||||
@@ -273,8 +281,10 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event. <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
|
* @param args The arguments of the Event
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void notifyEvent(CtrlEvent evt, Object... args)
|
public void notifyEvent(CtrlEvent evt, Object... args)
|
||||||
@@ -472,7 +482,8 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
protected abstract void onEvtAfraid(Creature effector, boolean start);
|
protected abstract void onEvtAfraid(Creature effector, boolean start);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor. <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
*/
|
*/
|
||||||
protected void clientActionFailed()
|
protected void clientActionFailed()
|
||||||
{
|
{
|
||||||
@@ -510,6 +521,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPacket = false;
|
sendPacket = false;
|
||||||
}
|
}
|
||||||
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = getActiveChar();
|
final Attackable me = getActiveChar();
|
||||||
|
|
||||||
// Check if the target isn't invulnerable
|
// Check if the target isn't invulnerable
|
||||||
@@ -180,6 +181,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.isSummon() && ((Summon) target).getOwner().isGM())
|
if (target.isSummon() && ((Summon) target).getOwner().isGM())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -2353,6 +2355,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* @param target the Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
{
|
{
|
||||||
moveToPawn(target, range);
|
moveToPawn(target, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actor.doAttack(target);
|
_actor.doAttack(target);
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1134,7 +1135,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -25,44 +25,74 @@ public enum CtrlEvent
|
|||||||
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
||||||
*/
|
*/
|
||||||
EVT_THINK,
|
EVT_THINK,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor was attacked. This event comes each time a physical or magical<br>
|
* The actor was attacked. This event comes each time a physical or magical<br>
|
||||||
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
||||||
* this event if they already attack someone, or change target and so on.
|
* this event if they already attack someone, or change target and so on.
|
||||||
*/
|
*/
|
||||||
EVT_ATTACKED,
|
EVT_ATTACKED,
|
||||||
/** Increase/decrease aggression towards a target, or reduce global aggression if target is null */
|
|
||||||
|
/**
|
||||||
|
* Increase/decrease aggression towards a target, or reduce global aggression if target is null
|
||||||
|
*/
|
||||||
EVT_AGGRESSION,
|
EVT_AGGRESSION,
|
||||||
/** Actor is in stun state */
|
|
||||||
|
/**
|
||||||
|
* Actor is in stun state
|
||||||
|
*/
|
||||||
EVT_STUNNED,
|
EVT_STUNNED,
|
||||||
/** Actor is paralyzed or petrified */
|
|
||||||
|
/**
|
||||||
|
* Actor is paralyzed or petrified
|
||||||
|
*/
|
||||||
EVT_PARALYZED,
|
EVT_PARALYZED,
|
||||||
/** Actor starts/stops sleeping */
|
|
||||||
|
/**
|
||||||
|
* Actor starts/stops sleeping
|
||||||
|
*/
|
||||||
EVT_SLEEPING,
|
EVT_SLEEPING,
|
||||||
/** Actor is in rooted state (cannot move) */
|
|
||||||
|
/**
|
||||||
|
* Actor is in rooted state (cannot move)
|
||||||
|
*/
|
||||||
EVT_ROOTED,
|
EVT_ROOTED,
|
||||||
/** Actor evaded hit **/
|
|
||||||
|
/**
|
||||||
|
* Actor evaded hit
|
||||||
|
*/
|
||||||
EVT_EVADED,
|
EVT_EVADED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event that previous action was completed. The action may be an attempt to physically/magically hit an enemy, or an action that discarded attack attempt has finished.
|
* An event that previous action was completed. The action may be an attempt to physically/magically hit an enemy, or an action that discarded attack attempt has finished.
|
||||||
*/
|
*/
|
||||||
EVT_READY_TO_ACT,
|
EVT_READY_TO_ACT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User's command, like using a combat magic or changing weapon, etc. The command is not intended to change final goal
|
* User's command, like using a combat magic or changing weapon, etc. The command is not intended to change final goal
|
||||||
*/
|
*/
|
||||||
EVT_USER_CMD,
|
EVT_USER_CMD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to assigned location, or it's a time to modify movement destination (follow, interact, random move and others intentions).
|
* The actor arrived to assigned location, or it's a time to modify movement destination (follow, interact, random move and others intentions).
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED,
|
EVT_ARRIVED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED_REVALIDATE,
|
EVT_ARRIVED_REVALIDATE,
|
||||||
/** The actor cannot move anymore. */
|
|
||||||
|
/**
|
||||||
|
* The actor cannot move anymore.
|
||||||
|
*/
|
||||||
EVT_ARRIVED_BLOCKED,
|
EVT_ARRIVED_BLOCKED,
|
||||||
/** Forgets an object (if it's used as attack target, follow target and so on */
|
|
||||||
|
/**
|
||||||
|
* Forgets an object (if it's used as attack target, follow target and so on
|
||||||
|
*/
|
||||||
EVT_FORGET_OBJECT,
|
EVT_FORGET_OBJECT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to cancel current step execution, but not change the intention.<br>
|
* Attempt to cancel current step execution, but not change the intention.<br>
|
||||||
* For example, the actor was put into a stun, so it's current attack<br>
|
* For example, the actor was put into a stun, so it's current attack<br>
|
||||||
@@ -71,18 +101,39 @@ public enum CtrlEvent
|
|||||||
* attempt to cancel a cast/bow attack and so on.
|
* attempt to cancel a cast/bow attack and so on.
|
||||||
*/
|
*/
|
||||||
EVT_CANCEL,
|
EVT_CANCEL,
|
||||||
/** The creature is dead */
|
|
||||||
|
/**
|
||||||
|
* The creature is dead
|
||||||
|
*/
|
||||||
EVT_DEAD,
|
EVT_DEAD,
|
||||||
/** The creature looks like dead */
|
|
||||||
|
/**
|
||||||
|
* The creature looks like dead
|
||||||
|
*/
|
||||||
EVT_FAKE_DEATH,
|
EVT_FAKE_DEATH,
|
||||||
/** The creature attack anyone randomly **/
|
|
||||||
|
/**
|
||||||
|
* The creature attack anyone randomly
|
||||||
|
*/
|
||||||
EVT_CONFUSED,
|
EVT_CONFUSED,
|
||||||
/** The creature cannot cast spells anymore **/
|
|
||||||
|
/**
|
||||||
|
* The creature cannot cast spells anymore
|
||||||
|
*/
|
||||||
EVT_MUTED,
|
EVT_MUTED,
|
||||||
/** The creature flee in random directions **/
|
|
||||||
|
/**
|
||||||
|
* The creature flee in random directions
|
||||||
|
*/
|
||||||
EVT_AFRAID,
|
EVT_AFRAID,
|
||||||
/** The creature finish casting **/
|
|
||||||
|
/**
|
||||||
|
* The creature finish casting
|
||||||
|
*/
|
||||||
EVT_FINISH_CASTING,
|
EVT_FINISH_CASTING,
|
||||||
/** The creature betrayed its master */
|
|
||||||
|
/**
|
||||||
|
* The creature betrayed its master
|
||||||
|
*/
|
||||||
EVT_BETRAYED
|
EVT_BETRAYED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,6 +418,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int chance = 4;
|
final int chance = 4;
|
||||||
if (chance >= Rnd.get(100))
|
if (chance >= Rnd.get(100))
|
||||||
{
|
{
|
||||||
@@ -427,6 +428,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject oldTarget = _actor.getTarget();
|
final WorldObject oldTarget = _actor.getTarget();
|
||||||
_actor.setTarget(npc);
|
_actor.setTarget(npc);
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
@@ -715,6 +717,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* @param target The Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -724,6 +727,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = (Attackable) _actor;
|
final Attackable me = (Attackable) _actor;
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeIntention(AI_INTENTION_REST, null, null);
|
changeIntention(AI_INTENTION_REST, null, null);
|
||||||
setTarget(null);
|
setTarget(null);
|
||||||
if (getAttackTarget() != null)
|
if (getAttackTarget() != null)
|
||||||
@@ -245,12 +246,14 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkTargetLostOrDead(target))
|
if (checkTargetLostOrDead(target))
|
||||||
{
|
{
|
||||||
// Notify the target
|
// Notify the target
|
||||||
setAttackTarget(null);
|
setAttackTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
|
if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -304,11 +307,13 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject target = getTarget();
|
final WorldObject target = getTarget();
|
||||||
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
_actor.getActingPlayer().doPickupItem(target);
|
_actor.getActingPlayer().doPickupItem(target);
|
||||||
}
|
}
|
||||||
@@ -319,15 +324,18 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject target = getTarget();
|
final WorldObject target = getTarget();
|
||||||
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(target instanceof StaticObjectInstance))
|
if (!(target instanceof StaticObjectInstance))
|
||||||
{
|
{
|
||||||
_actor.getActingPlayer().doInteract((Creature) target);
|
_actor.getActingPlayer().doInteract((Creature) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -725,6 +725,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = (Attackable) _actor;
|
final Attackable me = (Attackable) _actor;
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,10 +106,12 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
setAttackTarget(null);
|
setAttackTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
|
if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
_actor.doAttack(getAttackTarget());
|
_actor.doAttack(getAttackTarget());
|
||||||
}
|
}
|
||||||
@@ -122,11 +124,13 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
setCastTarget(null);
|
setCastTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean val = _startFollow;
|
final boolean val = _startFollow;
|
||||||
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
|
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
summon.setFollowStatus(false);
|
summon.setFollowStatus(false);
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
@@ -140,6 +144,7 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
((Summon) _actor).doPickupItem(getTarget());
|
((Summon) _actor).doPickupItem(getTarget());
|
||||||
}
|
}
|
||||||
@@ -150,6 +155,7 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +166,9 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_thinking = true;
|
_thinking = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (getIntention())
|
switch (getIntention())
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method is USED by AI classes</b></font><b><u><br>
|
||||||
* Overridden in</u>:</b><br>
|
* Overridden in</u>:</b><br>
|
||||||
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
* <b>AttackableAI</b> : Create an AI Task executed every 1s (if necessary)<br>
|
||||||
* <b>L2PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
* <b>PlayerAI</b> : Stores the current AI intention parameters to later restore it if necessary.
|
||||||
* @param intention The new Intention to set to the AI
|
* @param intention The new Intention to set to the AI
|
||||||
* @param arg0 The first parameter of the Intention
|
* @param arg0 The first parameter of the Intention
|
||||||
* @param arg1 The second parameter of the Intention
|
* @param arg1 The second parameter of the Intention
|
||||||
@@ -184,6 +184,13 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
setIntention(intention, arg0, null);
|
setIntention(intention, arg0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the CreatureAI onIntention method corresponding to the new Intention.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: Stop the FOLLOW mode if necessary</b></font>
|
||||||
|
* @param intention The new Intention to set to the AI
|
||||||
|
* @param arg0 The first parameter of the Intention (optional target)
|
||||||
|
* @param arg1 The second parameter of the Intention (optional target)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
public void setIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||||
{
|
{
|
||||||
@@ -262,7 +269,8 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event. <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
* @param arg0 The first parameter of the Event (optional target)
|
* @param arg0 The first parameter of the Event (optional target)
|
||||||
*/
|
*/
|
||||||
@@ -273,8 +281,10 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the CreatureAI onEvt method corresponding to the Event. <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period)</b></font>
|
* Launch the CreatureAI onEvt method corresponding to the Event.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode)</b></font>
|
||||||
* @param evt The event whose the AI must be notified
|
* @param evt The event whose the AI must be notified
|
||||||
|
* @param args The arguments of the Event
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void notifyEvent(CtrlEvent evt, Object... args)
|
public void notifyEvent(CtrlEvent evt, Object... args)
|
||||||
@@ -472,7 +482,8 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
protected abstract void onEvtAfraid(Creature effector, boolean start);
|
protected abstract void onEvtAfraid(Creature effector, boolean start);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor. <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor.<br>
|
||||||
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
*/
|
*/
|
||||||
protected void clientActionFailed()
|
protected void clientActionFailed()
|
||||||
{
|
{
|
||||||
@@ -510,6 +521,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPacket = false;
|
sendPacket = false;
|
||||||
}
|
}
|
||||||
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = getActiveChar();
|
final Attackable me = getActiveChar();
|
||||||
|
|
||||||
// Check if the target isn't invulnerable
|
// Check if the target isn't invulnerable
|
||||||
@@ -180,6 +181,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.isSummon() && ((Summon) target).getOwner().isGM())
|
if (target.isSummon() && ((Summon) target).getOwner().isGM())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -2353,6 +2355,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* @param target the Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ public class ControllableMobAI extends AttackableAI
|
|||||||
{
|
{
|
||||||
moveToPawn(target, range);
|
moveToPawn(target, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actor.doAttack(target);
|
_actor.doAttack(target);
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1134,7 +1135,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -25,44 +25,74 @@ public enum CtrlEvent
|
|||||||
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
* Something has changed, usually a previous step has being completed or maybe was completed, the AI must thing on next action.
|
||||||
*/
|
*/
|
||||||
EVT_THINK,
|
EVT_THINK,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor was attacked. This event comes each time a physical or magical<br>
|
* The actor was attacked. This event comes each time a physical or magical<br>
|
||||||
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
* attack was done on the actor. NPC may start attack in response, or ignore<br>
|
||||||
* this event if they already attack someone, or change target and so on.
|
* this event if they already attack someone, or change target and so on.
|
||||||
*/
|
*/
|
||||||
EVT_ATTACKED,
|
EVT_ATTACKED,
|
||||||
/** Increase/decrease aggression towards a target, or reduce global aggression if target is null */
|
|
||||||
|
/**
|
||||||
|
* Increase/decrease aggression towards a target, or reduce global aggression if target is null
|
||||||
|
*/
|
||||||
EVT_AGGRESSION,
|
EVT_AGGRESSION,
|
||||||
/** Actor is in stun state */
|
|
||||||
|
/**
|
||||||
|
* Actor is in stun state
|
||||||
|
*/
|
||||||
EVT_STUNNED,
|
EVT_STUNNED,
|
||||||
/** Actor is paralyzed or petrified */
|
|
||||||
|
/**
|
||||||
|
* Actor is paralyzed or petrified
|
||||||
|
*/
|
||||||
EVT_PARALYZED,
|
EVT_PARALYZED,
|
||||||
/** Actor starts/stops sleeping */
|
|
||||||
|
/**
|
||||||
|
* Actor starts/stops sleeping
|
||||||
|
*/
|
||||||
EVT_SLEEPING,
|
EVT_SLEEPING,
|
||||||
/** Actor is in rooted state (cannot move) */
|
|
||||||
|
/**
|
||||||
|
* Actor is in rooted state (cannot move)
|
||||||
|
*/
|
||||||
EVT_ROOTED,
|
EVT_ROOTED,
|
||||||
/** Actor evaded hit **/
|
|
||||||
|
/**
|
||||||
|
* Actor evaded hit
|
||||||
|
*/
|
||||||
EVT_EVADED,
|
EVT_EVADED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event that previous action was completed. The action may be an attempt to physically/magically hit an enemy, or an action that discarded attack attempt has finished.
|
* An event that previous action was completed. The action may be an attempt to physically/magically hit an enemy, or an action that discarded attack attempt has finished.
|
||||||
*/
|
*/
|
||||||
EVT_READY_TO_ACT,
|
EVT_READY_TO_ACT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User's command, like using a combat magic or changing weapon, etc. The command is not intended to change final goal
|
* User's command, like using a combat magic or changing weapon, etc. The command is not intended to change final goal
|
||||||
*/
|
*/
|
||||||
EVT_USER_CMD,
|
EVT_USER_CMD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to assigned location, or it's a time to modify movement destination (follow, interact, random move and others intentions).
|
* The actor arrived to assigned location, or it's a time to modify movement destination (follow, interact, random move and others intentions).
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED,
|
EVT_ARRIVED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
* The actor arrived to an intermediate point, and needs to revalidate destination. This is sent when follow/move to pawn if destination is far away.
|
||||||
*/
|
*/
|
||||||
EVT_ARRIVED_REVALIDATE,
|
EVT_ARRIVED_REVALIDATE,
|
||||||
/** The actor cannot move anymore. */
|
|
||||||
|
/**
|
||||||
|
* The actor cannot move anymore.
|
||||||
|
*/
|
||||||
EVT_ARRIVED_BLOCKED,
|
EVT_ARRIVED_BLOCKED,
|
||||||
/** Forgets an object (if it's used as attack target, follow target and so on */
|
|
||||||
|
/**
|
||||||
|
* Forgets an object (if it's used as attack target, follow target and so on
|
||||||
|
*/
|
||||||
EVT_FORGET_OBJECT,
|
EVT_FORGET_OBJECT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to cancel current step execution, but not change the intention.<br>
|
* Attempt to cancel current step execution, but not change the intention.<br>
|
||||||
* For example, the actor was put into a stun, so it's current attack<br>
|
* For example, the actor was put into a stun, so it's current attack<br>
|
||||||
@@ -71,18 +101,39 @@ public enum CtrlEvent
|
|||||||
* attempt to cancel a cast/bow attack and so on.
|
* attempt to cancel a cast/bow attack and so on.
|
||||||
*/
|
*/
|
||||||
EVT_CANCEL,
|
EVT_CANCEL,
|
||||||
/** The creature is dead */
|
|
||||||
|
/**
|
||||||
|
* The creature is dead
|
||||||
|
*/
|
||||||
EVT_DEAD,
|
EVT_DEAD,
|
||||||
/** The creature looks like dead */
|
|
||||||
|
/**
|
||||||
|
* The creature looks like dead
|
||||||
|
*/
|
||||||
EVT_FAKE_DEATH,
|
EVT_FAKE_DEATH,
|
||||||
/** The creature attack anyone randomly **/
|
|
||||||
|
/**
|
||||||
|
* The creature attack anyone randomly
|
||||||
|
*/
|
||||||
EVT_CONFUSED,
|
EVT_CONFUSED,
|
||||||
/** The creature cannot cast spells anymore **/
|
|
||||||
|
/**
|
||||||
|
* The creature cannot cast spells anymore
|
||||||
|
*/
|
||||||
EVT_MUTED,
|
EVT_MUTED,
|
||||||
/** The creature flee in random directions **/
|
|
||||||
|
/**
|
||||||
|
* The creature flee in random directions
|
||||||
|
*/
|
||||||
EVT_AFRAID,
|
EVT_AFRAID,
|
||||||
/** The creature finish casting **/
|
|
||||||
|
/**
|
||||||
|
* The creature finish casting
|
||||||
|
*/
|
||||||
EVT_FINISH_CASTING,
|
EVT_FINISH_CASTING,
|
||||||
/** The creature betrayed its master */
|
|
||||||
|
/**
|
||||||
|
* The creature betrayed its master
|
||||||
|
*/
|
||||||
EVT_BETRAYED
|
EVT_BETRAYED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,6 +418,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int chance = 4;
|
final int chance = 4;
|
||||||
if (chance >= Rnd.get(100))
|
if (chance >= Rnd.get(100))
|
||||||
{
|
{
|
||||||
@@ -427,6 +428,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject oldTarget = _actor.getTarget();
|
final WorldObject oldTarget = _actor.getTarget();
|
||||||
_actor.setTarget(npc);
|
_actor.setTarget(npc);
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
@@ -715,6 +717,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
* <li>Add the target to the actor _aggroList or update hate if already present</li>
|
||||||
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
* <li>Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* @param target The Creature that attacks
|
||||||
* @param aggro The value of hate to add to the actor against the target
|
* @param aggro The value of hate to add to the actor against the target
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -724,6 +727,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = (Attackable) _actor;
|
final Attackable me = (Attackable) _actor;
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeIntention(AI_INTENTION_REST, null, null);
|
changeIntention(AI_INTENTION_REST, null, null);
|
||||||
setTarget(null);
|
setTarget(null);
|
||||||
if (getAttackTarget() != null)
|
if (getAttackTarget() != null)
|
||||||
@@ -245,12 +246,14 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkTargetLostOrDead(target))
|
if (checkTargetLostOrDead(target))
|
||||||
{
|
{
|
||||||
// Notify the target
|
// Notify the target
|
||||||
setAttackTarget(null);
|
setAttackTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
|
if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -304,11 +307,13 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject target = getTarget();
|
final WorldObject target = getTarget();
|
||||||
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
_actor.getActingPlayer().doPickupItem(target);
|
_actor.getActingPlayer().doPickupItem(target);
|
||||||
}
|
}
|
||||||
@@ -319,15 +324,18 @@ public class PlayerAI extends PlayableAI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorldObject target = getTarget();
|
final WorldObject target = getTarget();
|
||||||
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
if (checkTargetLost(target) || maybeMoveToPawn(target, 36))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(target instanceof StaticObjectInstance))
|
if (!(target instanceof StaticObjectInstance))
|
||||||
{
|
{
|
||||||
_actor.getActingPlayer().doInteract((Creature) target);
|
_actor.getActingPlayer().doInteract((Creature) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -725,6 +725,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Attackable me = (Attackable) _actor;
|
final Attackable me = (Attackable) _actor;
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,10 +106,12 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
setAttackTarget(null);
|
setAttackTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
|
if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
_actor.doAttack(getAttackTarget());
|
_actor.doAttack(getAttackTarget());
|
||||||
}
|
}
|
||||||
@@ -122,11 +124,13 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
setCastTarget(null);
|
setCastTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean val = _startFollow;
|
final boolean val = _startFollow;
|
||||||
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
|
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clientStopMoving(null);
|
clientStopMoving(null);
|
||||||
summon.setFollowStatus(false);
|
summon.setFollowStatus(false);
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
@@ -140,6 +144,7 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
((Summon) _actor).doPickupItem(getTarget());
|
((Summon) _actor).doPickupItem(getTarget());
|
||||||
}
|
}
|
||||||
@@ -150,6 +155,7 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntention(AI_INTENTION_IDLE);
|
setIntention(AI_INTENTION_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +166,9 @@ public class SummonAI extends PlayableAI implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_thinking = true;
|
_thinking = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (getIntention())
|
switch (getIntention())
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
|
|
||||||
// Set the AI pick up target
|
// Set the AI pick up target
|
||||||
setTarget(object);
|
setTarget(object);
|
||||||
|
|
||||||
if ((object.getX() == 0) && (object.getY() == 0))
|
if ((object.getX() == 0) && (object.getY() == 0))
|
||||||
{
|
{
|
||||||
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
// LOGGER.warning("Object in coords 0,0 - using a temporary fix");
|
||||||
@@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PLayerAI, SummonAI</li>
|
* <li>PlayerAI, SummonAI</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param target The targeted WorldObject
|
* @param target The targeted WorldObject
|
||||||
* @return True if the target is lost
|
* @return True if the target is lost
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ public enum CtrlIntention
|
|||||||
{
|
{
|
||||||
/** Do nothing, disconnect AI of NPC if no players around */
|
/** Do nothing, disconnect AI of NPC if no players around */
|
||||||
AI_INTENTION_IDLE,
|
AI_INTENTION_IDLE,
|
||||||
|
|
||||||
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
/** Alerted state without goal : scan attackable targets, random walk, etc */
|
||||||
AI_INTENTION_ACTIVE,
|
AI_INTENTION_ACTIVE,
|
||||||
|
|
||||||
/** Rest (sit until attacked) */
|
/** Rest (sit until attacked) */
|
||||||
AI_INTENTION_REST,
|
AI_INTENTION_REST,
|
||||||
|
|
||||||
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
/** Attack target (cast combat magic, go to target, combat), may be ignored, if target is locked on another character or a peaceful zone and so on. */
|
||||||
AI_INTENTION_ATTACK,
|
AI_INTENTION_ATTACK,
|
||||||
|
|
||||||
/** Cast a spell, depending on the spell - may start or stop attacking */
|
/** Cast a spell, depending on the spell - may start or stop attacking */
|
||||||
AI_INTENTION_CAST,
|
AI_INTENTION_CAST,
|
||||||
|
|
||||||
/** Just move to another location */
|
/** Just move to another location */
|
||||||
AI_INTENTION_MOVE_TO,
|
AI_INTENTION_MOVE_TO,
|
||||||
|
|
||||||
/** Like move, but check target's movement and follow it */
|
/** Like move, but check target's movement and follow it */
|
||||||
AI_INTENTION_FOLLOW,
|
AI_INTENTION_FOLLOW,
|
||||||
|
|
||||||
/** PickUp and item, (got to item, pickup it, become idle */
|
/** PickUp and item, (got to item, pickup it, become idle */
|
||||||
AI_INTENTION_PICK_UP,
|
AI_INTENTION_PICK_UP,
|
||||||
|
|
||||||
/** Move to target, then interact */
|
/** Move to target, then interact */
|
||||||
AI_INTENTION_INTERACT;
|
AI_INTENTION_INTERACT;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user