diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java index 3f8fc058932d4161fbc80c6f197ad2d345fbfae1..0738a5e71909757550ee3efdcdad955baae47e3e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -123,7 +123,7 @@ public final class EffectMasterHandler MpConsumePerLevel.class, Mute.class, NoblesseBless.class, - NpcKill.class, + Unsummon.class, OpenCommonRecipeBook.class, OpenDwarfRecipeBook.class, Paralyze.class, diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/NpcKill.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Unsummon.java similarity index 68% rename from L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/NpcKill.java rename to L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Unsummon.java index 734c5d194af09eab6d07230cad97958571f5c284..d8076518354b2e52382b6dbaf6dd68e277445e76 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/NpcKill.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/Unsummon.java @@ -20,22 +20,26 @@ package handlers.effecthandlers; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance; import com.l2jserver.gameserver.model.effects.EffectTemplate; import com.l2jserver.gameserver.model.effects.L2Effect; import com.l2jserver.gameserver.model.effects.L2EffectType; import com.l2jserver.gameserver.model.stats.Env; +import com.l2jserver.gameserver.model.stats.Formulas; import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.util.Rnd; /** - * Npc Kill effect implementation. + * Unsummon effect implementation. * @author Adry_85 */ -public class NpcKill extends L2Effect +public class Unsummon extends L2Effect { - public NpcKill(Env env, EffectTemplate template) + private final int _chance; + + public Unsummon(Env env, EffectTemplate template) { super(env, template); + _chance = template.hasParameters() ? template.getParameters().getInt("chance", 100) : 100; } @Override @@ -50,10 +54,26 @@ public class NpcKill extends L2Effect return true; } + @Override + public boolean calcSuccess() + { + int magicLevel = getSkill().getMagicLevel(); + if ((magicLevel <= 0) || ((getEffected().getLevel() - 9) <= magicLevel)) + { + double chance = _chance * Formulas.calcAttributeBonus(getEffector(), getEffected(), getSkill()) * Formulas.calcGeneralTraitBonus(getEffector(), getEffected(), getSkill().getTraitType(), false); + if (chance > (Rnd.nextDouble() * 100)) + { + return true; + } + } + + return false; + } + @Override public boolean onStart() { - if ((getEffected() instanceof L2SiegeSummonInstance)) + if (!getEffected().isSummon()) { return false; } diff --git a/L2J_DataPack_BETA/dist/game/data/stats/skills/01300-01399.xml b/L2J_DataPack_BETA/dist/game/data/stats/skills/01300-01399.xml index 0e525c6bf96e65bce78cb7781f9894f4281dc081..8fd0d5310afdf99c04376fe607fb6daaae741465 100644 --- a/L2J_DataPack_BETA/dist/game/data/stats/skills/01300-01399.xml +++ b/L2J_DataPack_BETA/dist/game/data/stats/skills/01300-01399.xml @@ -3175,7 +3175,9 @@ <enchant1 name="mpConsume" val="#ench1MpConsume" /> <enchant1 name="mpInitialConsume" val="#ench1mpInitialConsume" /> <for> - <effect name="NpcKill" val="0" /> + <effect name="Unsummon" val="0"> + <param chance="80" /> + </effect> </for> </skill> <skill id="1396" levels="10" name="Magical Backfire" enchantGroup1="1" enchantGroup2="1" enchantGroup3="1">