From d4187ff7651acb0118cf858f3a6a1bddb3352f04 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 7 Dec 2017 22:57:14 +0000 Subject: [PATCH] Addition of WorldChat and DamageByAttack effect handlers. Adapted from: L2jUnity free files. --- .../scripts/handlers/EffectMasterHandler.java | 2 + .../admincommandhandlers/AdminAdmin.java | 10 +-- .../handlers/chathandlers/ChatWorld.java | 4 +- .../handlers/effecthandlers/Backstab.java | 7 --- .../effecthandlers/DamageByAttack.java | 63 +++++++++++++++++++ .../handlers/effecthandlers/EnergyAttack.java | 5 -- .../handlers/effecthandlers/FatalBlow.java | 7 --- .../effecthandlers/PhysicalAttack.java | 6 +- .../effecthandlers/PhysicalAttackHpLink.java | 5 -- .../effecthandlers/PhysicalAttackSaveHp.java | 6 -- .../PhysicalAttackWeaponBonus.java | 5 -- .../effecthandlers/PhysicalSoulAttack.java | 5 -- .../handlers/effecthandlers/SoulBlow.java | 7 --- .../effecthandlers/WorldChatPoints.java | 31 +++++++++ .../game/data/stats/skills/documentation.txt | 4 +- .../gameserver/enums/DamageByAttackType.java | 26 ++++++++ .../instancemanager/DailyTaskManager.java | 6 +- .../gameserver/model/actor/L2Character.java | 19 ++++++ .../model/actor/instance/L2PcInstance.java | 16 +++-- .../gameserver/model/stats/Stats.java | 5 ++ .../model/variables/PlayerVariables.java | 2 +- .../network/serverpackets/ExWorldChatCnt.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 2 + .../admincommandhandlers/AdminAdmin.java | 10 +-- .../handlers/chathandlers/ChatWorld.java | 4 +- .../handlers/effecthandlers/Backstab.java | 7 --- .../effecthandlers/DamageByAttack.java | 63 +++++++++++++++++++ .../handlers/effecthandlers/EnergyAttack.java | 5 -- .../handlers/effecthandlers/FatalBlow.java | 7 --- .../effecthandlers/PhysicalAttack.java | 6 +- .../effecthandlers/PhysicalAttackHpLink.java | 5 -- .../effecthandlers/PhysicalAttackSaveHp.java | 6 -- .../PhysicalAttackWeaponBonus.java | 5 -- .../effecthandlers/PhysicalSoulAttack.java | 5 -- .../handlers/effecthandlers/SoulBlow.java | 7 --- .../effecthandlers/WorldChatPoints.java | 31 +++++++++ .../game/data/stats/skills/documentation.txt | 4 +- .../gameserver/enums/DamageByAttackType.java | 26 ++++++++ .../instancemanager/DailyTaskManager.java | 6 +- .../gameserver/model/actor/L2Character.java | 19 ++++++ .../model/actor/instance/L2PcInstance.java | 16 +++-- .../gameserver/model/stats/Stats.java | 5 ++ .../model/variables/PlayerVariables.java | 2 +- .../network/serverpackets/ExWorldChatCnt.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 2 + .../admincommandhandlers/AdminAdmin.java | 10 +-- .../handlers/chathandlers/ChatWorld.java | 4 +- .../handlers/effecthandlers/Backstab.java | 7 --- .../effecthandlers/DamageByAttack.java | 63 +++++++++++++++++++ .../handlers/effecthandlers/EnergyAttack.java | 5 -- .../handlers/effecthandlers/FatalBlow.java | 7 --- .../effecthandlers/PhysicalAttack.java | 6 +- .../effecthandlers/PhysicalAttackHpLink.java | 5 -- .../effecthandlers/PhysicalAttackSaveHp.java | 6 -- .../PhysicalAttackWeaponBonus.java | 5 -- .../effecthandlers/PhysicalSoulAttack.java | 5 -- .../handlers/effecthandlers/SoulBlow.java | 7 --- .../effecthandlers/WorldChatPoints.java | 31 +++++++++ .../game/data/stats/skills/documentation.txt | 4 +- .../gameserver/enums/DamageByAttackType.java | 26 ++++++++ .../instancemanager/DailyTaskManager.java | 6 +- .../gameserver/model/actor/L2Character.java | 19 ++++++ .../model/actor/instance/L2PcInstance.java | 16 +++-- .../gameserver/model/stats/Stats.java | 5 ++ .../model/variables/PlayerVariables.java | 2 +- .../network/serverpackets/ExWorldChatCnt.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 2 + .../admincommandhandlers/AdminAdmin.java | 10 +-- .../handlers/chathandlers/ChatWorld.java | 4 +- .../handlers/effecthandlers/Backstab.java | 7 --- .../effecthandlers/DamageByAttack.java | 63 +++++++++++++++++++ .../handlers/effecthandlers/EnergyAttack.java | 5 -- .../handlers/effecthandlers/FatalBlow.java | 7 --- .../effecthandlers/PhysicalAttack.java | 6 +- .../effecthandlers/PhysicalAttackHpLink.java | 5 -- .../effecthandlers/PhysicalAttackSaveHp.java | 6 -- .../PhysicalAttackWeaponBonus.java | 5 -- .../effecthandlers/PhysicalSoulAttack.java | 5 -- .../handlers/effecthandlers/SoulBlow.java | 7 --- .../effecthandlers/WorldChatPoints.java | 31 +++++++++ .../game/data/stats/skills/documentation.txt | 4 +- .../gameserver/enums/DamageByAttackType.java | 26 ++++++++ .../instancemanager/DailyTaskManager.java | 6 +- .../gameserver/model/actor/L2Character.java | 19 ++++++ .../model/actor/instance/L2PcInstance.java | 16 +++-- .../gameserver/model/stats/Stats.java | 5 ++ .../model/variables/PlayerVariables.java | 2 +- .../network/serverpackets/ExWorldChatCnt.java | 2 +- .../scripts/handlers/EffectMasterHandler.java | 2 + .../admincommandhandlers/AdminAdmin.java | 10 +-- .../handlers/chathandlers/ChatWorld.java | 4 +- .../handlers/effecthandlers/Backstab.java | 7 --- .../effecthandlers/DamageByAttack.java | 63 +++++++++++++++++++ .../handlers/effecthandlers/EnergyAttack.java | 5 -- .../handlers/effecthandlers/FatalBlow.java | 7 --- .../effecthandlers/PhysicalAttack.java | 6 +- .../effecthandlers/PhysicalAttackHpLink.java | 5 -- .../effecthandlers/PhysicalAttackSaveHp.java | 6 -- .../PhysicalAttackWeaponBonus.java | 5 -- .../effecthandlers/PhysicalSoulAttack.java | 5 -- .../handlers/effecthandlers/SoulBlow.java | 7 --- .../effecthandlers/WorldChatPoints.java | 31 +++++++++ .../game/data/stats/skills/documentation.txt | 4 +- .../gameserver/enums/DamageByAttackType.java | 26 ++++++++ .../instancemanager/DailyTaskManager.java | 6 +- .../gameserver/model/actor/L2Character.java | 19 ++++++ .../model/actor/instance/L2PcInstance.java | 16 +++-- .../gameserver/model/stats/Stats.java | 5 ++ .../model/variables/PlayerVariables.java | 2 +- .../network/serverpackets/ExWorldChatCnt.java | 2 +- 110 files changed, 870 insertions(+), 345 deletions(-) create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java create mode 100644 L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java create mode 100644 L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java create mode 100644 L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java create mode 100644 L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java index ad0250f05d..083746616b 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -99,6 +99,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("CrystalGradeModify", CrystalGradeModify::new); EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new); EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new); + EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new); EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new); EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new); EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new); @@ -361,6 +362,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new); EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new); EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new); + EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new); LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers."); } } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java index bba35fe89a..7b78de63fe 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java @@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL); break; } - activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points"); + activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times."); break; } case "set": @@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler if (!st.hasMoreTokens()) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } final String valueToken = st.nextToken(); if (!Util.isDigit(valueToken)) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } - activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); - targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken)); + activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); + targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken)); if (Config.ENABLE_WORLD_CHAT) { targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer)); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java index bebc5ddfeb..343d4031dc 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java @@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - else if (activeChar.getWorldChatPoints() < 1) + else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints()) { activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30); } @@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo); } - activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1); + activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1); activeChar.sendPacket(new ExWorldChatCnt(activeChar)); if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0) { diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Backstab.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Backstab.java index 71ae527d76..95e7eb384c 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Backstab.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/Backstab.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Backstab effect implementation. @@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, true, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage)) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java new file mode 100644 index 0000000000..a494b1b594 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java @@ -0,0 +1,63 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.enums.DamageByAttackType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * An effect that changes damage taken from an attack.
+ * The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done.
+ * Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.
+ * As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,
+ * because reflected damage is being calculated with the original attack damage and not this altered one.
+ * Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0. + * @author Nik + */ +public class DamageByAttack extends AbstractEffect +{ + private final double _value; + private final DamageByAttackType _type; + + public DamageByAttack(StatsSet params) + { + _value = params.getDouble("amount"); + _type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE); + } + + @Override + public void pump(L2Character target, Skill skill) + { + switch (_type) + { + case PK: + { + target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value); + break; + } + case ENEMY_ALL: + { + target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value); + break; + } + } + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java index 3494dea8c7..d5278cebda 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java @@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(attacker, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // attacker.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java index adc84b170a..7a20bcfb31 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.stats.Formulas; -import com.l2jmobius.gameserver.model.stats.Stats; /** * Fatal Blow effect implementation. @@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java index 4d7f414d83..43eb65d382 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java @@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } + effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java index 775a02b11c..a92be012e1 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java @@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect // Check if damage should be reflected. Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java index 8624c8839d..3e3dc2ed94 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java @@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - final double minHp = (effected.getMaxHp() * _saveHp) / 100; if ((effected.getCurrentHp() - damage) < minHp) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java index 9464c802fc..52f4ef07cc 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java @@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java index b6bb7e46a0..b8fe23abc8 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java @@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java index 0f8b28bfed..5dd50a27ed 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Soul Blow effect implementation. @@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java new file mode 100644 index 0000000000..ac36b6e75e --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * @author Nik + */ +public class WorldChatPoints extends AbstractStatEffect +{ + public WorldChatPoints(StatsSet params) + { + super(params, Stats.WORLD_CHAT_POINTS); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt index 7fbacfcb2e..0ed1c87ddf 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/documentation.txt @@ -68,6 +68,7 @@ CriticalRatePositionBonus: Critical Rate depending on position stat. Ignores the CrystalGradeModify: Sets your Expertise Grade level. With this effect you can make lv. 40 player (C Grade) to wear S grade. CubicMastery: Max cubics stat. DamageBlock: Blocks Hp or Mp damage/heal. +DamageByAttack: An effect that changes damage taken from an attack. DamageShield: Reflect damage percentage stat. DamageShieldResist: Reflect damage percentage resist. DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started. @@ -327,4 +328,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius) VitalityPointsRate: Vitality points consume rate. VitalityPointUp: Increases vitality points. WeightLimit: Maximum weight stat. -WeightPenalty: Weight penalty level stat. \ No newline at end of file +WeightPenalty: Weight penalty level stat. +WorldChatPoints: Modify world chat points to use per day. diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java new file mode 100644 index 0000000000..1792b340a4 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java @@ -0,0 +1,26 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package com.l2jmobius.gameserver.enums; + +public enum DamageByAttackType +{ + NONE, + PK, // Players and summons. + MOB, // Regular monsters. + BOSS, // Boss monsters + ENEMY_ALL; // All NPCs +} diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index ed15565032..f6bcb4da22 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -156,7 +156,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.getVariables().set(PlayerVariables.EXTEND_DROP, ""); + player.getVariables().remove(PlayerVariables.EXTEND_DROP); player.getVariables().storeMe(); }); @@ -195,7 +195,7 @@ public class DailyTaskManager extends AbstractEventManager> try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?")) { - ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY); + ps.setInt(1, 0); ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME); ps.executeUpdate(); } @@ -207,7 +207,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY); + player.setWorldChatUsed(0); player.sendPacket(new ExWorldChatCnt(player)); player.getVariables().storeMe(); }); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 8fb7c854dc..c65da7865f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } } + final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT); + if (damageCap > 0) + { + value = Math.min(value, damageCap); + } + + // Calculate PvP/PvE damage received. It is a post-attack stat. + if (attacker != null) + { + if (attacker.isPlayable()) + { + value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100; + } + else + { + value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100; + } + } + if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0)) { getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 759b4e8a7a..2ecd6decf9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13450,16 +13450,24 @@ public final class L2PcInstance extends L2Playable */ public int getWorldChatPoints() { - return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1); + return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY); + } + + /** + * @return The amount of times player has used world chat + */ + public int getWorldChatUsed() + { + return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0); } /** * Sets the amount of times player can use world chat - * @param points + * @param timesUsed how many times world chat has been used up until now. */ - public void setWorldChatPoints(int points) + public void setWorldChatUsed(int timesUsed) { - getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points); + getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed); } public void prohibiteCeremonyOfChaos() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Stats.java index 8cc33a9dd5..2efa5493aa 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -103,6 +103,10 @@ public enum Stats PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"), PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"), + // FIXED BONUS + PVP_DAMAGE_TAKEN("pvpDamageTaken"), + PVE_DAMAGE_TAKEN("pveDamageTaken"), + // ATTACK & DEFENCE RATES MAGIC_CRITICAL_DAMAGE("mCritPower"), PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc. @@ -268,6 +272,7 @@ public enum Stats STAT_BONUS_SKILL_CRITICAL("statSkillCritical"), STAT_BONUS_SPEED("statSpeed"), SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()), + WORLD_CHAT_POINTS("worldChatPoints"), ATTACK_DAMAGE("attackDamage"); static final Logger LOGGER = Logger.getLogger(Stats.class.getName()); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 833deff3c1..550a059807 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables // Public variable names public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED"; - public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS"; + public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED"; public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED"; private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS"; public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES"; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java index dffcf4df97..25a7bf54c9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java @@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket public ExWorldChatCnt(L2PcInstance activeChar) { - _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints(); + _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0); } @Override diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java index ad0250f05d..083746616b 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -99,6 +99,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("CrystalGradeModify", CrystalGradeModify::new); EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new); EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new); + EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new); EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new); EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new); EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new); @@ -361,6 +362,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new); EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new); EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new); + EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new); LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers."); } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java index bba35fe89a..7b78de63fe 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java @@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL); break; } - activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points"); + activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times."); break; } case "set": @@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler if (!st.hasMoreTokens()) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } final String valueToken = st.nextToken(); if (!Util.isDigit(valueToken)) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } - activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); - targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken)); + activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); + targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken)); if (Config.ENABLE_WORLD_CHAT) { targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer)); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java index bebc5ddfeb..343d4031dc 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java @@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - else if (activeChar.getWorldChatPoints() < 1) + else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints()) { activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30); } @@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo); } - activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1); + activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1); activeChar.sendPacket(new ExWorldChatCnt(activeChar)); if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0) { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Backstab.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Backstab.java index 71ae527d76..95e7eb384c 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Backstab.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/Backstab.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Backstab effect implementation. @@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, true, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage)) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java new file mode 100644 index 0000000000..a494b1b594 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java @@ -0,0 +1,63 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.enums.DamageByAttackType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * An effect that changes damage taken from an attack.
+ * The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done.
+ * Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.
+ * As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,
+ * because reflected damage is being calculated with the original attack damage and not this altered one.
+ * Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0. + * @author Nik + */ +public class DamageByAttack extends AbstractEffect +{ + private final double _value; + private final DamageByAttackType _type; + + public DamageByAttack(StatsSet params) + { + _value = params.getDouble("amount"); + _type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE); + } + + @Override + public void pump(L2Character target, Skill skill) + { + switch (_type) + { + case PK: + { + target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value); + break; + } + case ENEMY_ALL: + { + target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value); + break; + } + } + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java index 3494dea8c7..d5278cebda 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java @@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(attacker, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // attacker.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java index adc84b170a..7a20bcfb31 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.stats.Formulas; -import com.l2jmobius.gameserver.model.stats.Stats; /** * Fatal Blow effect implementation. @@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java index 4d7f414d83..43eb65d382 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java @@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } + effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java index 775a02b11c..a92be012e1 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java @@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect // Check if damage should be reflected. Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java index 8624c8839d..3e3dc2ed94 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java @@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - final double minHp = (effected.getMaxHp() * _saveHp) / 100; if ((effected.getCurrentHp() - damage) < minHp) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java index 9464c802fc..52f4ef07cc 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java @@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java index b6bb7e46a0..b8fe23abc8 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java @@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java index 0f8b28bfed..5dd50a27ed 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Soul Blow effect implementation. @@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java new file mode 100644 index 0000000000..ac36b6e75e --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * @author Nik + */ +public class WorldChatPoints extends AbstractStatEffect +{ + public WorldChatPoints(StatsSet params) + { + super(params, Stats.WORLD_CHAT_POINTS); + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt index 7fbacfcb2e..0ed1c87ddf 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/documentation.txt @@ -68,6 +68,7 @@ CriticalRatePositionBonus: Critical Rate depending on position stat. Ignores the CrystalGradeModify: Sets your Expertise Grade level. With this effect you can make lv. 40 player (C Grade) to wear S grade. CubicMastery: Max cubics stat. DamageBlock: Blocks Hp or Mp damage/heal. +DamageByAttack: An effect that changes damage taken from an attack. DamageShield: Reflect damage percentage stat. DamageShieldResist: Reflect damage percentage resist. DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started. @@ -327,4 +328,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius) VitalityPointsRate: Vitality points consume rate. VitalityPointUp: Increases vitality points. WeightLimit: Maximum weight stat. -WeightPenalty: Weight penalty level stat. \ No newline at end of file +WeightPenalty: Weight penalty level stat. +WorldChatPoints: Modify world chat points to use per day. diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java new file mode 100644 index 0000000000..1792b340a4 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java @@ -0,0 +1,26 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package com.l2jmobius.gameserver.enums; + +public enum DamageByAttackType +{ + NONE, + PK, // Players and summons. + MOB, // Regular monsters. + BOSS, // Boss monsters + ENEMY_ALL; // All NPCs +} diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index 2cf208e267..24a5e58b7f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -159,7 +159,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.getVariables().set(PlayerVariables.EXTEND_DROP, ""); + player.getVariables().remove(PlayerVariables.EXTEND_DROP); player.getVariables().storeMe(); }); @@ -198,7 +198,7 @@ public class DailyTaskManager extends AbstractEventManager> try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?")) { - ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY); + ps.setInt(1, 0); ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME); ps.executeUpdate(); } @@ -210,7 +210,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY); + player.setWorldChatUsed(0); player.sendPacket(new ExWorldChatCnt(player)); player.getVariables().storeMe(); }); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 8fb7c854dc..c65da7865f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } } + final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT); + if (damageCap > 0) + { + value = Math.min(value, damageCap); + } + + // Calculate PvP/PvE damage received. It is a post-attack stat. + if (attacker != null) + { + if (attacker.isPlayable()) + { + value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100; + } + else + { + value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100; + } + } + if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0)) { getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 148b58aba8..c8a0a37581 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13451,16 +13451,24 @@ public final class L2PcInstance extends L2Playable */ public int getWorldChatPoints() { - return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1); + return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY); + } + + /** + * @return The amount of times player has used world chat + */ + public int getWorldChatUsed() + { + return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0); } /** * Sets the amount of times player can use world chat - * @param points + * @param timesUsed how many times world chat has been used up until now. */ - public void setWorldChatPoints(int points) + public void setWorldChatUsed(int timesUsed) { - getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points); + getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed); } public void prohibiteCeremonyOfChaos() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Stats.java index 8cc33a9dd5..2efa5493aa 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -103,6 +103,10 @@ public enum Stats PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"), PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"), + // FIXED BONUS + PVP_DAMAGE_TAKEN("pvpDamageTaken"), + PVE_DAMAGE_TAKEN("pveDamageTaken"), + // ATTACK & DEFENCE RATES MAGIC_CRITICAL_DAMAGE("mCritPower"), PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc. @@ -268,6 +272,7 @@ public enum Stats STAT_BONUS_SKILL_CRITICAL("statSkillCritical"), STAT_BONUS_SPEED("statSpeed"), SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()), + WORLD_CHAT_POINTS("worldChatPoints"), ATTACK_DAMAGE("attackDamage"); static final Logger LOGGER = Logger.getLogger(Stats.class.getName()); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 526aed9ae1..3af614eede 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables // Public variable names public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED"; - public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS"; + public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED"; public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED"; private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS"; public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES"; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java index dffcf4df97..25a7bf54c9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java @@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket public ExWorldChatCnt(L2PcInstance activeChar) { - _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints(); + _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0); } @Override diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java index ad0250f05d..083746616b 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -99,6 +99,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("CrystalGradeModify", CrystalGradeModify::new); EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new); EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new); + EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new); EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new); EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new); EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new); @@ -361,6 +362,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new); EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new); EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new); + EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new); LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers."); } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java index bba35fe89a..7b78de63fe 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java @@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL); break; } - activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points"); + activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times."); break; } case "set": @@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler if (!st.hasMoreTokens()) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } final String valueToken = st.nextToken(); if (!Util.isDigit(valueToken)) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } - activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); - targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken)); + activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); + targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken)); if (Config.ENABLE_WORLD_CHAT) { targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer)); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java index bebc5ddfeb..343d4031dc 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java @@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - else if (activeChar.getWorldChatPoints() < 1) + else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints()) { activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30); } @@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo); } - activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1); + activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1); activeChar.sendPacket(new ExWorldChatCnt(activeChar)); if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0) { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Backstab.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Backstab.java index 71ae527d76..95e7eb384c 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Backstab.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/Backstab.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Backstab effect implementation. @@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, true, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage)) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java new file mode 100644 index 0000000000..a494b1b594 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java @@ -0,0 +1,63 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.enums.DamageByAttackType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * An effect that changes damage taken from an attack.
+ * The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done.
+ * Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.
+ * As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,
+ * because reflected damage is being calculated with the original attack damage and not this altered one.
+ * Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0. + * @author Nik + */ +public class DamageByAttack extends AbstractEffect +{ + private final double _value; + private final DamageByAttackType _type; + + public DamageByAttack(StatsSet params) + { + _value = params.getDouble("amount"); + _type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE); + } + + @Override + public void pump(L2Character target, Skill skill) + { + switch (_type) + { + case PK: + { + target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value); + break; + } + case ENEMY_ALL: + { + target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value); + break; + } + } + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java index 3494dea8c7..d5278cebda 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java @@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(attacker, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // attacker.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java index adc84b170a..7a20bcfb31 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.stats.Formulas; -import com.l2jmobius.gameserver.model.stats.Stats; /** * Fatal Blow effect implementation. @@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java index 4d7f414d83..43eb65d382 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java @@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } + effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java index 775a02b11c..a92be012e1 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java @@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect // Check if damage should be reflected. Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java index 8624c8839d..3e3dc2ed94 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java @@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - final double minHp = (effected.getMaxHp() * _saveHp) / 100; if ((effected.getCurrentHp() - damage) < minHp) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java index 9464c802fc..52f4ef07cc 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java @@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java index b6bb7e46a0..b8fe23abc8 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java @@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java index 0f8b28bfed..5dd50a27ed 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Soul Blow effect implementation. @@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java new file mode 100644 index 0000000000..ac36b6e75e --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * @author Nik + */ +public class WorldChatPoints extends AbstractStatEffect +{ + public WorldChatPoints(StatsSet params) + { + super(params, Stats.WORLD_CHAT_POINTS); + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt index 7fbacfcb2e..0ed1c87ddf 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/documentation.txt @@ -68,6 +68,7 @@ CriticalRatePositionBonus: Critical Rate depending on position stat. Ignores the CrystalGradeModify: Sets your Expertise Grade level. With this effect you can make lv. 40 player (C Grade) to wear S grade. CubicMastery: Max cubics stat. DamageBlock: Blocks Hp or Mp damage/heal. +DamageByAttack: An effect that changes damage taken from an attack. DamageShield: Reflect damage percentage stat. DamageShieldResist: Reflect damage percentage resist. DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started. @@ -327,4 +328,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius) VitalityPointsRate: Vitality points consume rate. VitalityPointUp: Increases vitality points. WeightLimit: Maximum weight stat. -WeightPenalty: Weight penalty level stat. \ No newline at end of file +WeightPenalty: Weight penalty level stat. +WorldChatPoints: Modify world chat points to use per day. diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java new file mode 100644 index 0000000000..1792b340a4 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java @@ -0,0 +1,26 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package com.l2jmobius.gameserver.enums; + +public enum DamageByAttackType +{ + NONE, + PK, // Players and summons. + MOB, // Regular monsters. + BOSS, // Boss monsters + ENEMY_ALL; // All NPCs +} diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index 2cf208e267..24a5e58b7f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -159,7 +159,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.getVariables().set(PlayerVariables.EXTEND_DROP, ""); + player.getVariables().remove(PlayerVariables.EXTEND_DROP); player.getVariables().storeMe(); }); @@ -198,7 +198,7 @@ public class DailyTaskManager extends AbstractEventManager> try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?")) { - ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY); + ps.setInt(1, 0); ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME); ps.executeUpdate(); } @@ -210,7 +210,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY); + player.setWorldChatUsed(0); player.sendPacket(new ExWorldChatCnt(player)); player.getVariables().storeMe(); }); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 8fb7c854dc..c65da7865f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } } + final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT); + if (damageCap > 0) + { + value = Math.min(value, damageCap); + } + + // Calculate PvP/PvE damage received. It is a post-attack stat. + if (attacker != null) + { + if (attacker.isPlayable()) + { + value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100; + } + else + { + value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100; + } + } + if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0)) { getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 122ac6c6af..f9d1fceead 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13462,16 +13462,24 @@ public final class L2PcInstance extends L2Playable */ public int getWorldChatPoints() { - return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1); + return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY); + } + + /** + * @return The amount of times player has used world chat + */ + public int getWorldChatUsed() + { + return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0); } /** * Sets the amount of times player can use world chat - * @param points + * @param timesUsed how many times world chat has been used up until now. */ - public void setWorldChatPoints(int points) + public void setWorldChatUsed(int timesUsed) { - getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points); + getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed); } public void prohibiteCeremonyOfChaos() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Stats.java index 8cc33a9dd5..2efa5493aa 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -103,6 +103,10 @@ public enum Stats PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"), PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"), + // FIXED BONUS + PVP_DAMAGE_TAKEN("pvpDamageTaken"), + PVE_DAMAGE_TAKEN("pveDamageTaken"), + // ATTACK & DEFENCE RATES MAGIC_CRITICAL_DAMAGE("mCritPower"), PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc. @@ -268,6 +272,7 @@ public enum Stats STAT_BONUS_SKILL_CRITICAL("statSkillCritical"), STAT_BONUS_SPEED("statSpeed"), SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()), + WORLD_CHAT_POINTS("worldChatPoints"), ATTACK_DAMAGE("attackDamage"); static final Logger LOGGER = Logger.getLogger(Stats.class.getName()); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 526aed9ae1..3af614eede 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables // Public variable names public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED"; - public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS"; + public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED"; public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED"; private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS"; public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES"; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java index dffcf4df97..25a7bf54c9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java @@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket public ExWorldChatCnt(L2PcInstance activeChar) { - _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints(); + _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0); } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java index 3b03c51e6c..aca4f296d8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -103,6 +103,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("Crystallize", Crystallize::new); EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new); EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new); + EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new); EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new); EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new); EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new); @@ -366,6 +367,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new); EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new); EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new); + EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new); LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers."); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java index bba35fe89a..7b78de63fe 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java @@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL); break; } - activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points"); + activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times."); break; } case "set": @@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler if (!st.hasMoreTokens()) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } final String valueToken = st.nextToken(); if (!Util.isDigit(valueToken)) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } - activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); - targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken)); + activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); + targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken)); if (Config.ENABLE_WORLD_CHAT) { targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer)); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java index bebc5ddfeb..343d4031dc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java @@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - else if (activeChar.getWorldChatPoints() < 1) + else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints()) { activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30); } @@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo); } - activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1); + activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1); activeChar.sendPacket(new ExWorldChatCnt(activeChar)); if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0) { diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Backstab.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Backstab.java index 71ae527d76..95e7eb384c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Backstab.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/Backstab.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Backstab effect implementation. @@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, true, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage)) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java new file mode 100644 index 0000000000..a494b1b594 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java @@ -0,0 +1,63 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.enums.DamageByAttackType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * An effect that changes damage taken from an attack.
+ * The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done.
+ * Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.
+ * As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,
+ * because reflected damage is being calculated with the original attack damage and not this altered one.
+ * Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0. + * @author Nik + */ +public class DamageByAttack extends AbstractEffect +{ + private final double _value; + private final DamageByAttackType _type; + + public DamageByAttack(StatsSet params) + { + _value = params.getDouble("amount"); + _type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE); + } + + @Override + public void pump(L2Character target, Skill skill) + { + switch (_type) + { + case PK: + { + target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value); + break; + } + case ENEMY_ALL: + { + target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value); + break; + } + } + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java index 3494dea8c7..d5278cebda 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java @@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(attacker, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // attacker.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java index adc84b170a..7a20bcfb31 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.stats.Formulas; -import com.l2jmobius.gameserver.model.stats.Stats; /** * Fatal Blow effect implementation. @@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java index 4d7f414d83..43eb65d382 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java @@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } + effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java index 775a02b11c..a92be012e1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java @@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect // Check if damage should be reflected. Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java index 8624c8839d..3e3dc2ed94 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java @@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - final double minHp = (effected.getMaxHp() * _saveHp) / 100; if ((effected.getCurrentHp() - damage) < minHp) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java index 9464c802fc..52f4ef07cc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java @@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java index b6bb7e46a0..b8fe23abc8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java @@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java index 0f8b28bfed..5dd50a27ed 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Soul Blow effect implementation. @@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java new file mode 100644 index 0000000000..ac36b6e75e --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * @author Nik + */ +public class WorldChatPoints extends AbstractStatEffect +{ + public WorldChatPoints(StatsSet params) + { + super(params, Stats.WORLD_CHAT_POINTS); + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt index b6a8dab881..de302442c6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/documentation.txt @@ -72,6 +72,7 @@ CrystalGradeModify: Sets your Expertise Grade level. With this effect you can ma Crystallize: Allows the player to crystallize items up to a certain grade. CubicMastery: Max cubics stat. DamageBlock: Blocks Hp or Mp damage/heal. +DamageByAttack: An effect that changes damage taken from an attack. DamageShield: Reflect damage percentage stat. DamageShieldResist: Reflect damage percentage resist. DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started. @@ -332,4 +333,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius) VitalityPointsRate: Vitality points consume rate. VitalityPointUp: Increases vitality points. WeightLimit: Maximum weight stat. -WeightPenalty: Weight penalty level stat. \ No newline at end of file +WeightPenalty: Weight penalty level stat. +WorldChatPoints: Modify world chat points to use per day. diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java new file mode 100644 index 0000000000..1792b340a4 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java @@ -0,0 +1,26 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package com.l2jmobius.gameserver.enums; + +public enum DamageByAttackType +{ + NONE, + PK, // Players and summons. + MOB, // Regular monsters. + BOSS, // Boss monsters + ENEMY_ALL; // All NPCs +} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index 2cf208e267..24a5e58b7f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -159,7 +159,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.getVariables().set(PlayerVariables.EXTEND_DROP, ""); + player.getVariables().remove(PlayerVariables.EXTEND_DROP); player.getVariables().storeMe(); }); @@ -198,7 +198,7 @@ public class DailyTaskManager extends AbstractEventManager> try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?")) { - ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY); + ps.setInt(1, 0); ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME); ps.executeUpdate(); } @@ -210,7 +210,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY); + player.setWorldChatUsed(0); player.sendPacket(new ExWorldChatCnt(player)); player.getVariables().storeMe(); }); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 8fb7c854dc..c65da7865f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } } + final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT); + if (damageCap > 0) + { + value = Math.min(value, damageCap); + } + + // Calculate PvP/PvE damage received. It is a post-attack stat. + if (attacker != null) + { + if (attacker.isPlayable()) + { + value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100; + } + else + { + value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100; + } + } + if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0)) { getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 76b3588b54..42e3de66c7 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13436,16 +13436,24 @@ public final class L2PcInstance extends L2Playable */ public int getWorldChatPoints() { - return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1); + return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY); + } + + /** + * @return The amount of times player has used world chat + */ + public int getWorldChatUsed() + { + return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0); } /** * Sets the amount of times player can use world chat - * @param points + * @param timesUsed how many times world chat has been used up until now. */ - public void setWorldChatPoints(int points) + public void setWorldChatUsed(int timesUsed) { - getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points); + getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed); } public void prohibiteCeremonyOfChaos() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Stats.java index f7eb8c23ca..a3ee75350d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -103,6 +103,10 @@ public enum Stats PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"), PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"), + // FIXED BONUS + PVP_DAMAGE_TAKEN("pvpDamageTaken"), + PVE_DAMAGE_TAKEN("pveDamageTaken"), + // ATTACK & DEFENCE RATES MAGIC_CRITICAL_DAMAGE("mCritPower"), PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc. @@ -269,6 +273,7 @@ public enum Stats STAT_BONUS_SPEED("statSpeed"), CRAFTING_CRITICAL("craftingCritical"), SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()), + WORLD_CHAT_POINTS("worldChatPoints"), ATTACK_DAMAGE("attackDamage"); static final Logger LOGGER = Logger.getLogger(Stats.class.getName()); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 526aed9ae1..3af614eede 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables // Public variable names public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED"; - public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS"; + public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED"; public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED"; private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS"; public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES"; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java index dffcf4df97..25a7bf54c9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java @@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket public ExWorldChatCnt(L2PcInstance activeChar) { - _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints(); + _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0); } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java index 52262767aa..0e8d2a7cf5 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -98,6 +98,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("CrystalGradeModify", CrystalGradeModify::new); EffectHandler.getInstance().registerHandler("CubicMastery", CubicMastery::new); EffectHandler.getInstance().registerHandler("DamageBlock", DamageBlock::new); + EffectHandler.getInstance().registerHandler("DamageByAttack", DamageByAttack::new); EffectHandler.getInstance().registerHandler("DamageShield", DamageShield::new); EffectHandler.getInstance().registerHandler("DamageShieldResist", DamageShieldResist::new); EffectHandler.getInstance().registerHandler("DamOverTime", DamOverTime::new); @@ -360,6 +361,7 @@ public final class EffectMasterHandler EffectHandler.getInstance().registerHandler("VitalityPointUp", VitalityPointUp::new); EffectHandler.getInstance().registerHandler("WeightLimit", WeightLimit::new); EffectHandler.getInstance().registerHandler("WeightPenalty", WeightPenalty::new); + EffectHandler.getInstance().registerHandler("WorldChatPoints", WorldChatPoints::new); LOGGER.info(EffectMasterHandler.class.getSimpleName() + ": Loaded " + EffectHandler.getInstance().size() + " effect handlers."); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java index bba35fe89a..7b78de63fe 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminAdmin.java @@ -333,7 +333,7 @@ public class AdminAdmin implements IAdminCommandHandler activeChar.sendMessage("Your target's level is below the minimum: " + Config.WORLD_CHAT_MIN_LEVEL); break; } - activeChar.sendMessage(targetPlayer.getName() + ": has " + targetPlayer.getWorldChatPoints() + " world chat points"); + activeChar.sendMessage(targetPlayer.getName() + ": has used world chat " + targetPlayer.getWorldChatUsed() + " times out of maximum " + targetPlayer.getWorldChatPoints() + " times."); break; } case "set": @@ -354,19 +354,19 @@ public class AdminAdmin implements IAdminCommandHandler if (!st.hasMoreTokens()) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } final String valueToken = st.nextToken(); if (!Util.isDigit(valueToken)) { - activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); + activeChar.sendMessage("Incorrect syntax, use: //worldchat set "); break; } - activeChar.sendMessage(targetPlayer.getName() + ": points changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); - targetPlayer.setWorldChatPoints(Integer.parseInt(valueToken)); + activeChar.sendMessage(targetPlayer.getName() + ": times used changed from " + targetPlayer.getWorldChatPoints() + " to " + valueToken); + targetPlayer.setWorldChatUsed(Integer.parseInt(valueToken)); if (Config.ENABLE_WORLD_CHAT) { targetPlayer.sendPacket(new ExWorldChatCnt(targetPlayer)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java index bebc5ddfeb..343d4031dc 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/chathandlers/ChatWorld.java @@ -74,7 +74,7 @@ public final class ChatWorld implements IChatHandler activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); return; } - else if (activeChar.getWorldChatPoints() < 1) + else if (activeChar.getWorldChatUsed() >= activeChar.getWorldChatPoints()) { activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_A_NEW_DAY_STARTS_EVERY_DAY_AT_18_30); } @@ -111,7 +111,7 @@ public final class ChatWorld implements IChatHandler L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo); } - activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1); + activeChar.setWorldChatUsed(activeChar.getWorldChatUsed() + 1); activeChar.sendPacket(new ExWorldChatCnt(activeChar)); if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Backstab.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Backstab.java index 71ae527d76..95e7eb384c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Backstab.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/Backstab.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Backstab effect implementation. @@ -89,12 +88,6 @@ public final class Backstab extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, true, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) if (!effected.isRaid() && Formulas.calcAtkBreak(effected, damage)) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java new file mode 100644 index 0000000000..a494b1b594 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/DamageByAttack.java @@ -0,0 +1,63 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.enums.DamageByAttackType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * An effect that changes damage taken from an attack.
+ * The retail implementation seems to be altering whatever damage is taken after the attack has been done and not when attack is being done.
+ * Exceptions for this effect appears to be DOT effects and terrain damage, they are unaffected by this stat.
+ * As for example in retail this effect does reduce reflected damage taken (because it is received damage), as well as it does not decrease reflected damage done,
+ * because reflected damage is being calculated with the original attack damage and not this altered one.
+ * Multiple values of this effect add-up to each other rather than multiplying with each other. Be careful, there were cases in retail where damage is deacreased to 0. + * @author Nik + */ +public class DamageByAttack extends AbstractEffect +{ + private final double _value; + private final DamageByAttackType _type; + + public DamageByAttack(StatsSet params) + { + _value = params.getDouble("amount"); + _type = params.getEnum("type", DamageByAttackType.class, DamageByAttackType.NONE); + } + + @Override + public void pump(L2Character target, Skill skill) + { + switch (_type) + { + case PK: + { + target.getStat().mergeAdd(Stats.PVP_DAMAGE_TAKEN, _value); + break; + } + case ENEMY_ALL: + { + target.getStat().mergeAdd(Stats.PVE_DAMAGE_TAKEN, _value); + break; + } + } + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java index 3494dea8c7..d5278cebda 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/EnergyAttack.java @@ -165,11 +165,6 @@ public final class EnergyAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(attacker, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // attacker.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java index adc84b170a..7a20bcfb31 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/FatalBlow.java @@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.stats.Formulas; -import com.l2jmobius.gameserver.model.stats.Stats; /** * Fatal Blow effect implementation. @@ -121,12 +120,6 @@ public final class FatalBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java index 4d7f414d83..43eb65d382 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttack.java @@ -174,11 +174,7 @@ public final class PhysicalAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } + effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java index 775a02b11c..a92be012e1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackHpLink.java @@ -137,11 +137,6 @@ public final class PhysicalAttackHpLink extends AbstractEffect // Check if damage should be reflected. Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java index 8624c8839d..3e3dc2ed94 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackSaveHp.java @@ -147,12 +147,6 @@ public final class PhysicalAttackSaveHp extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - final double minHp = (effected.getMaxHp() * _saveHp) / 100; if ((effected.getCurrentHp() - damage) < minHp) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java index 9464c802fc..52f4ef07cc 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalAttackWeaponBonus.java @@ -168,11 +168,6 @@ public final class PhysicalAttackWeaponBonus extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java index b6bb7e46a0..b8fe23abc8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java @@ -162,11 +162,6 @@ public final class PhysicalSoulAttack extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, critical); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } effected.reduceCurrentHp(damage, effector, skill, false, false, critical, false); // effector.sendDamageMessage(effected, skill, (int) damage, critical, false); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java index 0f8b28bfed..5dd50a27ed 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.effects.L2EffectType; 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.model.stats.Stats; /** * Soul Blow effect implementation. @@ -94,12 +93,6 @@ public final class SoulBlow extends AbstractEffect // Check if damage should be reflected Formulas.calcCounterAttack(effector, effected, skill, true); - final double damageCap = effected.getStat().getValue(Stats.DAMAGE_LIMIT); - if (damageCap > 0) - { - damage = Math.min(damage, damageCap); - } - effected.reduceCurrentHp(damage, effector, skill, false, false, true, false); // Manage attack or cast break of the target (calculating rate, sending message...) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java new file mode 100644 index 0000000000..ac36b6e75e --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/effecthandlers/WorldChatPoints.java @@ -0,0 +1,31 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package handlers.effecthandlers; + +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.stats.Stats; + +/** + * @author Nik + */ +public class WorldChatPoints extends AbstractStatEffect +{ + public WorldChatPoints(StatsSet params) + { + super(params, Stats.WORLD_CHAT_POINTS); + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt index f5a14f4b91..21450d8575 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/skills/documentation.txt @@ -67,6 +67,7 @@ CriticalRatePositionBonus: Critical Rate depending on position stat. Ignores the CrystalGradeModify: Sets your Expertise Grade level. With this effect you can make lv. 40 player (C Grade) to wear S grade. CubicMastery: Max cubics stat. DamageBlock: Blocks Hp or Mp damage/heal. +DamageByAttack: An effect that changes damage taken from an attack. DamageShield: Reflect damage percentage stat. DamageShieldResist: Reflect damage percentage resist. DamOverTime: Damage over time effect. Magic Critical results in 10 times amount to me instantly inflicted before the effect is started. @@ -326,4 +327,5 @@ VitalityExpRate: Sets the vitality exp rate. (l2jmobius) VitalityPointsRate: Vitality points consume rate. VitalityPointUp: Increases vitality points. WeightLimit: Maximum weight stat. -WeightPenalty: Weight penalty level stat. \ No newline at end of file +WeightPenalty: Weight penalty level stat. +WorldChatPoints: Modify world chat points to use per day. diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java new file mode 100644 index 0000000000..1792b340a4 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/DamageByAttackType.java @@ -0,0 +1,26 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package com.l2jmobius.gameserver.enums; + +public enum DamageByAttackType +{ + NONE, + PK, // Players and summons. + MOB, // Regular monsters. + BOSS, // Boss monsters + ENEMY_ALL; // All NPCs +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java index 2cf208e267..24a5e58b7f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java @@ -159,7 +159,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.getVariables().set(PlayerVariables.EXTEND_DROP, ""); + player.getVariables().remove(PlayerVariables.EXTEND_DROP); player.getVariables().storeMe(); }); @@ -198,7 +198,7 @@ public class DailyTaskManager extends AbstractEventManager> try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?")) { - ps.setInt(1, Config.WORLD_CHAT_POINTS_PER_DAY); + ps.setInt(1, 0); ps.setString(2, PlayerVariables.WORLD_CHAT_VARIABLE_NAME); ps.executeUpdate(); } @@ -210,7 +210,7 @@ public class DailyTaskManager extends AbstractEventManager> // Update data for online players. L2World.getInstance().getPlayers().stream().forEach(player -> { - player.setWorldChatPoints(Config.WORLD_CHAT_POINTS_PER_DAY); + player.setWorldChatUsed(0); player.sendPacket(new ExWorldChatCnt(player)); player.getVariables().storeMe(); }); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 8fb7c854dc..c65da7865f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4552,6 +4552,25 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } } + final double damageCap = getStat().getValue(Stats.DAMAGE_LIMIT); + if (damageCap > 0) + { + value = Math.min(value, damageCap); + } + + // Calculate PvP/PvE damage received. It is a post-attack stat. + if (attacker != null) + { + if (attacker.isPlayable()) + { + value *= (100 + getStat().getValue(Stats.PVP_DAMAGE_TAKEN)) / 100; + } + else + { + value *= (100 + getStat().getValue(Stats.PVE_DAMAGE_TAKEN)) / 100; + } + } + if (Config.CHAMPION_ENABLE && isChampion() && (Config.CHAMPION_HP != 0)) { getStatus().reduceHp(value / Config.CHAMPION_HP, attacker, (skill == null) || !skill.isToggle(), isDOT, false); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index dada6f9fb5..701f64f21b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -13385,16 +13385,24 @@ public final class L2PcInstance extends L2Playable */ public int getWorldChatPoints() { - return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 1); + return (int) getStat().getValue(Stats.WORLD_CHAT_POINTS, Config.WORLD_CHAT_POINTS_PER_DAY); + } + + /** + * @return The amount of times player has used world chat + */ + public int getWorldChatUsed() + { + return getVariables().getInt(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, 0); } /** * Sets the amount of times player can use world chat - * @param points + * @param timesUsed how many times world chat has been used up until now. */ - public void setWorldChatPoints(int points) + public void setWorldChatUsed(int timesUsed) { - getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, points); + getVariables().set(PlayerVariables.WORLD_CHAT_VARIABLE_NAME, timesUsed); } public void prohibiteCeremonyOfChaos() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Stats.java index 8cc33a9dd5..2efa5493aa 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -103,6 +103,10 @@ public enum Stats PVE_RAID_PHYSICAL_SKILL_DEFENCE("pveRaidPhysSkillsDef"), PVE_RAID_MAGICAL_SKILL_DEFENCE("pveRaidMagicalDef"), + // FIXED BONUS + PVP_DAMAGE_TAKEN("pvpDamageTaken"), + PVE_DAMAGE_TAKEN("pveDamageTaken"), + // ATTACK & DEFENCE RATES MAGIC_CRITICAL_DAMAGE("mCritPower"), PHYSICAL_SKILL_POWER("physicalSkillPower"), // Adding skill power (not multipliers) results in points added directly to final value unmodified by defence, traits, elements, criticals etc. @@ -268,6 +272,7 @@ public enum Stats STAT_BONUS_SKILL_CRITICAL("statSkillCritical"), STAT_BONUS_SPEED("statSpeed"), SHOTS_BONUS("shotBonus", new ShotsBonusFinalizer()), + WORLD_CHAT_POINTS("worldChatPoints"), ATTACK_DAMAGE("attackDamage"); static final Logger LOGGER = Logger.getLogger(Stats.class.getName()); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java index 526aed9ae1..3af614eede 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -46,7 +46,7 @@ public class PlayerVariables extends AbstractVariables // Public variable names public static final String HAIR_ACCESSORY_VARIABLE_NAME = "HAIR_ACCESSORY_ENABLED"; - public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_POINTS"; + public static final String WORLD_CHAT_VARIABLE_NAME = "WORLD_CHAT_USED"; public static final String VITALITY_ITEMS_USED_VARIABLE_NAME = "VITALITY_ITEMS_USED"; private static final String DAILY_MISSION_REWARDS = "DAILY_MISSION_REWARDS"; public static final String CEREMONY_OF_CHAOS_PROHIBITED_PENALTIES = "CEREMONY_OF_CHAOS_PENALTIES"; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java index dffcf4df97..25a7bf54c9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/ExWorldChatCnt.java @@ -30,7 +30,7 @@ public class ExWorldChatCnt implements IClientOutgoingPacket public ExWorldChatCnt(L2PcInstance activeChar) { - _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : activeChar.getWorldChatPoints(); + _points = activeChar.getLevel() < Config.WORLD_CHAT_MIN_LEVEL ? 0 : Math.max(activeChar.getWorldChatPoints() - activeChar.getWorldChatUsed(), 0); } @Override