diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_DataPack/dist/game/data/scripts/handlers/EffectMasterHandler.java index 08fecb4ab6b61fca83a7700fbd3dac464411c29a..60eedc4dcd4dfce7b6def778c0ed9b628118bf17 100644 --- a/L2J_DataPack/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_DataPack/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -153,6 +153,7 @@ public final class EffectMasterHandler Resurrection.class, ResurrectionSpecial.class, Root.class, + RunAway.class, ServitorShare.class, SetSkill.class, SilentMove.class, diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java index 326af2db9fb5bf8143cfccbadc8f054604307db9..6bb1610efceedb484f5a41aec07a0dffb03d5f2c 100644 --- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java +++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/Fear.java @@ -18,12 +18,8 @@ */ package handlers.effecthandlers; -import com.l2jserver.Config; -import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.ai.CtrlEvent; -import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.enums.Race; -import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance; import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance; @@ -33,7 +29,6 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect; import com.l2jserver.gameserver.model.effects.EffectFlag; import com.l2jserver.gameserver.model.effects.L2EffectType; import com.l2jserver.gameserver.model.skills.BuffInfo; -import com.l2jserver.gameserver.util.Util; /** * Fear effect implementation. @@ -41,8 +36,6 @@ import com.l2jserver.gameserver.util.Util; */ public final class Fear extends AbstractEffect { - public static final int FEAR_RANGE = 500; - public Fear(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); @@ -77,7 +70,7 @@ public final class Fear extends AbstractEffect @Override public boolean onActionTime(BuffInfo info) { - fearAction(info, false); + info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), false); return false; } @@ -89,34 +82,6 @@ public final class Fear extends AbstractEffect info.getEffected().abortCast(); } - info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID); - fearAction(info, true); - } - - private void fearAction(BuffInfo info, boolean start) - { - double radians = Math.toRadians(start ? Util.calculateAngleFrom(info.getEffector(), info.getEffected()) : Util.convertHeadingToDegree(info.getEffected().getHeading())); - - int posX = (int) (info.getEffected().getX() + (FEAR_RANGE * Math.cos(radians))); - int posY = (int) (info.getEffected().getY() + (FEAR_RANGE * Math.sin(radians))); - int posZ = info.getEffected().getZ(); - - if (!info.getEffected().isPet()) - { - info.getEffected().setRunning(); - } - - // If pathfinding enabled the creature will go to the defined destination (retail like). - // Otherwise it will go to the nearest obstacle. - final Location destination; - if (Config.PATHFINDING > 0) - { - destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId()); - } - else - { - destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId()); - } - info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); + info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), true); } } diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/RunAway.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/RunAway.java new file mode 100644 index 0000000000000000000000000000000000000000..404b716a3c37985cd1a762299a2efb7b6682dc9d --- /dev/null +++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/RunAway.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2004-2015 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * L2J DataPack is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package handlers.effecthandlers; + +import com.l2jserver.gameserver.ai.CtrlEvent; +import com.l2jserver.gameserver.ai.L2AttackableAI; +import com.l2jserver.gameserver.model.StatsSet; +import com.l2jserver.gameserver.model.conditions.Condition; +import com.l2jserver.gameserver.model.effects.AbstractEffect; +import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.util.Rnd; + +/** + * Run Away effect implementation. + * @author Zoey76 + */ +public final class RunAway extends AbstractEffect +{ + private final int _power; + private final int _time; + + public RunAway(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + { + super(attachCond, applyCond, set, params); + + _power = params.getInt("power", 0); + + _time = params.getInt("time", 0); + } + + @Override + public boolean isInstant() + { + return true; + } + + @Override + public void onStart(BuffInfo info) + { + if (!info.getEffected().isAttackable()) + { + return; + } + + if (Rnd.get(100) > _power) + { + return; + } + + if (info.getEffected().isCastingNow() && info.getEffected().canAbortCast()) + { + info.getEffected().abortCast(); + } + + ((L2AttackableAI) info.getEffected().getAI()).setFearTime(_time); + + info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_AFRAID, info.getEffector(), true); + } +} diff --git a/L2J_DataPack/dist/game/data/stats/skills/01400-01499.xml b/L2J_DataPack/dist/game/data/stats/skills/01400-01499.xml index a746a3440df46332bad159d27339a7fd23a8608c..bd6cf36aaedbb492cfdcbd7d89f5cc22a3312055 100644 --- a/L2J_DataPack/dist/game/data/stats/skills/01400-01499.xml +++ b/L2J_DataPack/dist/game/data/stats/skills/01400-01499.xml @@ -7,6 +7,7 @@ <table name="#magicLvl"> 56 58 60 62 64 66 68 70 72 74 </table> <table name="#mpConsume"> 41 43 44 46 48 49 51 52 53 55 </table> <table name="#mpInitialConsume"> 11 11 11 12 12 13 13 13 14 14 </table> + <table name="#ench1Power"> 30 31 32 32 33 34 34 35 36 36 37 38 38 39 40 40 41 42 42 43 44 44 45 46 46 47 48 48 49 50 </table> <table name="#ench1LethalStrikeRate"> 25 25 25 26 26 26 27 27 27 28 28 28 28 29 29 29 30 30 30 31 31 31 31 32 32 32 33 33 33 34 </table> <table name="#ench2mpConsume"> 53 52 51 50 49 48 48 47 46 45 44 43 42 41 40 39 38 38 37 36 35 34 33 32 31 30 29 29 28 27 </table> <table name="#ench2mpInitialConsume"> 13 13 12 12 12 12 12 11 11 11 11 10 10 10 10 9 9 9 9 9 8 8 8 8 7 7 7 7 7 6 </table> @@ -42,25 +43,37 @@ <target race="UNDEAD" /> </cond> <for> - <effect name="Fear" abnormalTime="20" /> + <effect name="RunAway"> + <param power="30" /> + <param time="20" /> + </effect> <effect name="Lethal"> <param fullLethal="25" /> </effect> </for> <enchant1for> - <effect name="Fear" abnormalTime="20" /> + <effect name="RunAway"> + <param power="#ench1Power" /> + <param time="20" /> + </effect> <effect name="Lethal"> <param fullLethal="#ench1LethalStrikeRate" /> </effect> </enchant1for> <enchant2for> - <effect name="Fear" abnormalTime="#ench2Time" /> + <effect name="RunAway"> + <param power="#ench1Power" /> + <param time="#ench2Time" /> + </effect> <effect name="Lethal"> <param fullLethal="25" /> </effect> </enchant2for> <enchant3for> - <effect name="Fear" abnormalTime="20" /> + <effect name="RunAway"> + <param power="30" /> + <param time="20" /> + </effect> <effect name="Lethal"> <param fullLethal="25" /> </effect> diff --git a/L2J_DataPack/dist/game/data/xsd/skills.xsd b/L2J_DataPack/dist/game/data/xsd/skills.xsd index e1ac6ff131ac9a6c2f17b569b935d802e5c4f777..9306b040f3c639d9752d03a46293763a1e492308 100644 --- a/L2J_DataPack/dist/game/data/xsd/skills.xsd +++ b/L2J_DataPack/dist/game/data/xsd/skills.xsd @@ -242,6 +242,7 @@ <xs:attribute type="xs:short" name="skillId1" use="optional" /> <xs:attribute type="xs:short" name="skillId2" use="optional" /> <xs:attribute type="xs:short" name="skillId3" use="optional" /> + <xs:attribute type="xs:string" name="time" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType>