diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 1ae214f7ca..e7a92ff3b3 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
* Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 6afc728037..5a13a0632b 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -45,7 +45,6 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager; /** * Mother class of all objects AI in the world.
- *
* AbastractAI:
*
  • CreatureAI
  • */ @@ -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 public Creature getActor() @@ -103,12 +102,10 @@ abstract class AbstractAI implements Ctrl /** * Set the Intention of this AbstractAI.
    - * Caution: This method is USED by AI classes
    - *
    - * Overriden in:
    - *
    + * Caution: This method is USED by AI classes
    + * Overridden in
    :

    * AttackableAI : Create an AI Task executed every 1s (if necessary)
    - * L2PlayerAI : Stores the current AI intention parameters to later restore it if necessary + * PlayerAI : Stores the current AI intention parameters to later restore it if necessary. * @param intention The new Intention to set to the AI * @param arg0 The first 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.
    - * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) * @param evt The event whose the AI must be notified */ @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() { if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AttackableAI.java index e1e932e53c..5a68e51562 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AttackableAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AttackableAI.java @@ -89,35 +89,41 @@ public class AttackableAI extends CreatureAI } /** - * Return True if the target is autoattackable (depends on the actor type).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    - *
  • The target isn't a Folk, a Door or another NpcInstance
  • + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ private boolean autoAttackCondition(Creature target) { @@ -366,13 +372,13 @@ public class AttackableAI extends CreatureAI } /** - * Manage AI standard thinks of a Attackable (called by onEvtThink).
    - *
    - * Actions:
    + * Manage AI standard thinks of a Attackable (called by onEvtThink). Actions: + * */ private void thinkActive() { @@ -503,15 +509,13 @@ public class AttackableAI extends CreatureAI { int offset; - // for Raids - need correction if (_actor.isRaid()) { - offset = 500; + offset = 500; // for Raids - need correction } else { - // for normal minions - need correction :) - offset = 200; + offset = 200; // for normal minions - need correction :) } if (((MinionInstance) _actor).getLeader().isRunning()) @@ -591,12 +595,13 @@ public class AttackableAI extends CreatureAI /** * Manage AI attack thinks of a Attackable (called by onEvtThink).
    *
    - * Actions:
    + * Actions: + * */ private void thinkAttack() { @@ -1034,10 +1039,12 @@ public class AttackableAI extends CreatureAI /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -1080,9 +1087,11 @@ public class AttackableAI extends CreatureAI /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param target the Creature that attacks * @param aggro The value of hate to add to the actor against the target */ diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java index 161a6ea3b5..b23e10774f 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java @@ -39,7 +39,8 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.util.Util; /** - * @author littlecrow AI for controllable mobs + * AI for controllable mobs + * @author littlecrow */ public class ControllableMobAI extends AttackableAI { @@ -203,6 +204,7 @@ public class ControllableMobAI extends AttackableAI _accessor.doCast(sk); return; } + maxRange = Math.max(maxRange, castRange); } @@ -239,6 +241,7 @@ public class ControllableMobAI extends AttackableAI _accessor.doCast(sk); return; } + maxRange = Math.max(maxRange, castRange); } @@ -246,8 +249,10 @@ public class ControllableMobAI extends AttackableAI { moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */); } + return; } + _accessor.doAttack(getForcedTarget()); } @@ -261,7 +266,6 @@ public class ControllableMobAI extends AttackableAI final Attackable npc = (Attackable) _actor; npc.stopHating(getAttackTarget()); } - setIntention(AI_INTENTION_ACTIVE); } else diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 41b3e96989..fdf3d6a1a0 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -45,12 +45,13 @@ import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; /** * This class manages AI of Creature.
    - *
    - * CreatureAI:
    + * CreatureAI : + * */ 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.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onIntentionIdle() @@ -102,12 +105,14 @@ public class CreatureAI extends AbstractAI /** * Manage the Active Intention : Stop Attack, Movement and Launch Think Event.
    *
    - * Actions : if the Intention is not already Active
    + * Actions : if the Intention is not already Active + * * @param target */ protected void onIntentionActive(Creature target) @@ -143,8 +148,10 @@ public class CreatureAI extends AbstractAI /** * Manage the Rest Intention.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * *
    - * Overridden in:
    + * Overridden in: + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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).
    *
    - * Actions :
    + * Actions : + * */ @Override 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).
    *
    - * Actions :
    + * Actions : + * */ @Override protected void onIntentionInteract(WorldObject object) @@ -554,12 +575,14 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Stunned then onAttacked Event.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtStunned(Creature attacker) @@ -584,11 +607,13 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Sleeping.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtSleeping(Creature attacker) @@ -610,9 +635,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Rooted.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtRooted(Creature attacker) @@ -632,9 +659,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Confused.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtConfused(Creature attacker) @@ -649,8 +678,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Muted.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtMuted(Creature attacker) @@ -662,8 +693,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ReadyToAct.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtReadyToAct() @@ -684,9 +717,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Arrived.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrived() @@ -726,8 +761,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ArrivedRevalidate.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrivedRevalidate() @@ -739,10 +776,12 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ArrivedBlocked.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrivedBlocked(Location location) @@ -763,12 +802,14 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ForgetObject.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtForgetObject(WorldObject object) @@ -822,30 +863,34 @@ public class CreatureAI extends AbstractAI } // Check if the targeted object was the actor - if (_actor == object) + if (_actor != object) { - // 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); + return; } + + // 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.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtCancel() @@ -865,9 +910,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Dead.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtDead() @@ -887,8 +934,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Fake Death.
    *
    - * Actions:
    + * Actions: + * */ @Override 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.
    *
    - * Actions:
    + * Actions: + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @param offsetValue The Interact area radius * @return True if a movement must be done @@ -937,11 +990,9 @@ public class CreatureAI extends AbstractAI // LOGGER.warning("maybeMoveToPawn: target == NULL!"); return false; } - - // skill radius -1 if (offsetValue < 0) { - return false; + return false; // skill radius -1 } 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.
    *
    - * Actions : If the target is lost or dead
    + * Actions : If the target is lost or dead + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @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 setIntention(AI_INTENTION_ACTIVE); - return true; } return false; @@ -1065,13 +1117,17 @@ public class CreatureAI extends AbstractAI /** * Modify current Intention and actions if the target is lost.
    *
    - * Actions : If the target is lost
    + * Actions : If the target is lost + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @return True if the target is lost */ diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/Ctrl.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/Ctrl.java index 77535c7ecf..93f9275bab 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/Ctrl.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/Ctrl.java @@ -19,48 +19,86 @@ package org.l2jmobius.gameserver.ai; 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 - * 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, - * 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, - * 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" - * 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 - * 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 - * 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. + * 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 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, 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, 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" 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 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 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. */ public interface Ctrl { /** - * @return the character this AI serves + * Gets the actor. + * @return the actor */ Creature getActor(); /** - * @return the current intention. + * Gets the intention. + * @return the intention */ CtrlIntention getIntention(); /** - * @return the current attack target. + * Gets the attack target. + * @return the attack target */ Creature getAttackTarget(); /** - * Set general state/intention for AI, with optional data - * @param intention + * Set general state/intention for AI, with optional data. + * @param intention the new intention */ void setIntention(CtrlIntention intention); + /** + * Sets the intention. + * @param intention the intention + * @param arg0 the 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); /** - * Event, that notifies about previous step result, or user command, that does not change current general intention - * @param evt + * Event, that notifies about previous step result, or user command, that does not change current general intention. + * @param evt the event */ void notifyEvent(CtrlEvent evt); + /** + * Notify an event. + * @param evt the event + * @param arg0 the 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); } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlEvent.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlEvent.java index 3f4c4feec7..0f1e1784fc 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlEvent.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlEvent.java @@ -17,31 +17,40 @@ 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 { /** - * 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, /** - * 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
    + * attack was done on the actor. NPC may start attack in response, or ignore
    + * this event if they already attack someone, or change target and so on. */ 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, - /** Actor is in stun state */ + /** + * Actor is in stun state + */ EVT_STUNNED, - /** Actor starts/stops sleeping */ + /** + * Actor starts/stops sleeping + */ EVT_SLEEPING, - /** Actor is in rooted state (cannot move) */ + /** + * Actor is in rooted state (cannot move) + */ EVT_ROOTED, /** @@ -60,40 +69,61 @@ public enum CtrlEvent 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, - /** The actor cannot move anymore. */ + /** + * The actor cannot move anymore. + */ 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, /** - * 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 - * cancel a cast/bow attack and so on. + * Attempt to cancel current step execution, but not change the intention.
    + * For example, the actor was put 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 cancel a cast/bow attack and so on. */ EVT_CANCEL, - /** The creature is dead */ + /** + * The creature is dead + */ EVT_DEAD, - /** The creature looks like dead */ + /** + * The creature looks like dead + */ EVT_FAKE_DEATH, - /** The creature attack anyone randomly **/ + /** + * The creature attack anyone randomly + */ EVT_CONFUSED, - /** The creature cannot cast spells anymore **/ + /** + * The creature cannot cast spells anymore + */ 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, - /** The creature betrayed its master */ + /** + * The creature betrayed its master + */ EVT_BETRAYED } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 8d3aa7627a..29e7055d92 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -17,9 +17,8 @@ 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 { /** Do nothing, disconnect AI of NPC if no players around */ @@ -31,9 +30,7 @@ public enum CtrlIntention /** Rest (sit until attacked) */ AI_INTENTION_REST, - /** - * 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 - */ + /** 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, /** Cast a spell, depending on the spell - may start or stop attacking */ diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/DoorAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/DoorAI.java index 03a8a95e5a..060c20ba96 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/DoorAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/DoorAI.java @@ -35,144 +35,120 @@ public class DoorAI extends CreatureAI super(accessor); } - // rather stupid AI... well, it's for doors :D @Override protected void onIntentionIdle() { - // null; } @Override protected void onIntentionActive() { - // null; } @Override protected void onIntentionRest() { - // null; } @Override protected void onIntentionAttack(Creature target) { - // null; } @Override protected void onIntentionCast(Skill skill, WorldObject target) { - // null; } @Override protected void onIntentionMoveTo(Location destination) { - // null; } @Override protected void onIntentionFollow(Creature target) { - // null; } @Override protected void onIntentionPickUp(WorldObject item) { - // null; } @Override protected void onIntentionInteract(WorldObject object) { - // null; } @Override public void onEvtThink() { - // null; } @Override protected void onEvtAttacked(Creature attacker) { - final DoorInstance me = (DoorInstance) _actor; - ThreadPool.execute(new onEventAttackedDoorTask(me, attacker)); + ThreadPool.execute(new onEventAttackedDoorTask((DoorInstance) _actor, attacker)); } @Override protected void onEvtAggression(Creature target, int aggro) { - // null; } @Override protected void onEvtStunned(Creature attacker) { - // null; } @Override protected void onEvtSleeping(Creature attacker) { - // null; } @Override protected void onEvtRooted(Creature attacker) { - // null; } @Override protected void onEvtReadyToAct() { - // null; } @Override protected void onEvtUserCmd(Object arg0, Object arg1) { - // null; } @Override protected void onEvtArrived() { - // null; } @Override protected void onEvtArrivedRevalidate() { - // null; } @Override - protected void onEvtArrivedBlocked(Location blocked_at_pos) + protected void onEvtArrivedBlocked(Location blocked_at_loc) { - // null; } @Override protected void onEvtForgetObject(WorldObject object) { - // null; } @Override protected void onEvtCancel() { - // null; } @Override protected void onEvtDead() { - // null; } private class onEventAttackedDoorTask implements Runnable diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java index f31e9e27d4..7ef3eddcfe 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java @@ -104,35 +104,41 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable } /** - * Return True if the target is autoattackable (depends on the actor type).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ 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).
    *
    - * Actions:
    + * Actions: + * */ private void thinkActive() { @@ -362,11 +370,13 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Manage AI attack thinks of a Attackable (called by onEvtThink).
    *
    - * Actions:
    + * Actions: + * * TODO: Manage casting rules to healer mobs (like Ant Nurses) */ private void thinkAttack() @@ -592,7 +602,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable FortSiegeGuardInstance sGuard; sGuard = (FortSiegeGuardInstance) _actor; Creature attackTarget = getAttackTarget(); - try { _actor.setTarget(attackTarget); @@ -854,10 +863,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -893,9 +904,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param target The Creature that attacks * @param aggro The value of hate to add to the actor against the target */ diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/PlayerAI.java index 674af0bd6c..21fb9e5da0 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -143,18 +143,18 @@ public class PlayerAI extends CreatureAI @Override protected void onIntentionRest() { - if (getIntention() != AI_INTENTION_REST) + if (getIntention() == AI_INTENTION_REST) { - changeIntention(AI_INTENTION_REST, null, null); - setTarget(null); - - if (getAttackTarget() != null) - { - setAttackTarget(null); - } - - clientStopMoving(null); + return; } + + changeIntention(AI_INTENTION_REST, null, null); + setTarget(null); + if (getAttackTarget() != null) + { + setAttackTarget(null); + } + clientStopMoving(null); } @Override diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java index c1ea1d4583..4c3737a040 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java @@ -46,14 +46,12 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager; */ 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 /** The Attackable AI task executed every 1s (call onEvtThink method) */ private Future _aiTask; - /** The delay after wich the attacked is stopped */ + /** The delay after which the attacked is stopped */ private int _attackTimeout; /** 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).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ 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).
    *
    - * Actions:
    + * Actions: + * */ private void thinkActive() { @@ -661,10 +667,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -700,10 +708,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param aggro The value of hate to add to the actor against the target */ @Override diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SummonAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SummonAI.java index c87444d1df..cbbc3c8d59 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SummonAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/SummonAI.java @@ -17,11 +17,8 @@ package org.l2jmobius.gameserver.ai; 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_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.WorldObject; @@ -162,21 +159,28 @@ public class SummonAI extends CreatureAI try { - if (getIntention() == AI_INTENTION_ATTACK) + switch (getIntention()) { - thinkAttack(); - } - else if (getIntention() == AI_INTENTION_CAST) - { - thinkCast(); - } - else if (getIntention() == AI_INTENTION_PICK_UP) - { - thinkPickUp(); - } - else if (getIntention() == AI_INTENTION_INTERACT) - { - thinkInteract(); + case AI_INTENTION_ATTACK: + { + thinkAttack(); + break; + } + case AI_INTENTION_CAST: + { + thinkCast(); + break; + } + case AI_INTENTION_PICK_UP: + { + thinkPickUp(); + break; + } + case AI_INTENTION_INTERACT: + { + thinkInteract(); + break; + } } } finally diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java index bd76fd1756..a1dddd8e11 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -3321,7 +3321,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public void startFear() { setAfraid(true); - getAI().notifyEvent(CtrlEvent.EVT_AFFRAID); + getAI().notifyEvent(CtrlEvent.EVT_AFRAID); updateAbnormalEffect(); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 6afc728037..5a13a0632b 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -45,7 +45,6 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager; /** * Mother class of all objects AI in the world.
    - *
    * AbastractAI:
    *
  • CreatureAI
  • */ @@ -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 public Creature getActor() @@ -103,12 +102,10 @@ abstract class AbstractAI implements Ctrl /** * Set the Intention of this AbstractAI.
    - * Caution: This method is USED by AI classes
    - *
    - * Overriden in:
    - *
    + * Caution: This method is USED by AI classes
    + * Overridden in
    :

    * AttackableAI : Create an AI Task executed every 1s (if necessary)
    - * L2PlayerAI : Stores the current AI intention parameters to later restore it if necessary + * PlayerAI : Stores the current AI intention parameters to later restore it if necessary. * @param intention The new Intention to set to the AI * @param arg0 The first 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.
    - * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) * @param evt The event whose the AI must be notified */ @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() { if (_clientMovingToPawnOffset > 0) // movetoPawn needs to be stopped diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java index e1e932e53c..5a68e51562 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java @@ -89,35 +89,41 @@ public class AttackableAI extends CreatureAI } /** - * Return True if the target is autoattackable (depends on the actor type).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    - *
  • The target isn't a Folk, a Door or another NpcInstance
  • + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ private boolean autoAttackCondition(Creature target) { @@ -366,13 +372,13 @@ public class AttackableAI extends CreatureAI } /** - * Manage AI standard thinks of a Attackable (called by onEvtThink).
    - *
    - * Actions:
    + * Manage AI standard thinks of a Attackable (called by onEvtThink). Actions: + * */ private void thinkActive() { @@ -503,15 +509,13 @@ public class AttackableAI extends CreatureAI { int offset; - // for Raids - need correction if (_actor.isRaid()) { - offset = 500; + offset = 500; // for Raids - need correction } else { - // for normal minions - need correction :) - offset = 200; + offset = 200; // for normal minions - need correction :) } if (((MinionInstance) _actor).getLeader().isRunning()) @@ -591,12 +595,13 @@ public class AttackableAI extends CreatureAI /** * Manage AI attack thinks of a Attackable (called by onEvtThink).
    *
    - * Actions:
    + * Actions: + * */ private void thinkAttack() { @@ -1034,10 +1039,12 @@ public class AttackableAI extends CreatureAI /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -1080,9 +1087,11 @@ public class AttackableAI extends CreatureAI /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param target the Creature that attacks * @param aggro The value of hate to add to the actor against the target */ diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java index 161a6ea3b5..b23e10774f 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java @@ -39,7 +39,8 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.util.Util; /** - * @author littlecrow AI for controllable mobs + * AI for controllable mobs + * @author littlecrow */ public class ControllableMobAI extends AttackableAI { @@ -203,6 +204,7 @@ public class ControllableMobAI extends AttackableAI _accessor.doCast(sk); return; } + maxRange = Math.max(maxRange, castRange); } @@ -239,6 +241,7 @@ public class ControllableMobAI extends AttackableAI _accessor.doCast(sk); return; } + maxRange = Math.max(maxRange, castRange); } @@ -246,8 +249,10 @@ public class ControllableMobAI extends AttackableAI { moveToPawn(getForcedTarget(), _actor.getPhysicalAttackRange()/* range */); } + return; } + _accessor.doAttack(getForcedTarget()); } @@ -261,7 +266,6 @@ public class ControllableMobAI extends AttackableAI final Attackable npc = (Attackable) _actor; npc.stopHating(getAttackTarget()); } - setIntention(AI_INTENTION_ACTIVE); } else diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 41b3e96989..fdf3d6a1a0 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -45,12 +45,13 @@ import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; /** * This class manages AI of Creature.
    - *
    - * CreatureAI:
    + * CreatureAI : + * */ 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.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onIntentionIdle() @@ -102,12 +105,14 @@ public class CreatureAI extends AbstractAI /** * Manage the Active Intention : Stop Attack, Movement and Launch Think Event.
    *
    - * Actions : if the Intention is not already Active
    + * Actions : if the Intention is not already Active + * * @param target */ protected void onIntentionActive(Creature target) @@ -143,8 +148,10 @@ public class CreatureAI extends AbstractAI /** * Manage the Rest Intention.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * *
    - * Overridden in:
    + * Overridden in: + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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.
    *
    - * Actions :
    + * Actions : + * */ @Override 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).
    *
    - * Actions :
    + * Actions : + * */ @Override 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).
    *
    - * Actions :
    + * Actions : + * */ @Override protected void onIntentionInteract(WorldObject object) @@ -554,12 +575,14 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Stunned then onAttacked Event.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtStunned(Creature attacker) @@ -584,11 +607,13 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Sleeping.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtSleeping(Creature attacker) @@ -610,9 +635,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Rooted.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtRooted(Creature attacker) @@ -632,9 +659,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Confused.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtConfused(Creature attacker) @@ -649,8 +678,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Muted.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtMuted(Creature attacker) @@ -662,8 +693,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ReadyToAct.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtReadyToAct() @@ -684,9 +717,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Arrived.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrived() @@ -726,8 +761,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ArrivedRevalidate.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrivedRevalidate() @@ -739,10 +776,12 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ArrivedBlocked.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtArrivedBlocked(Location location) @@ -763,12 +802,14 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event ForgetObject.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtForgetObject(WorldObject object) @@ -822,30 +863,34 @@ public class CreatureAI extends AbstractAI } // Check if the targeted object was the actor - if (_actor == object) + if (_actor != object) { - // 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); + return; } + + // 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.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtCancel() @@ -865,9 +910,11 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Dead.
    *
    - * Actions:
    + * Actions: + * */ @Override protected void onEvtDead() @@ -887,8 +934,10 @@ public class CreatureAI extends AbstractAI /** * Launch actions corresponding to the Event Fake Death.
    *
    - * Actions:
    + * Actions: + * */ @Override 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.
    *
    - * Actions:
    + * Actions: + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @param offsetValue The Interact area radius * @return True if a movement must be done @@ -937,11 +990,9 @@ public class CreatureAI extends AbstractAI // LOGGER.warning("maybeMoveToPawn: target == NULL!"); return false; } - - // skill radius -1 if (offsetValue < 0) { - return false; + return false; // skill radius -1 } 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.
    *
    - * Actions : If the target is lost or dead
    + * Actions : If the target is lost or dead + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @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 setIntention(AI_INTENTION_ACTIVE); - return true; } return false; @@ -1065,13 +1117,17 @@ public class CreatureAI extends AbstractAI /** * Modify current Intention and actions if the target is lost.
    *
    - * Actions : If the target is lost
    + * Actions : If the target is lost + * *
    - * Example of use:
    - *
  • PLayerAI, SummonAI

  • + * Example of use: + * * @param target The targeted WorldObject * @return True if the target is lost */ diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/Ctrl.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/Ctrl.java index 77535c7ecf..93f9275bab 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/Ctrl.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/Ctrl.java @@ -19,48 +19,86 @@ package org.l2jmobius.gameserver.ai; 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 - * 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, - * 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, - * 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" - * 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 - * 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 - * 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. + * 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 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, 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, 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" 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 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 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. */ public interface Ctrl { /** - * @return the character this AI serves + * Gets the actor. + * @return the actor */ Creature getActor(); /** - * @return the current intention. + * Gets the intention. + * @return the intention */ CtrlIntention getIntention(); /** - * @return the current attack target. + * Gets the attack target. + * @return the attack target */ Creature getAttackTarget(); /** - * Set general state/intention for AI, with optional data - * @param intention + * Set general state/intention for AI, with optional data. + * @param intention the new intention */ void setIntention(CtrlIntention intention); + /** + * Sets the intention. + * @param intention the intention + * @param arg0 the 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); /** - * Event, that notifies about previous step result, or user command, that does not change current general intention - * @param evt + * Event, that notifies about previous step result, or user command, that does not change current general intention. + * @param evt the event */ void notifyEvent(CtrlEvent evt); + /** + * Notify an event. + * @param evt the event + * @param arg0 the 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); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlEvent.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlEvent.java index 3f4c4feec7..0f1e1784fc 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlEvent.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlEvent.java @@ -17,31 +17,40 @@ 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 { /** - * 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, /** - * 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
    + * attack was done on the actor. NPC may start attack in response, or ignore
    + * this event if they already attack someone, or change target and so on. */ 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, - /** Actor is in stun state */ + /** + * Actor is in stun state + */ EVT_STUNNED, - /** Actor starts/stops sleeping */ + /** + * Actor starts/stops sleeping + */ EVT_SLEEPING, - /** Actor is in rooted state (cannot move) */ + /** + * Actor is in rooted state (cannot move) + */ EVT_ROOTED, /** @@ -60,40 +69,61 @@ public enum CtrlEvent 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, - /** The actor cannot move anymore. */ + /** + * The actor cannot move anymore. + */ 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, /** - * 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 - * cancel a cast/bow attack and so on. + * Attempt to cancel current step execution, but not change the intention.
    + * For example, the actor was put 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 cancel a cast/bow attack and so on. */ EVT_CANCEL, - /** The creature is dead */ + /** + * The creature is dead + */ EVT_DEAD, - /** The creature looks like dead */ + /** + * The creature looks like dead + */ EVT_FAKE_DEATH, - /** The creature attack anyone randomly **/ + /** + * The creature attack anyone randomly + */ EVT_CONFUSED, - /** The creature cannot cast spells anymore **/ + /** + * The creature cannot cast spells anymore + */ 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, - /** The creature betrayed its master */ + /** + * The creature betrayed its master + */ EVT_BETRAYED } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 8d3aa7627a..29e7055d92 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -17,9 +17,8 @@ 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 { /** Do nothing, disconnect AI of NPC if no players around */ @@ -31,9 +30,7 @@ public enum CtrlIntention /** Rest (sit until attacked) */ AI_INTENTION_REST, - /** - * 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 - */ + /** 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, /** Cast a spell, depending on the spell - may start or stop attacking */ diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/DoorAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/DoorAI.java index 03a8a95e5a..060c20ba96 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/DoorAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/DoorAI.java @@ -35,144 +35,120 @@ public class DoorAI extends CreatureAI super(accessor); } - // rather stupid AI... well, it's for doors :D @Override protected void onIntentionIdle() { - // null; } @Override protected void onIntentionActive() { - // null; } @Override protected void onIntentionRest() { - // null; } @Override protected void onIntentionAttack(Creature target) { - // null; } @Override protected void onIntentionCast(Skill skill, WorldObject target) { - // null; } @Override protected void onIntentionMoveTo(Location destination) { - // null; } @Override protected void onIntentionFollow(Creature target) { - // null; } @Override protected void onIntentionPickUp(WorldObject item) { - // null; } @Override protected void onIntentionInteract(WorldObject object) { - // null; } @Override public void onEvtThink() { - // null; } @Override protected void onEvtAttacked(Creature attacker) { - final DoorInstance me = (DoorInstance) _actor; - ThreadPool.execute(new onEventAttackedDoorTask(me, attacker)); + ThreadPool.execute(new onEventAttackedDoorTask((DoorInstance) _actor, attacker)); } @Override protected void onEvtAggression(Creature target, int aggro) { - // null; } @Override protected void onEvtStunned(Creature attacker) { - // null; } @Override protected void onEvtSleeping(Creature attacker) { - // null; } @Override protected void onEvtRooted(Creature attacker) { - // null; } @Override protected void onEvtReadyToAct() { - // null; } @Override protected void onEvtUserCmd(Object arg0, Object arg1) { - // null; } @Override protected void onEvtArrived() { - // null; } @Override protected void onEvtArrivedRevalidate() { - // null; } @Override - protected void onEvtArrivedBlocked(Location blocked_at_pos) + protected void onEvtArrivedBlocked(Location blocked_at_loc) { - // null; } @Override protected void onEvtForgetObject(WorldObject object) { - // null; } @Override protected void onEvtCancel() { - // null; } @Override protected void onEvtDead() { - // null; } private class onEventAttackedDoorTask implements Runnable diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java index f31e9e27d4..7ef3eddcfe 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java @@ -104,35 +104,41 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable } /** - * Return True if the target is autoattackable (depends on the actor type).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ 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).
    *
    - * Actions:
    + * Actions: + * */ private void thinkActive() { @@ -362,11 +370,13 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Manage AI attack thinks of a Attackable (called by onEvtThink).
    *
    - * Actions:
    + * Actions: + * * TODO: Manage casting rules to healer mobs (like Ant Nurses) */ private void thinkAttack() @@ -592,7 +602,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable FortSiegeGuardInstance sGuard; sGuard = (FortSiegeGuardInstance) _actor; Creature attackTarget = getAttackTarget(); - try { _actor.setTarget(attackTarget); @@ -854,10 +863,12 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -893,9 +904,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param target The Creature that attacks * @param aggro The value of hate to add to the actor against the target */ diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java index 674af0bd6c..21fb9e5da0 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -143,18 +143,18 @@ public class PlayerAI extends CreatureAI @Override protected void onIntentionRest() { - if (getIntention() != AI_INTENTION_REST) + if (getIntention() == AI_INTENTION_REST) { - changeIntention(AI_INTENTION_REST, null, null); - setTarget(null); - - if (getAttackTarget() != null) - { - setAttackTarget(null); - } - - clientStopMoving(null); + return; } + + changeIntention(AI_INTENTION_REST, null, null); + setTarget(null); + if (getAttackTarget() != null) + { + setAttackTarget(null); + } + clientStopMoving(null); } @Override diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java index c1ea1d4583..4c3737a040 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java @@ -46,14 +46,12 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager; */ 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 /** The Attackable AI task executed every 1s (call onEvtThink method) */ private Future _aiTask; - /** The delay after wich the attacked is stopped */ + /** The delay after which the attacked is stopped */ private int _attackTimeout; /** 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).
    - *
    - * Actor is a GuardInstance:
    + * Actor is a GuardInstance: + * *
    - * Actor is a SiegeGuardInstance:
    + * Actor is a SiegeGuardInstance: + * *
    - * Actor is a FriendlyMobInstance:
    + * Actor is a FriendlyMobInstance: + * *
    - * Actor is a MonsterInstance:
    + * Actor is a MonsterInstance: + * * @param target The targeted WorldObject - * @return + * @return True if the target is autoattackable (depends on the actor type). */ 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).
    *
    - * Actions:
    + * Actions: + * */ private void thinkActive() { @@ -661,10 +667,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Attacked.
    *
    - * Actions:
    + * Actions: + * * @param attacker The Creature that attacks the actor */ @Override @@ -700,10 +708,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable /** * Launch actions corresponding to the Event Aggression.
    *
    - * Actions:
    + * Actions: + * * @param aggro The value of hate to add to the actor against the target */ @Override diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SummonAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SummonAI.java index c87444d1df..cbbc3c8d59 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SummonAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/SummonAI.java @@ -17,11 +17,8 @@ package org.l2jmobius.gameserver.ai; 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_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.WorldObject; @@ -162,21 +159,28 @@ public class SummonAI extends CreatureAI try { - if (getIntention() == AI_INTENTION_ATTACK) + switch (getIntention()) { - thinkAttack(); - } - else if (getIntention() == AI_INTENTION_CAST) - { - thinkCast(); - } - else if (getIntention() == AI_INTENTION_PICK_UP) - { - thinkPickUp(); - } - else if (getIntention() == AI_INTENTION_INTERACT) - { - thinkInteract(); + case AI_INTENTION_ATTACK: + { + thinkAttack(); + break; + } + case AI_INTENTION_CAST: + { + thinkCast(); + break; + } + case AI_INTENTION_PICK_UP: + { + thinkPickUp(); + break; + } + case AI_INTENTION_INTERACT: + { + thinkInteract(); + break; + } } } finally diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index fa4c0b1d0d..0d5e384d11 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -3373,7 +3373,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public void startFear() { setAfraid(true); - getAI().notifyEvent(CtrlEvent.EVT_AFFRAID); + getAI().notifyEvent(CtrlEvent.EVT_AFRAID); updateAbnormalEffect(); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java index edfa8a6809..e7a4c25d72 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -149,7 +149,7 @@ public abstract class AbstractAI implements Ctrl * Caution: This method is USED by AI classes
    * Overridden in
    :

    * AttackableAI : Create an AI Task executed every 1s (if necessary)
    - * L2PlayerAI : Stores the current AI intention parameters to later restore it if necessary. + * PlayerAI : Stores the current AI intention parameters to later restore it if necessary. * @param intention The new Intention to set to the AI * @param arg0 The first 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); } + /** + * Launch the CreatureAI onIntention method corresponding to the new Intention.
    + * Caution: Stop the FOLLOW mode if necessary + * @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 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. Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) + * Launch the CreatureAI onEvt method corresponding to the Event.
    + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) * @param evt The event whose the AI must be notified * @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. Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) + * Launch the CreatureAI onEvt method corresponding to the Event.
    + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) * @param evt The event whose the AI must be notified + * @param args The arguments of the Event */ @Override 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); /** - * Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor. Caution: Low level function, used by AI subclasses + * Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor.
    + * Caution: Low level function, used by AI subclasses */ protected void clientActionFailed() { @@ -510,6 +521,7 @@ public abstract class AbstractAI implements Ctrl { return; } + sendPacket = false; } else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10))) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AttackableAI.java index bd3182133f..51fdf74c2c 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AttackableAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AttackableAI.java @@ -170,6 +170,7 @@ public class AttackableAI extends CreatureAI { return false; } + final Attackable me = getActiveChar(); // Check if the target isn't invulnerable @@ -180,6 +181,7 @@ public class AttackableAI extends CreatureAI { return false; } + if (target.isSummon() && ((Summon) target).getOwner().isGM()) { return false; @@ -2353,6 +2355,7 @@ public class AttackableAI extends CreatureAI *
  • Add the target to the actor _aggroList or update hate if already present
  • *
  • Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)
  • * + * @param target the Creature that attacks * @param aggro The value of hate to add to the actor against the target */ @Override diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java index f75bf06069..cc62e265f5 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java @@ -216,7 +216,6 @@ public class ControllableMobAI extends AttackableAI { moveToPawn(target, range); } - return; } _actor.doAttack(target); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java index d4292ec457..2cf9aba19e 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -426,6 +426,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1134,7 +1135,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlEvent.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlEvent.java index e32c27d517..c18730c18d 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlEvent.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlEvent.java @@ -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. */ 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 response, or ignore
    * this event if they already attack someone, or change target and so on. */ 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, - /** Actor is in stun state */ + + /** + * Actor is in stun state + */ EVT_STUNNED, - /** Actor is paralyzed or petrified */ + + /** + * Actor is paralyzed or petrified + */ EVT_PARALYZED, - /** Actor starts/stops sleeping */ + + /** + * Actor starts/stops sleeping + */ EVT_SLEEPING, - /** Actor is in rooted state (cannot move) */ + + /** + * Actor is in rooted state (cannot move) + */ EVT_ROOTED, - /** Actor evaded hit **/ + + /** + * Actor evaded hit + */ 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. */ 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 */ 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). */ 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. */ EVT_ARRIVED_REVALIDATE, - /** The actor cannot move anymore. */ + + /** + * The actor cannot move anymore. + */ 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, + /** * Attempt to cancel current step execution, but not change the intention.
    * For example, the actor was put into a stun, so it's current attack
    @@ -71,18 +101,39 @@ public enum CtrlEvent * attempt to cancel a cast/bow attack and so on. */ EVT_CANCEL, - /** The creature is dead */ + + /** + * The creature is dead + */ EVT_DEAD, - /** The creature looks like dead */ + + /** + * The creature looks like dead + */ EVT_FAKE_DEATH, - /** The creature attack anyone randomly **/ + + /** + * The creature attack anyone randomly + */ EVT_CONFUSED, - /** The creature cannot cast spells anymore **/ + + /** + * The creature cannot cast spells anymore + */ EVT_MUTED, - /** The creature flee in random directions **/ + + /** + * The creature flee in random directions + */ EVT_AFRAID, - /** The creature finish casting **/ + + /** + * The creature finish casting + */ EVT_FINISH_CASTING, - /** The creature betrayed its master */ + + /** + * The creature betrayed its master + */ EVT_BETRAYED } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java index ee0fbd7827..40061faf79 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java @@ -418,6 +418,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { continue; } + final int chance = 4; if (chance >= Rnd.get(100)) { @@ -427,6 +428,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { break; } + final WorldObject oldTarget = _actor.getTarget(); _actor.setTarget(npc); clientStopMoving(null); @@ -715,6 +717,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable *
  • Add the target to the actor _aggroList or update hate if already present
  • *
  • Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)
  • * + * @param target The Creature that attacks * @param aggro The value of hate to add to the actor against the target */ @Override @@ -724,6 +727,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { return; } + final Attackable me = (Attackable) _actor; if (target != null) { diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/PlayerAI.java index f3ff67e4c8..c31c960b24 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -170,6 +170,7 @@ public class PlayerAI extends PlayableAI { return; } + changeIntention(AI_INTENTION_REST, null, null); setTarget(null); if (getAttackTarget() != null) @@ -245,12 +246,14 @@ public class PlayerAI extends PlayableAI { return; } + if (checkTargetLostOrDead(target)) { // Notify the target setAttackTarget(null); return; } + if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange())) { return; @@ -304,11 +307,13 @@ public class PlayerAI extends PlayableAI { return; } + final WorldObject target = getTarget(); if (checkTargetLost(target) || maybeMoveToPawn(target, 36)) { return; } + setIntention(AI_INTENTION_IDLE); _actor.getActingPlayer().doPickupItem(target); } @@ -319,15 +324,18 @@ public class PlayerAI extends PlayableAI { return; } + final WorldObject target = getTarget(); if (checkTargetLost(target) || maybeMoveToPawn(target, 36)) { return; } + if (!(target instanceof StaticObjectInstance)) { _actor.getActingPlayer().doInteract((Creature) target); } + setIntention(AI_INTENTION_IDLE); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java index ce45398046..c581c5633f 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java @@ -725,6 +725,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable { return; } + final Attackable me = (Attackable) _actor; if (target != null) { diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SummonAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SummonAI.java index 217d288f9d..a6d566eccc 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SummonAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/SummonAI.java @@ -106,10 +106,12 @@ public class SummonAI extends PlayableAI implements Runnable setAttackTarget(null); return; } + if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange())) { return; } + clientStopMoving(null); _actor.doAttack(getAttackTarget()); } @@ -122,11 +124,13 @@ public class SummonAI extends PlayableAI implements Runnable setCastTarget(null); return; } + final boolean val = _startFollow; if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill))) { return; } + clientStopMoving(null); summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); @@ -140,6 +144,7 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + setIntention(AI_INTENTION_IDLE); ((Summon) _actor).doPickupItem(getTarget()); } @@ -150,6 +155,7 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + setIntention(AI_INTENTION_IDLE); } @@ -160,7 +166,9 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + _thinking = true; + try { switch (getIntention()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java index edfa8a6809..e7a4c25d72 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -149,7 +149,7 @@ public abstract class AbstractAI implements Ctrl * Caution: This method is USED by AI classes
    * Overridden in
    :

    * AttackableAI : Create an AI Task executed every 1s (if necessary)
    - * L2PlayerAI : Stores the current AI intention parameters to later restore it if necessary. + * PlayerAI : Stores the current AI intention parameters to later restore it if necessary. * @param intention The new Intention to set to the AI * @param arg0 The first 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); } + /** + * Launch the CreatureAI onIntention method corresponding to the new Intention.
    + * Caution: Stop the FOLLOW mode if necessary + * @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 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. Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) + * Launch the CreatureAI onEvt method corresponding to the Event.
    + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) * @param evt The event whose the AI must be notified * @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. Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned period) + * Launch the CreatureAI onEvt method corresponding to the Event.
    + * Caution: The current general intention won't be change (ex : If the character attack and is stunned, he will attack again after the stunned periode) * @param evt The event whose the AI must be notified + * @param args The arguments of the Event */ @Override 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); /** - * Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor. Caution: Low level function, used by AI subclasses + * Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor.
    + * Caution: Low level function, used by AI subclasses */ protected void clientActionFailed() { @@ -510,6 +521,7 @@ public abstract class AbstractAI implements Ctrl { return; } + sendPacket = false; } else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10))) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AttackableAI.java index bd3182133f..51fdf74c2c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AttackableAI.java @@ -170,6 +170,7 @@ public class AttackableAI extends CreatureAI { return false; } + final Attackable me = getActiveChar(); // Check if the target isn't invulnerable @@ -180,6 +181,7 @@ public class AttackableAI extends CreatureAI { return false; } + if (target.isSummon() && ((Summon) target).getOwner().isGM()) { return false; @@ -2353,6 +2355,7 @@ public class AttackableAI extends CreatureAI *
  • Add the target to the actor _aggroList or update hate if already present
  • *
  • Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)
  • * + * @param target the Creature that attacks * @param aggro The value of hate to add to the actor against the target */ @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java index f75bf06069..cc62e265f5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/ControllableMobAI.java @@ -216,7 +216,6 @@ public class ControllableMobAI extends AttackableAI { moveToPawn(target, range); } - return; } _actor.doAttack(target); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java index d4292ec457..2cf9aba19e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -426,6 +426,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1134,7 +1135,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlEvent.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlEvent.java index e32c27d517..c18730c18d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlEvent.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlEvent.java @@ -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. */ 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 response, or ignore
    * this event if they already attack someone, or change target and so on. */ 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, - /** Actor is in stun state */ + + /** + * Actor is in stun state + */ EVT_STUNNED, - /** Actor is paralyzed or petrified */ + + /** + * Actor is paralyzed or petrified + */ EVT_PARALYZED, - /** Actor starts/stops sleeping */ + + /** + * Actor starts/stops sleeping + */ EVT_SLEEPING, - /** Actor is in rooted state (cannot move) */ + + /** + * Actor is in rooted state (cannot move) + */ EVT_ROOTED, - /** Actor evaded hit **/ + + /** + * Actor evaded hit + */ 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. */ 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 */ 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). */ 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. */ EVT_ARRIVED_REVALIDATE, - /** The actor cannot move anymore. */ + + /** + * The actor cannot move anymore. + */ 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, + /** * Attempt to cancel current step execution, but not change the intention.
    * For example, the actor was put into a stun, so it's current attack
    @@ -71,18 +101,39 @@ public enum CtrlEvent * attempt to cancel a cast/bow attack and so on. */ EVT_CANCEL, - /** The creature is dead */ + + /** + * The creature is dead + */ EVT_DEAD, - /** The creature looks like dead */ + + /** + * The creature looks like dead + */ EVT_FAKE_DEATH, - /** The creature attack anyone randomly **/ + + /** + * The creature attack anyone randomly + */ EVT_CONFUSED, - /** The creature cannot cast spells anymore **/ + + /** + * The creature cannot cast spells anymore + */ EVT_MUTED, - /** The creature flee in random directions **/ + + /** + * The creature flee in random directions + */ EVT_AFRAID, - /** The creature finish casting **/ + + /** + * The creature finish casting + */ EVT_FINISH_CASTING, - /** The creature betrayed its master */ + + /** + * The creature betrayed its master + */ EVT_BETRAYED } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java index ee0fbd7827..40061faf79 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/FortSiegeGuardAI.java @@ -418,6 +418,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { continue; } + final int chance = 4; if (chance >= Rnd.get(100)) { @@ -427,6 +428,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { break; } + final WorldObject oldTarget = _actor.getTarget(); _actor.setTarget(npc); clientStopMoving(null); @@ -715,6 +717,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable *
  • Add the target to the actor _aggroList or update hate if already present
  • *
  • Set the actor Intention to AI_INTENTION_ATTACK (if actor is GuardInstance check if it isn't too far from its home location)
  • * + * @param target The Creature that attacks * @param aggro The value of hate to add to the actor against the target */ @Override @@ -724,6 +727,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable { return; } + final Attackable me = (Attackable) _actor; if (target != null) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/PlayerAI.java index f3ff67e4c8..c31c960b24 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -170,6 +170,7 @@ public class PlayerAI extends PlayableAI { return; } + changeIntention(AI_INTENTION_REST, null, null); setTarget(null); if (getAttackTarget() != null) @@ -245,12 +246,14 @@ public class PlayerAI extends PlayableAI { return; } + if (checkTargetLostOrDead(target)) { // Notify the target setAttackTarget(null); return; } + if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange())) { return; @@ -304,11 +307,13 @@ public class PlayerAI extends PlayableAI { return; } + final WorldObject target = getTarget(); if (checkTargetLost(target) || maybeMoveToPawn(target, 36)) { return; } + setIntention(AI_INTENTION_IDLE); _actor.getActingPlayer().doPickupItem(target); } @@ -319,15 +324,18 @@ public class PlayerAI extends PlayableAI { return; } + final WorldObject target = getTarget(); if (checkTargetLost(target) || maybeMoveToPawn(target, 36)) { return; } + if (!(target instanceof StaticObjectInstance)) { _actor.getActingPlayer().doInteract((Creature) target); } + setIntention(AI_INTENTION_IDLE); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java index ce45398046..c581c5633f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SiegeGuardAI.java @@ -725,6 +725,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable { return; } + final Attackable me = (Attackable) _actor; if (target != null) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SummonAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SummonAI.java index 217d288f9d..a6d566eccc 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SummonAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/SummonAI.java @@ -106,10 +106,12 @@ public class SummonAI extends PlayableAI implements Runnable setAttackTarget(null); return; } + if (maybeMoveToPawn(getAttackTarget(), _actor.getPhysicalAttackRange())) { return; } + clientStopMoving(null); _actor.doAttack(getAttackTarget()); } @@ -122,11 +124,13 @@ public class SummonAI extends PlayableAI implements Runnable setCastTarget(null); return; } + final boolean val = _startFollow; if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill))) { return; } + clientStopMoving(null); summon.setFollowStatus(false); setIntention(AI_INTENTION_IDLE); @@ -140,6 +144,7 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + setIntention(AI_INTENTION_IDLE); ((Summon) _actor).doPickupItem(getTarget()); } @@ -150,6 +155,7 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + setIntention(AI_INTENTION_IDLE); } @@ -160,7 +166,9 @@ public class SummonAI extends PlayableAI implements Runnable { return; } + _thinking = true; + try { switch (getIntention()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; } diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 301ffb9445..af9b56c678 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -471,6 +471,7 @@ public class CreatureAI extends AbstractAI // Set the AI pick up target setTarget(object); + if ((object.getX() == 0) && (object.getY() == 0)) { // LOGGER.warning("Object in coords 0,0 - using a temporary fix"); @@ -1083,7 +1084,7 @@ public class CreatureAI extends AbstractAI *
    * Example of use: * * @param target The targeted WorldObject * @return True if the target is lost diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CtrlIntention.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CtrlIntention.java index 7d5593c679..0583808de7 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CtrlIntention.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/CtrlIntention.java @@ -23,20 +23,28 @@ public enum CtrlIntention { /** Do nothing, disconnect AI of NPC if no players around */ AI_INTENTION_IDLE, + /** Alerted state without goal : scan attackable targets, random walk, etc */ AI_INTENTION_ACTIVE, + /** Rest (sit until attacked) */ 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. */ AI_INTENTION_ATTACK, + /** Cast a spell, depending on the spell - may start or stop attacking */ AI_INTENTION_CAST, + /** Just move to another location */ AI_INTENTION_MOVE_TO, + /** Like move, but check target's movement and follow it */ AI_INTENTION_FOLLOW, + /** PickUp and item, (got to item, pickup it, become idle */ AI_INTENTION_PICK_UP, + /** Move to target, then interact */ AI_INTENTION_INTERACT; }