From 66041edbf050f70c9ede15567e2a85e1b617dadc Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 10 Mar 2019 12:01:10 +0000 Subject: [PATCH] Plunder effect improvements. --- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- .../handlers/effecthandlers/Plunder.java | 28 +++++++++++++++++-- 11 files changed, 275 insertions(+), 33 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/Plunder.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/Plunder.java index e9aea29bd9..91056861b1 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/Plunder.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/Plunder.java @@ -18,6 +18,8 @@ package handlers.effecthandlers; import java.util.Collection; +import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.StatsSet; @@ -28,7 +30,6 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.stats.Formulas; import com.l2jmobius.gameserver.network.SystemMessageId; /** @@ -43,7 +44,22 @@ public final class Plunder extends AbstractEffect @Override public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill) { - return Formulas.calcMagicSuccess(effector, effected, skill); + final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel())); + final double lvlModifier = Math.pow(1.3, lvlDifference); + float targetModifier = 1; + if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3)) + { + final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2; + if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size()) + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1); + } + else + { + targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff); + } + } + return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier))); } @Override @@ -74,7 +90,13 @@ public final class Plunder extends AbstractEffect return; } + if (!player.getInventory().checkInventorySlotsAndWeight(monster.getSpoilLootItems(), false, false)) + { + return; + } + monster.setSpoilerObjectId(effector.getObjectId()); + if (monster.isSweepActive()) { final Collection items = monster.takeSweep(); @@ -89,7 +111,7 @@ public final class Plunder extends AbstractEffect } else { - player.addItem("Sweeper", sweepedItem, effected, true); + player.addItem("Plunder", sweepedItem, effected, true); } } }