Stats cleanup and finalizer improvements.
This commit is contained in:
@ -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());
|
||||
}
|
||||
|
@ -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<Double> 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<Double> base, Stats stat);
|
||||
double calc(Creature creature, OptionalDouble base, Stats stat);
|
||||
}
|
||||
|
@ -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<Double, Double, Double> _addFunction;
|
||||
private final BiFunction<Double, Double, Double> _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<Double, Double, Double> addFunction, BiFunction<Double, Double, Double> 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<Double> 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<Double> 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()));
|
||||
}
|
||||
}
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> 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);
|
||||
}
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
double baseValue = creature.getTemplate().getBaseValue(stat, 0);
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
double baseValue = calcWeaponBaseValue(creature, stat);
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
double baseValue = creature.getTemplate().getBaseValue(stat, 0);
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
if (!creature.isPlayer())
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
@ -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<Double> base, Stats stat)
|
||||
public double calc(Creature creature, OptionalDouble base, Stats stat)
|
||||
{
|
||||
throwIfPresent(base);
|
||||
|
||||
|
Reference in New Issue
Block a user