From 2da9634c37b4f160c47b64d6060801ef4c1b6234 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 11 Apr 2018 18:28:58 +0000 Subject: [PATCH] Sync with L2jserver to improve archer AI. Source: https://bitbucket.org/l2jserver/l2j_server/commits/161a74f23f7d --- .../gameserver/ai/L2AttackableAI.java | 984 +++++++++--------- 1 file changed, 517 insertions(+), 467 deletions(-) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 2140351a32..53289857c1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -23,7 +23,6 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE; import java.util.List; import java.util.Set; import java.util.concurrent.Future; -import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; @@ -69,7 +68,7 @@ import com.l2jmobius.gameserver.util.Util; */ public class L2AttackableAI extends L2CharacterAI implements Runnable { - private static final Logger LOGGER = Logger.getLogger(L2AttackableAI.class.getName()); + // private static final Logger LOGGER = Logger.getLogger(L2AttackableAI.class.getName()); /** * Fear task. @@ -113,8 +112,6 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable private int _globalAggro; /** The flag used to indicate that a thinking action is in progress, to prevent recursive thinking. */ private boolean _thinking; - - private int _timePass = 0; private int _chaosTime = 0; private int _lastBuffTick; // Fear parameters @@ -182,9 +179,17 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable final L2Attackable me = getActiveChar(); // Check if the target isn't invulnerable - if (target.isInvul() && ((target.isPlayer() && target.isGM()) || (target.isSummon() && ((L2Summon) target).getOwner().isGM()))) + if (target.isInvul()) { - return false; + // However EffectInvincible requires to check GMs specially + if (target.isPlayer() && target.isGM()) + { + return false; + } + if (target.isSummon() && ((L2Summon) target).getOwner().isGM()) + { + return false; + } } // Check if the target isn't a Folk or a Door @@ -200,9 +205,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } // Check if the target is a L2Playable - if (target.isPlayable() && !me.isRaid() && !me.canSeeThroughSilentMove() && ((L2Playable) target).isSilentMovingAffected()) + if (target.isPlayable()) { - return false; + // Check if the AI isn't a Raid Boss, can See Silent Moving players and the target isn't in silent move mode + if (!(me.isRaid()) && !(me.canSeeThroughSilentMove()) && ((L2Playable) target).isSilentMovingAffected()) + { + return false; + } } // Gets the player if there is any. @@ -275,7 +284,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable if (me.isChaos() && me.isInsideRadius(target, me.getAggroRange(), false, false)) { - return !((L2Attackable) target).isInMyClan(me) && GeoEngine.getInstance().canSeeTarget(me, target); + if (((L2Attackable) target).isInMyClan(me)) + { + return false; + } + // Los Check + return GeoEngine.getInstance().canSeeTarget(me, target); } } @@ -573,7 +587,16 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { final int offset; final int minRadius = 30; - offset = npc.isRaidMinion() ? 500 : 200; // for Raids - need correction + + if (npc.isRaidMinion()) + { + offset = 500; // for Raids - need correction + } + else + { + offset = 200; // for normal minions - need correction :) + } + if (leader.isRunning()) { npc.setRunning(); @@ -582,6 +605,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable { npc.setWalking(); } + if (npc.calculateDistance(leader, false, true) > (offset * offset)) { int x1 = Rnd.get(minRadius * 2, offset * 2); // x @@ -679,7 +703,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } /** - * Manage AI attack thinks of a L2Attackable (called by onEvtThink). Actions : + * Manage AI attack thinks of a L2Attackable (called by onEvtThink).
+ * Actions: *