From f89c3601632f5e7b48af329a85848813c6f2c1ad Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 29 Mar 2019 15:50:39 +0000 Subject: [PATCH] Stats cleanup and finalizer improvements. --- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- .../model/actor/stat/CreatureStat.java | 10 ++--- .../model/stats/IStatsFunction.java | 6 +-- .../gameserver/model/stats/Stats.java | 38 +++++++++---------- .../stats/finalizers/AttributeFinalizer.java | 4 +- .../stats/finalizers/BaseStatsFinalizer.java | 4 +- .../stats/finalizers/MAccuracyFinalizer.java | 4 +- .../stats/finalizers/MAttackFinalizer.java | 6 +-- .../finalizers/MAttackSpeedFinalizer.java | 4 +- .../stats/finalizers/MCritRateFinalizer.java | 4 +- .../stats/finalizers/MDefenseFinalizer.java | 6 +-- .../finalizers/MEvasionRateFinalizer.java | 4 +- .../stats/finalizers/MaxCpFinalizer.java | 4 +- .../stats/finalizers/MaxHpFinalizer.java | 6 +-- .../stats/finalizers/MaxMpFinalizer.java | 6 +-- .../stats/finalizers/PAccuracyFinalizer.java | 4 +- .../stats/finalizers/PAttackFinalizer.java | 4 +- .../finalizers/PAttackSpeedFinalizer.java | 4 +- .../finalizers/PCriticalRateFinalizer.java | 4 +- .../stats/finalizers/PDefenseFinalizer.java | 6 +-- .../finalizers/PEvasionRateFinalizer.java | 4 +- .../stats/finalizers/PRangeFinalizer.java | 4 +- .../finalizers/RandomDamageFinalizer.java | 4 +- .../stats/finalizers/RegenCPFinalizer.java | 4 +- .../stats/finalizers/RegenHPFinalizer.java | 4 +- .../stats/finalizers/RegenMPFinalizer.java | 6 +-- .../finalizers/ShieldDefenceFinalizer.java | 4 +- .../ShieldDefenceRateFinalizer.java | 4 +- .../stats/finalizers/ShotsBonusFinalizer.java | 4 +- .../stats/finalizers/SpeedFinalizer.java | 4 +- .../finalizers/VampiricChanceFinalizer.java | 4 +- 330 files changed, 957 insertions(+), 957 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } 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 b9226947c1..7e92124025 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 @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -286,10 +286,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -298,16 +298,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -336,7 +336,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -351,20 +351,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -374,17 +374,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 530e98cc91..53e34cc5e4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } 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 b9226947c1..7e92124025 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 @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -286,10 +286,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -298,16 +298,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -336,7 +336,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -351,20 +351,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -374,17 +374,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 530e98cc91..53e34cc5e4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } 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 b9226947c1..7e92124025 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 @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -286,10 +286,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -298,16 +298,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -336,7 +336,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -351,20 +351,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -374,17 +374,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 530e98cc91..53e34cc5e4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } 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 d0e74c2ecb..6f73193b5c 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 @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -287,10 +287,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -299,16 +299,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -337,7 +337,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -352,20 +352,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -375,17 +375,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 530e98cc91..53e34cc5e4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 97d32a7cf3..53de0a86a8 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Stats.java index 9f524b08e4..970c872f5d 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -290,10 +290,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -302,16 +302,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -340,7 +340,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -355,20 +355,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -378,17 +378,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 12bcf4a2cb..663a722c64 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 97d32a7cf3..53de0a86a8 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Stats.java index 6d24e65151..8a2f63f842 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -293,10 +293,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -305,16 +305,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -343,7 +343,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -358,20 +358,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -381,17 +381,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 12bcf4a2cb..663a722c64 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index ba32549f8e..14e734b171 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -743,7 +743,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -755,11 +755,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 97d32a7cf3..53de0a86a8 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Stats.java index 6d24e65151..8a2f63f842 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -293,10 +293,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -305,16 +305,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -343,7 +343,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -358,20 +358,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -381,17 +381,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 154d7c7cf3..4a51fb01f4 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -55,7 +55,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double chaMod = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.; final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2) * chaMod; + baseValue *= intBonus * creature.getLevelMod() * chaMod; return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index ecbbce29a6..ab2178d4ed 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 78e7666ab3..0e2c114e05 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 1415d2a2b7..641806c9e1 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 12bcf4a2cb..663a722c64 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index b4931a1f39..bc2751c868 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 83b4b197ff..8d476eb63f 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 83dc92aa2c..87e27a4a68 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index d264dd87c4..43c263e654 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -47,7 +47,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index 23d246b634..8ff15d2f00 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -723,7 +723,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -745,11 +745,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } 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 052f7cd2b0..e24453722a 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 @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -284,10 +284,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -296,16 +296,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -334,7 +334,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -349,20 +349,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -372,17 +372,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 1c7e04345b..de51134224 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -54,7 +54,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2); + baseValue *= intBonus * creature.getLevelMod(); return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index e0c7be3fed..3f9e930977 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 4d24c2e0cb..f99a6fa202 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 9e842c7030..2650361a7e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 08ebc67b34..2329b3f839 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index 89dc6dc9a2..5a45b6c4cf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 2b0a3e364c..e85d24f716 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 3c01e09af4..5919cef870 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index 68bb79cf58..82f7a06611 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -46,7 +46,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index 23d246b634..8ff15d2f00 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -723,7 +723,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -745,11 +745,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 2e79e4b4a2..8fdc7c7d9a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Stats.java index 052f7cd2b0..e24453722a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -284,10 +284,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -296,16 +296,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -334,7 +334,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -349,20 +349,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -372,17 +372,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 1c7e04345b..de51134224 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -54,7 +54,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2); + baseValue *= intBonus * creature.getLevelMod(); return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index e0c7be3fed..3f9e930977 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 4d24c2e0cb..f99a6fa202 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 9e842c7030..2650361a7e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 08ebc67b34..2329b3f839 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index 89dc6dc9a2..5a45b6c4cf 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 2b0a3e364c..e85d24f716 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 3c01e09af4..5919cef870 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index 68bb79cf58..82f7a06611 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -46,7 +46,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index 23d246b634..8ff15d2f00 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -723,7 +723,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -745,11 +745,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 97d32a7cf3..53de0a86a8 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Stats.java index 138978ef2d..6dc3b9734f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -287,10 +287,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -299,16 +299,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -337,7 +337,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -352,20 +352,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -375,17 +375,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 1c7e04345b..de51134224 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -54,7 +54,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2); + baseValue *= intBonus * creature.getLevelMod(); return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index e0c7be3fed..3f9e930977 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 4d24c2e0cb..f99a6fa202 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 9e842c7030..2650361a7e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 47fdb8a296..00751eac2e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index 89dc6dc9a2..5a45b6c4cf 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 2b0a3e364c..e85d24f716 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 3c01e09af4..5919cef870 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index 68bb79cf58..82f7a06611 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -46,7 +46,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java index 23d246b634..8ff15d2f00 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/stat/CreatureStat.java @@ -24,7 +24,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; @@ -723,7 +723,7 @@ public class CreatureStat public double getValue(Stats stat, double baseValue) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.of(baseValue)); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.of(baseValue)); } /** @@ -733,7 +733,7 @@ public class CreatureStat public double getValue(Stats stat) { final Double fixedValue = _fixedValue.get(stat); - return fixedValue != null ? fixedValue : stat.finalize(_creature, Optional.empty()); + return fixedValue != null ? fixedValue : stat.finalize(_creature, OptionalDouble.empty()); } protected void resetStats() @@ -745,11 +745,11 @@ public class CreatureStat // Initialize default values for (Stats stat : Stats.values()) { - if (stat.getResetAddValue() != null) + if (stat.getResetAddValue() != 0) { _statsAdd.put(stat, stat.getResetAddValue()); } - if (stat.getResetMulValue() != null) + if (stat.getResetMulValue() != 0) { _statsMul.put(stat, stat.getResetMulValue()); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 97d32a7cf3..53de0a86a8 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.PlayerCondOverride; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.items.type.CrystalType; @FunctionalInterface public interface IStatsFunction { - default void throwIfPresent(Optional base) + default void throwIfPresent(OptionalDouble base) { if (base.isPresent()) { @@ -312,5 +312,5 @@ public interface IStatsFunction return Math.max(minValue, value); } - double calc(Creature creature, Optional base, Stats stat); + double calc(Creature creature, OptionalDouble base, Stats stat); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Stats.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Stats.java index 01d6254a7a..6369b90506 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Stats.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/Stats.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.model.stats; import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.BiFunction; +import java.util.OptionalDouble; +import java.util.function.DoubleBinaryOperator; import java.util.logging.Logger; import com.l2jmobius.gameserver.enums.AttributeType; @@ -120,8 +120,8 @@ public enum Stats CRITICAL_DAMAGE_SKILL_ADD("cAtkSkillAdd"), MAGIC_CRITICAL_DAMAGE_ADD("mCritPowerAdd"), SHIELD_DEFENCE_RATE("rShld", new ShieldDefenceRateFinalizer()), - CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, null, 1d), - CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, null, 1d), + CRITICAL_RATE("rCrit", new PCriticalRateFinalizer(), MathUtil::add, MathUtil::add, 0, 1), + CRITICAL_RATE_SKILL("rCritSkill", Stats::defaultValue, MathUtil::add, MathUtil::add, 0, 1), MAGIC_CRITICAL_RATE("mCritRate", new MCritRateFinalizer()), BLOW_RATE("blowRate"), DEFENCE_CRITICAL_RATE("defCritRate"), @@ -290,10 +290,10 @@ public enum Stats private final String _value; private final IStatsFunction _valueFinalizer; - private final BiFunction _addFunction; - private final BiFunction _mulFunction; - private final Double _resetAddValue; - private final Double _resetMulValue; + private final DoubleBinaryOperator _addFunction; + private final DoubleBinaryOperator _mulFunction; + private final double _resetAddValue; + private final double _resetMulValue; public String getValue() { @@ -302,16 +302,16 @@ public enum Stats Stats(String xmlString) { - this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, Stats::defaultValue, MathUtil::add, MathUtil::mul, 0, 1); } Stats(String xmlString, IStatsFunction valueFinalizer) { - this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, null, null); + this(xmlString, valueFinalizer, MathUtil::add, MathUtil::mul, 0, 1); } - Stats(String xmlString, IStatsFunction valueFinalizer, BiFunction addFunction, BiFunction mulFunction, Double resetAddValue, Double resetMulValue) + Stats(String xmlString, IStatsFunction valueFinalizer, DoubleBinaryOperator addFunction, DoubleBinaryOperator mulFunction, double resetAddValue, double resetMulValue) { _value = xmlString; _valueFinalizer = valueFinalizer; @@ -340,7 +340,7 @@ public enum Stats * @param baseValue * @return the final value */ - public Double finalize(Creature creature, Optional baseValue) + public double finalize(Creature creature, OptionalDouble baseValue) { try { @@ -355,20 +355,20 @@ public enum Stats public double functionAdd(double oldValue, double value) { - return _addFunction.apply(oldValue, value); + return _addFunction.applyAsDouble(oldValue, value); } public double functionMul(double oldValue, double value) { - return _mulFunction.apply(oldValue, value); + return _mulFunction.applyAsDouble(oldValue, value); } - public Double getResetAddValue() + public double getResetAddValue() { return _resetAddValue; } - public Double getResetMulValue() + public double getResetMulValue() { return _resetMulValue; } @@ -378,17 +378,17 @@ public enum Stats return stat._valueFinalizer.calcWeaponBaseValue(creature, stat); } - public static double defaultValue(Creature creature, Optional base, Stats stat) + public static double defaultValue(Creature creature, OptionalDouble base, Stats stat) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return base.isPresent() ? defaultValue(creature, stat, base.get()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); + return base.isPresent() ? defaultValue(creature, stat, base.getAsDouble()) : mul * (add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } public static double defaultValue(Creature creature, Stats stat, double baseValue) { final double mul = creature.getStat().getMul(stat); final double add = creature.getStat().getAdd(stat); - return (baseValue * mul) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType()); + return mul * (baseValue + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType())); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java index 80bd304c3d..139dff2d4f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/AttributeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.enums.AttributeType; import com.l2jmobius.gameserver.model.actor.Creature; @@ -41,7 +41,7 @@ public class AttributeFinalizer implements IStatsFunction } @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java index 1424885665..24859e8d4f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/BaseStatsFinalizer.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers; import java.util.HashSet; -import java.util.Optional; +import java.util.OptionalDouble; import java.util.Set; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class BaseStatsFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java index 6bdb2dc6c8..fdad4d6b7a 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.items.Item; @@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java index 1c7e04345b..de51134224 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); @@ -54,7 +54,7 @@ public class MAttackFinalizer implements IStatsFunction // Calculate modifiers Magic Attack final double intBonus = BaseStats.INT.calcBonus(creature); - baseValue *= Math.pow(intBonus, 2) * Math.pow(creature.getLevelMod(), 2); + baseValue *= intBonus * creature.getLevelMod(); return Math.min(Stats.defaultValue(creature, stat, baseValue), Config.MAX_MATK); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java index e0c7be3fed..3f9e930977 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java index 155a46ff69..b09dafb7e2 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MCritRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MCritRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java index 4d24c2e0cb..f99a6fa202 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -43,7 +43,7 @@ public class MDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java index b6fda14d61..531b5fdd3e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java index 9e842c7030..2650361a7e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxCpFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxCpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java index 47fdb8a296..00751eac2e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxHpFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxHpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java index 89dc6dc9a2..5a45b6c4cf 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/MaxMpFinalizer.java @@ -16,11 +16,11 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.stats.BaseStats; import com.l2jmobius.gameserver.model.stats.IStatsFunction; import com.l2jmobius.gameserver.model.stats.Stats; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class MaxMpFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java index 8b63dee6da..087e28ff8b 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAccuracyFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAccuracyFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java index 2b0a3e364c..e85d24f716 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java index 3c01e09af4..5919cef870 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PAttackSpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PAttackSpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = calcWeaponBaseValue(creature, stat); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java index 61dfacae4b..dc9d2c5690 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PCriticalRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PCriticalRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java index 68bb79cf58..82f7a06611 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PDefenseFinalizer.java @@ -16,12 +16,12 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.items.Item; import com.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -46,7 +46,7 @@ public class PDefenseFinalizer implements IStatsFunction }; @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); double baseValue = creature.getTemplate().getBaseValue(stat, 0); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java index bbb95fe5ec..b98f903269 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PEvasionRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PEvasionRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java index cef91bc05f..5ab31feea3 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/PRangeFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class PRangeFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java index e36433cdba..331191c280 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RandomDamageFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RandomDamageFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java index 0d524852f4..418e30f281 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenCPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class RegenCPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); if (!creature.isPlayer()) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index ecaa630d76..602cbe6c55 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.util.Util; public class RegenHPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index 10a6505645..3d227f1fb9 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; @@ -24,8 +24,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.actor.instance.PetInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.Fort; @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.model.zone.type.MotherTreeZone; public class RegenMPFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java index 7919cfb6f8..3a85464efc 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java index 17da1c1d67..51a5fe2cf6 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShieldDefenceRateFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShieldDefenceRateFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java index 3cf802c502..80cb28ea80 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/ShotsBonusFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.gameserver.model.actor.Creature; @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class ShotsBonusFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java index eda7aacfe7..bca2f39b9d 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/SpeedFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.model.zone.type.SwampZone; public class SpeedFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java index 8ce14347bb..6462c90799 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/VampiricChanceFinalizer.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.stats.finalizers; -import java.util.Optional; +import java.util.OptionalDouble; import com.l2jmobius.gameserver.model.actor.Creature; import com.l2jmobius.gameserver.model.stats.IStatsFunction; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.model.stats.Stats; public class VampiricChanceFinalizer implements IStatsFunction { @Override - public double calc(Creature creature, Optional base, Stats stat) + public double calc(Creature creature, OptionalDouble base, Stats stat) { throwIfPresent(base);