From 908705a2761cf54d385aa09d65f0dcef50f5a581 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 4 Sep 2018 02:26:48 +0000 Subject: [PATCH] Proper summon intention after stun. --- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../scripts/handlers/effecthandlers/Stun.java | 18 +++++++++++++++- .../gameserver/model/actor/L2Summon.java | 4 ++-- .../clientpackets/RequestActionUse.java | 4 ++-- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- .../handlers/effecthandlers/BlockActions.java | 21 ++++++++++++++++--- 10 files changed, 147 insertions(+), 26 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/Stun.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/Stun.java index 4e1c5b5499..a411e90011 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/Stun.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/Stun.java @@ -16,7 +16,10 @@ */ package handlers.effecthandlers; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; @@ -49,7 +52,20 @@ public final class Stun extends AbstractEffect @Override public void onExit(BuffInfo info) { - info.getEffected().stopStunning(false); + final L2Character effected = info.getEffected(); + effected.stopStunning(false); + if (effected.isSummon()) + { + final L2Character effector = info.getEffector(); + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doSummonAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 4ed33b2f29..ca3018c5d8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -945,12 +945,12 @@ public abstract class L2Summon extends L2Playable /** * Performs an attack to the owner's target. + * @param target the target to attack. */ - public void doAttack() + public void doSummonAttack(L2Object target) { if (_owner != null) { - final L2Object target = _owner.getTarget(); if (target != null) { setTarget(target); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java index 4a07a0474c..87967fe6e3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java @@ -183,7 +183,7 @@ public final class RequestActionUse implements IClientIncomingPacket { if (summon.canAttack(_ctrlPressed)) { - summon.doAttack(); + summon.doSummonAttack(target); } } break; @@ -241,7 +241,7 @@ public final class RequestActionUse implements IClientIncomingPacket { if (summon.canAttack(_ctrlPressed)) { - summon.doAttack(); + summon.doSummonAttack(target); } } break; diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java index e375a452b0..9de33c7db2 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/BlockActions.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.EffectFlag; import com.l2jmobius.gameserver.model.effects.L2EffectType; @@ -66,13 +67,27 @@ public final class BlockActions extends AbstractEffect public void onExit(L2Character effector, L2Character effected, Skill skill) { _allowedSkills.stream().forEach(effected::removeBlockActionsAllowedSkill); - if (!effected.isPlayer()) + if (effected.isPlayable()) { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + if (effected.isSummon()) + { + if ((effector != null) && !effector.isDead()) + { + ((L2Summon) effected).doAttack(effector); + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, effected.getActingPlayer()); + } + } + else + { + effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + } } else { - effected.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); } } }