+ * ctx.result = c.getTemplate().getBaseCritical(); // must be checked + * ctx.result *= BaseStats.WIT.calculateBonus(c.getStats().getWitness()); + *+ * + * @author Rogiel + */ +public class MagicalCriticalRateBonusCalculator extends ActorCalculator { + public MagicalCriticalRateBonusCalculator() { + super(new ActorCalculatorFunction(0x300) { + @Override + protected double calculate(Actor a, ActorTemplate> t, double value) { + // TODO only apply if using a weapon + return value + * BaseStats.WIT.calculateBonus(a.getStats() + .getWitness()); + } + }); + } +} diff --git a/src/main/java/com/l2jserver/model/world/actor/calculator/MagicalDefenseBonusCalculator.java b/src/main/java/com/l2jserver/model/world/actor/calculator/MagicalDefenseBonusCalculator.java new file mode 100644 index 000000000..e149e2149 --- /dev/null +++ b/src/main/java/com/l2jserver/model/world/actor/calculator/MagicalDefenseBonusCalculator.java @@ -0,0 +1,68 @@ +/* + * This file is part of l2jserver
+ * if (inv.has(LEFT_FINGER)) + * ctx.result -= 5; + * if (inv.has(RIGHT_FINGER)) + * ctx.result -= 5; + * if (inv.has(LEFT_EAR)) + * ctx.result -= 9; + * if (inv.has(RIGHT_EAR)) + * ctx.result -= 9; + * if (inv.has(NECK)) + * ctx.result -= 13; + * ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality()) + * * ((100.0 - 11 + c.getLevel()) / 100.0); + *+ * + * @author Rogiel + */ +public class MagicalDefenseBonusCalculator extends ActorCalculator { + public MagicalDefenseBonusCalculator() { + super(new ActorCalculatorFunction(0x200) { + @Override + protected double calculate(Actor a, ActorTemplate> t, double value) { + // final CharacterInventory inv = c.getInventory(); + + // if (inv.has(LEFT_FINGER)) + // ctx.result -= 5; + // if (inv.has(RIGHT_FINGER)) + // ctx.result -= 5; + // if (inv.has(LEFT_EAR)) + // ctx.result -= 9; + // if (inv.has(RIGHT_EAR)) + // ctx.result -= 9; + // if (inv.has(NECK)) + // ctx.result -= 13; + + return value + * BaseStats.MEN.calculateBonus(a.getStats() + .getMentality()) + * ((100.0 - 11 + a.getLevel()) / 100.0); + } + }); + } +} diff --git a/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumHPBonusCalculator.java b/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumHPBonusCalculator.java new file mode 100644 index 000000000..91c33c9bc --- /dev/null +++ b/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumHPBonusCalculator.java @@ -0,0 +1,43 @@ +/* + * This file is part of l2jserver
+ * return value * BaseStats.CON.calculateBonus(c.getStats().getConcentration()); + *+ * + * @author Rogiel + */ +public class MaximumHPBonusCalculator extends ActorCalculator { + public MaximumHPBonusCalculator() { + super(new ActorCalculatorFunction(0x200) { + @Override + protected double calculate(Actor a, ActorTemplate> t, double value) { + return value + * BaseStats.CON.calculateBonus(a.getStats() + .getConcentration()); + } + }); + } +} diff --git a/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumMPBonusCalculator.java b/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumMPBonusCalculator.java new file mode 100644 index 000000000..a5b2e3925 --- /dev/null +++ b/src/main/java/com/l2jserver/model/world/actor/calculator/MaximumMPBonusCalculator.java @@ -0,0 +1,43 @@ +/* + * This file is part of l2jserver
+ * return value * BaseStats.CON.calculateBonus(c.getStats().getConcentration()); + *+ * + * @author Rogiel + */ +public class MaximumMPBonusCalculator extends ActorCalculator { + public MaximumMPBonusCalculator() { + super(new ActorCalculatorFunction(0x200) { + @Override + protected double calculate(Actor a, ActorTemplate> t, double value) { + return value + * BaseStats.MEN.calculateBonus(a.getStats() + .getMentality()); + } + }); + } +} diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BasePhysicalAttackCalculator.java b/src/main/java/com/l2jserver/model/world/actor/calculator/PhysicalAttackBonusCalculator.java similarity index 58% rename from src/main/java/com/l2jserver/model/world/character/calculator/BasePhysicalAttackCalculator.java rename to src/main/java/com/l2jserver/model/world/actor/calculator/PhysicalAttackBonusCalculator.java index a2933e402..6902f6088 100644 --- a/src/main/java/com/l2jserver/model/world/character/calculator/BasePhysicalAttackCalculator.java +++ b/src/main/java/com/l2jserver/model/world/actor/calculator/PhysicalAttackBonusCalculator.java @@ -14,12 +14,11 @@ * You should have received a copy of the GNU General Public License * along with l2jserver. If not, see
+ * ctx.result = c.getTemplate().getBasePhysicalDefense(); + * + * if (inv.has(HEAD)) + * ctx.result -= 12; + * final Item chest = inv.getItem(CHEST); + * if (chest != null) + * ctx.result -= hasMagePDef ? 15 : 31; + * if (inv.has(LEGS)) + * ctx.result -= hasMagePDef ? 8 : 18; + * if (inv.has(GLOVES)) + * ctx.result -= 8; + * if (inv.has(FEET)) + * ctx.result -= 7; + * ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0); + *+ * + * @author Rogiel + */ +public class PhysicalDefenseBonusCalculator extends ActorCalculator { + public PhysicalDefenseBonusCalculator() { + super(new ActorCalculatorFunction(0x200) { + @Override + protected double calculate(Actor a, ActorTemplate> t, double value) { + // final CharacterInventory inv = c.getInventory(); + // + // // orc mystics are a special case + // boolean hasMagePDef = (c.getCharacterClass().type == + // ClassType.MYSTIC || c + // .getCharacterClass() == CharacterClass.ORC_MYSTIC); + // + // if (inv.has(HEAD)) + // ctx.result -= 12; + // final Item chest = inv.getItem(CHEST); + // if (chest != null) + // ctx.result -= hasMagePDef ? 15 : 31; + // if (inv.has(LEGS)) + // // FIXME full armor also applies here + // ctx.result -= hasMagePDef ? 8 : 18; + // if (inv.has(GLOVES)) + // ctx.result -= 8; + // if (inv.has(FEET)) + // ctx.result -= 7; + return value * ((100.0 - 11 + a.getLevel()) / 100.0); + } + }); + } +} diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseRunSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/actor/calculator/RunSpeedBonusCalculator.java similarity index 58% rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseRunSpeedCalculator.java rename to src/main/java/com/l2jserver/model/world/actor/calculator/RunSpeedBonusCalculator.java index aacd974cd..07813bc9b 100644 --- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseRunSpeedCalculator.java +++ b/src/main/java/com/l2jserver/model/world/actor/calculator/RunSpeedBonusCalculator.java @@ -14,36 +14,32 @@ * You should have received a copy of the GNU General Public License * along with l2jserver. If not, see
- * ctx.result = c.getTemplate().getBaseRunSpeed(); * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity()); ** * @author Rogiel */ -public class BaseRunSpeedCalculator extends CharacterCalculator { - @SuppressWarnings("unchecked") - public BaseRunSpeedCalculator() { - super(new AbstractFunction
- * ctx.result = c.getTemplate().getBaseWalkSpeed(); * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity()); ** * @author Rogiel */ -public class BaseWalkSpeedCalculator extends CharacterCalculator { - @SuppressWarnings("unchecked") - public BaseWalkSpeedCalculator() { - super(new AbstractFunction
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator HP_BONUS_CALCULATOR = new MaximumHPBonusCalculator(); + /** + * The calculator for base maximum HP + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator MP_BONUS_CALCULATOR = new MaximumMPBonusCalculator(); + /** + * The calculator for run speed bonus + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator RUN_SPEED_BONUS_CALCULATOR = new RunSpeedBonusCalculator(); + /** + * The calculator for walk speed bonus + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator WALK_SPEED_BONUS_CALCULATOR = new WalkSpeedBonusCalculator(); + /** + * The calculator base physical attack + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator PHYSICAL_ATTACK_BONUS_CALCULATOR = new PhysicalAttackBonusCalculator(); + /** + * The calculator base physical attack speed + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator PHYSICAL_ATTACK_SPEED_BONUS_CALCULATOR = new PhysicalAttackSpeedBonusCalculator(); + /** + * The calculator base physical attack critical rate + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator PHYSICAL_CRITICAL_RATE_BONUS_CALCULATOR = new PhysicalCriticalRateBonusCalculator(); + /** + * The calculator base physical defense + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator PHYSICAL_DEFENSE_BONUS_CALCULATOR = new PhysicalDefenseBonusCalculator(); + + /** + * The calculator base magical attack + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator MAGICAL_ATTACK_BONUS_CALCULATOR = new MagicalAttackBonusCalculator(); + /** + * The calculator base magical attack speed + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator MAGICAL_ATTACK_SPEED_BONUS_CALCULATOR = new MagicalAttackSpeedBonusCalculator(); + /** + * The calculator base magical attack critical rate + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator MAGICAL_CRITICAL_RATE_BONUS_CALCULATOR = new MagicalCriticalRateBonusCalculator(); + /** + * The calculator base magical defense + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator MAGICAL_DEFENSE_BONUS_CALCULATOR = new MagicalDefenseBonusCalculator(); + + /** + * The calculator base attack accuracy + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator ATTACK_ACCURACY_BONUS_CALCULATOR = new AttackAccuracyBonusCalculator(); + /** + * The calculator base evasion + *
+ * This calculator does not store any state and thus is safe to be + * shared. + */ + private static final ActorCalculator ATTACK_EVASION_BONUS_CALCULATOR = new AttackEvasionBonusCalculator(); + + /** + * The list of calculators for this character + *
+ * It is safe to use an array since this number cannot be changed in
+ * runtime, it would be required to be able to change the {@link StatType}
+ * enum. Also, an full-sized array is created because this way we don't need
+ * to change the array size very often. A bit of memory is "lost", but the
+ * speed gain is much higher.
+ */
+ @SuppressWarnings("unchecked")
+ private final Calculator
- * This calculator does not store any state and thus is safe to be
- * shared.
- */
- private static final CharacterCalculator BASE_HP_CALCULATOR = new BaseHPCalculator();
+public class CharacterStats extends ActorStats
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MP_CALCULATOR = new BaseMPCalculator();
+ private static final CharacterCalculator BASE_HP_CALCULATOR = new CharacterBaseHPCalculator();
+ /**
+ * The calculator for base maximum MP
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final CharacterCalculator BASE_MP_CALCULATOR = new CharacterBaseMPCalculator();
/**
* The calculator for base maximum CP
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_CP_CALCULATOR = new BaseCPCalculator();
+ private static final CharacterCalculator BASE_CP_CALCULATOR = new CharacterBaseCPCalculator();
/**
* The calculator for base intelligence
@@ -90,42 +95,42 @@ public class CharacterStats extends ActorStats {
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_INT_CALCULATOR = new BaseIntelligenceCalculator();
+ private static final CharacterCalculator BASE_INT_CALCULATOR = new CharacterBaseIntelligenceCalculator();
/**
* The calculator for base strength
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_STR_CALCULATOR = new BaseStrengthCalculator();
+ private static final CharacterCalculator BASE_STR_CALCULATOR = new CharacterBaseStrengthCalculator();
/**
* The calculator for base concentration
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_CON_CALCULATOR = new BaseConcentrationCalculator();
+ private static final CharacterCalculator BASE_CON_CALCULATOR = new CharacterBaseConcentrationCalculator();
/**
* The calculator for base mentality
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MEN_CALCULATOR = new BaseMentalityCalculator();
+ private static final CharacterCalculator BASE_MEN_CALCULATOR = new CharacterBaseMentalityCalculator();
/**
* The calculator for base dexterity
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_DEX_CALCULATOR = new BaseDexterityCalculator();
+ private static final CharacterCalculator BASE_DEX_CALCULATOR = new CharacterBaseDexterityCalculator();
/**
* The calculator for base witness
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_WIT_CALCULATOR = new BaseWitnessCalculator();
+ private static final CharacterCalculator BASE_WIT_CALCULATOR = new CharacterBaseWitnessCalculator();
/**
* The calculator for base run speed
@@ -133,14 +138,14 @@ public class CharacterStats extends ActorStats {
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_RUN_SPEED_CALCULATOR = new BaseRunSpeedCalculator();
+ private static final CharacterCalculator BASE_RUN_SPEED_CALCULATOR = new CharacterBaseRunSpeedCalculator();
/**
* The calculator for base walk speed
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_WALK_SPEED_CALCULATOR = new BaseWalkSpeedCalculator();
+ private static final CharacterCalculator BASE_WALK_SPEED_CALCULATOR = new CharacterBaseWalkSpeedCalculator();
/**
* The calculator base physical attack
@@ -148,28 +153,28 @@ public class CharacterStats extends ActorStats {
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_PHYSICAL_ATTACK_CALCULATOR = new BasePhysicalAttackCalculator();
+ private static final CharacterCalculator BASE_PHYSICAL_ATTACK_CALCULATOR = new CharacterBasePhysicalAttackCalculator();
/**
* The calculator base physical attack speed
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR = new BasePhysicalAttackSpeedCalculator();
+ private static final CharacterCalculator BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR = new CharacterBasePhysicalAttackSpeedCalculator();
/**
* The calculator base physical attack critical rate
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR = new BasePhysicalCriticalRateCalculator();
+ private static final CharacterCalculator BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR = new CharacterBasePhysicalCriticalRateCalculator();
/**
* The calculator base physical defense
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_PHYSICAL_DEFENSE_CALCULATOR = new BasePhysicalDefenseCalculator();
+ private static final CharacterCalculator BASE_PHYSICAL_DEFENSE_CALCULATOR = new CharacterBasePhysicalDefenseCalculator();
/**
* The calculator base magical attack
@@ -177,28 +182,28 @@ public class CharacterStats extends ActorStats {
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MAGICAL_ATTACK_CALCULATOR = new BaseMagicalAttackCalculator();
+ private static final CharacterCalculator BASE_MAGICAL_ATTACK_CALCULATOR = new CharacterBaseMagicalAttackCalculator();
/**
* The calculator base magical attack speed
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MAGICAL_ATTACK_SPEED_CALCULATOR = new BaseMagicalAttackSpeedCalculator();
+ private static final CharacterCalculator BASE_MAGICAL_ATTACK_SPEED_CALCULATOR = new CharacterBaseMagicalAttackSpeedCalculator();
/**
* The calculator base magical attack critical rate
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MAGICAL_CRITICAL_RATE_CALCULATOR = new BaseMagicalCriticalRateCalculator();
+ private static final CharacterCalculator BASE_MAGICAL_CRITICAL_RATE_CALCULATOR = new CharacterBaseMagicalCriticalRateCalculator();
/**
* The calculator base magical defense
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_MAGICAL_DEFENSE_CALCULATOR = new BaseMagicalDefenseCalculator();
+ private static final CharacterCalculator BASE_MAGICAL_DEFENSE_CALCULATOR = new CharacterBaseMagicalDefenseCalculator();
/**
* The calculator base attack accuracy
@@ -206,31 +211,51 @@ public class CharacterStats extends ActorStats {
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new BaseAttackAccuracyCalculator();
+ private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new CharacterBaseAttackAccuracyCalculator();
/**
* The calculator base evasion
*
* This calculator does not store any state and thus is safe to be
* shared.
*/
- private static final CharacterCalculator BASE_ATTACK_EVASION_CALCULATOR = new BaseAttackEvasionCalculator();
+ private static final CharacterCalculator BASE_ATTACK_EVASION_CALCULATOR = new CharacterBaseAttackEvasionCalculator();
+
+ // BONUS
+ /**
+ * The calculator for CP bonus
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final CharacterCalculator CP_BONUS_CALCULATOR = new MaximumCPBonusCalculator();
+
+ // ADD
+ /**
+ * The calculator for HP add
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final CharacterCalculator HP_ADD_CALCULATOR = new MaximumHPAddCalculator();
+ /**
+ * The calculator for MP add
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final CharacterCalculator MP_ADD_CALCULATOR = new MaximumMPAddCalculator();
+ /**
+ * The calculator for CP add
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final CharacterCalculator CP_ADD_CALCULATOR = new MaximumCPAddCalculator();
/**
* The character
*/
private final L2Character character;
- /**
- * The list of calculators for this character
- *
- * It is safe to use an array since this number cannot be changed in
- * runtime, it would be required to be able to change the {@link StatType}
- * enum. Also, an full-sized array is created because this way we don't need
- * to change the array size very often. A bit of memory is "lost", but the
- * speed gain is much higher.
- */
- @SuppressWarnings("unchecked")
- private final Calculator
+ * Another important note is that calculators should perform calculations as
+ * fast as possible.
+ *
+ * IMPORTANT: NEVER TOUCH THE STATIC CALCULATORS!
+ *
+ * @author Rogiel
+ */
+public class NPCStats extends ActorStats
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_HP_CALCULATOR = new NPCBaseHPCalculator();
+ /**
+ * The calculator for base maximum MP
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MP_CALCULATOR = new NPCBaseMPCalculator();
+
+ /**
+ * The calculator for base intelligence
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_INT_CALCULATOR = new NPCBaseIntelligenceCalculator();
+ /**
+ * The calculator for base strength
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_STR_CALCULATOR = new NPCBaseStrengthCalculator();
+ /**
+ * The calculator for base concentration
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_CON_CALCULATOR = new NPCBaseConcentrationCalculator();
+ /**
+ * The calculator for base mentality
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MEN_CALCULATOR = new NPCBaseMentalityCalculator();
+ /**
+ * The calculator for base dexterity
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_DEX_CALCULATOR = new NPCBaseDexterityCalculator();
+ /**
+ * The calculator for base witness
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_WIT_CALCULATOR = new NPCBaseWitnessCalculator();
+
+ /**
+ * The calculator for base run speed
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_RUN_SPEED_CALCULATOR = new NPCBaseRunSpeedCalculator();
+ /**
+ * The calculator for base walk speed
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_WALK_SPEED_CALCULATOR = new NPCBaseWalkSpeedCalculator();
+
+ /**
+ * The calculator base physical attack
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_PHYSICAL_ATTACK_CALCULATOR = new NPCBasePhysicalAttackCalculator();
+ /**
+ * The calculator base physical attack speed
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR = new NPCBasePhysicalAttackSpeedCalculator();
+ /**
+ * The calculator base physical attack critical rate
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR = new NPCBasePhysicalCriticalRateCalculator();
+ /**
+ * The calculator base physical defense
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_PHYSICAL_DEFENSE_CALCULATOR = new NPCBasePhysicalDefenseCalculator();
+
+ /**
+ * The calculator base magical attack
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MAGICAL_ATTACK_CALCULATOR = new NPCBaseMagicalAttackCalculator();
+ /**
+ * The calculator base magical attack speed
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MAGICAL_ATTACK_SPEED_CALCULATOR = new NPCBaseMagicalAttackSpeedCalculator();
+ /**
+ * The calculator base magical attack critical rate
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MAGICAL_CRITICAL_RATE_CALCULATOR = new NPCBaseMagicalCriticalRateCalculator();
+ /**
+ * The calculator base magical defense
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_MAGICAL_DEFENSE_CALCULATOR = new NPCBaseMagicalDefenseCalculator();
+
+ /**
+ * The calculator base attack accuracy
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new NPCBaseAttackAccuracyCalculator();
+ /**
+ * The calculator base evasion
+ *
+ * This calculator does not store any state and thus is safe to be
+ * shared.
+ */
+ private static final NPCCalculator BASE_ATTACK_EVASION_CALCULATOR = new NPCBaseAttackEvasionCalculator();
+
+ /**
+ * The NPC
+ */
+ private final NPC npc;
+
+ /**
+ * Creates a new {@link NPCStats} and adds default calculators
+ *
+ * @param npc
+ * the npc
+ */
+ public NPCStats(NPC npc) {
+ super();
+ this.npc = npc;
+
+ add(StatType.MAX_HP, BASE_HP_CALCULATOR);
+ add(StatType.MAX_MP, BASE_MP_CALCULATOR);
+
+ add(StatType.STAT_INT, BASE_INT_CALCULATOR);
+ add(StatType.STAT_STR, BASE_STR_CALCULATOR);
+ add(StatType.STAT_CON, BASE_CON_CALCULATOR);
+ add(StatType.STAT_MEN, BASE_MEN_CALCULATOR);
+ add(StatType.STAT_DEX, BASE_DEX_CALCULATOR);
+ add(StatType.STAT_WIT, BASE_WIT_CALCULATOR);
+
+ add(StatType.RUN_SPEED, BASE_RUN_SPEED_CALCULATOR);
+ add(StatType.WALK_SPEED, BASE_WALK_SPEED_CALCULATOR);
+
+ add(StatType.POWER_ATTACK, BASE_PHYSICAL_ATTACK_CALCULATOR);
+ add(StatType.POWER_ATTACK_SPEED, BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR);
+ add(StatType.CRITICAL_RATE, BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR);
+ add(StatType.POWER_DEFENSE, BASE_PHYSICAL_DEFENSE_CALCULATOR);
+
+ add(StatType.MAGIC_ATTACK, BASE_MAGICAL_ATTACK_CALCULATOR);
+ add(StatType.MAGIC_ATTACK_SPEED, BASE_MAGICAL_ATTACK_SPEED_CALCULATOR);
+ add(StatType.MCRITICAL_RATE, BASE_MAGICAL_CRITICAL_RATE_CALCULATOR);
+ add(StatType.MAGIC_DEFENSE, BASE_MAGICAL_DEFENSE_CALCULATOR);
+
+ add(StatType.ACCURACY_COMBAT, BASE_ATTACK_ACCURACY_CALCULATOR);
+ add(StatType.EVASION_RATE, BASE_ATTACK_EVASION_CALCULATOR);
+ }
+
+ @Override
+ protected NPCCalculatorContext createContext() {
+ return new NPCCalculatorContext(npc);
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/NPCCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/NPCCalculator.java
index b38d1e4f8..af3465205 100644
--- a/src/main/java/com/l2jserver/model/world/npc/calculator/NPCCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/NPCCalculator.java
@@ -16,17 +16,14 @@
*/
package com.l2jserver.model.world.npc.calculator;
-import com.l2jserver.model.world.L2Character;
-import com.l2jserver.util.calculator.Calculator;
-import com.l2jserver.util.calculator.Function;
+import com.l2jserver.model.world.actor.calculator.ActorCalculator;
/**
* @author Rogiel
*
*/
-public class NPCCalculator extends Calculator
@@ -35,7 +33,7 @@ public interface Function
- * ctx.result = c.getTemplate().getBaseCP();
- *
- * int lvl = c.getLevel() - template.getMinimumLevel();
- * double mod = template.getBaseCPModifier() * lvl;
- * double max = (template.getBaseCPAdd() + mod) * lvl;
- * double min = (template.getBaseCPAdd() * lvl) + mod;
- * ctx.result += (max + min) / 2;
- *
- * ctx.result *= BaseStats.CON.calculateBonus(c.getStats().getConcentration());
- *
- *
- * @author Rogiel
- */
-public class BaseCPCalculator extends CharacterCalculator {
- @SuppressWarnings("unchecked")
- public BaseCPCalculator() {
- super(new AbstractFunction
- * ctx.result = c.getTemplate().getBaseHP();
- *
- * int lvl = c.getLevel() - template.getMinimumLevel();
- * double mod = template.getBaseHP() * lvl;
- * double max = (template.getBaseHPAdd() + mod) * lvl;
- * double min = (template.getBaseHPAdd() * lvl) + mod;
- * ctx.result += (max + min) / 2;
- *
- * ctx.result *= BaseStats.CON.calculateBonus(c.getStats().getConcentration());
- *
- *
- * @author Rogiel
- */
-public class BaseHPCalculator extends CharacterCalculator {
- @SuppressWarnings("unchecked")
- public BaseHPCalculator() {
- super(new AbstractFunction
- * TODO base hp regen
- *
- *
- * @author Rogiel
- */
-public class BaseHPRegenerationCalculator extends CharacterCalculator {
- /**
- * Retail value is 100
- */
- public static final double HP_REGEN_MULTIPLIER = 100;
-
- @SuppressWarnings("unchecked")
- public BaseHPRegenerationCalculator() {
- super(new AbstractFunction
- * ctx.result = c.getTemplate().getBaseBaseMP();
- *
- * int lvl = c.getLevel() - template.getMinimumLevel();
- * double mod = template.getBaseMPModifier() * lvl;
- * double max = (template.getBaseMPAdd() + mod) * lvl;
- * double min = (template.getBaseMPAdd() * lvl) + mod;
- * ctx.result += (max + min) / 2;
- *
- * ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality());
- *
- *
- * @author Rogiel
- */
-public class BaseMPCalculator extends CharacterCalculator {
- @SuppressWarnings("unchecked")
- public BaseMPCalculator() {
- super(new AbstractFunction
- * if (inv.has(LEFT_FINGER))
- * ctx.result -= 5;
- * if (inv.has(RIGHT_FINGER))
- * ctx.result -= 5;
- * if (inv.has(LEFT_EAR))
- * ctx.result -= 9;
- * if (inv.has(RIGHT_EAR))
- * ctx.result -= 9;
- * if (inv.has(NECK))
- * ctx.result -= 13;
- * ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality())
- * * ((100.0 - 11 + c.getLevel()) / 100.0);
- *
- *
- * @author Rogiel
- */
-public class BaseMagicalDefenseCalculator extends CharacterCalculator {
- @SuppressWarnings("unchecked")
- public BaseMagicalDefenseCalculator() {
- super(new AbstractFunction
- * ctx.result = c.getTemplate().getBasePhysicalDefense();
- *
- * if (inv.has(HEAD))
- * ctx.result -= 12;
- * final Item chest = inv.getItem(CHEST);
- * if (chest != null)
- * ctx.result -= hasMagePDef ? 15 : 31;
- * if (inv.has(LEGS))
- * ctx.result -= hasMagePDef ? 8 : 18;
- * if (inv.has(GLOVES))
- * ctx.result -= 8;
- * if (inv.has(FEET))
- * ctx.result -= 7;
- * ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0);
- *
- *
- * @author Rogiel
- */
-public class BasePhysicalDefenseCalculator extends CharacterCalculator {
- @SuppressWarnings("unchecked")
- public BasePhysicalDefenseCalculator() {
- super(new AbstractFunction
+ * int lvl = c.getLevel() - template.getMinimumLevel();
+ * double mod = template.getBaseCPModifier() * lvl;
+ * double max = (template.getBaseCPAdd() + mod) * lvl;
+ * double min = (template.getBaseCPAdd() * lvl) + mod;
+ * ctx.result += (max + min) / 2;
+ *
+ *
+ * @author Rogiel
+ */
+public class MaximumCPAddCalculator extends CharacterCalculator {
+ public MaximumCPAddCalculator() {
+ super(new CharacterCalculatorFunction(0x100) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ int lvl = c.getLevel() - t.getMinimumLevel();
+ double mod = t.getBaseCPModifier() * lvl;
+ double max = (t.getBaseCPAdd() + mod) * lvl;
+ double min = (t.getBaseCPAdd() * lvl) + mod;
+
+ return value + (max + min) / 2;
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/MaximumCPBonusCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumCPBonusCalculator.java
new file mode 100644
index 000000000..ccb7a02dc
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumCPBonusCalculator.java
@@ -0,0 +1,48 @@
+/*
+ * This file is part of l2jserver
+ * int lvl = c.getLevel() - template.getMinimumLevel();
+ * double mod = template.getBaseCPModifier() * lvl;
+ * double max = (template.getBaseCPAdd() + mod) * lvl;
+ * double min = (template.getBaseCPAdd() * lvl) + mod;
+ * ctx.result += (max + min) / 2;
+ *
+ *
+ * @author Rogiel
+ */
+public class MaximumCPBonusCalculator extends CharacterCalculator {
+ public MaximumCPBonusCalculator() {
+ super(new CharacterCalculatorFunction(0x100) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return value
+ * BaseStats.CON.calculateBonus(c.getStats()
+ .getConcentration());
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/MaximumHPAddCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumHPAddCalculator.java
new file mode 100644
index 000000000..5822bc35f
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumHPAddCalculator.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of l2jserver
+ * int lvl = c.getLevel() - template.getMinimumLevel();
+ * double mod = template.getBaseHPModifier() * lvl;
+ * double max = (template.getBaseHPAdd() + mod) * lvl;
+ * double min = (template.getBaseHPAdd() * lvl) + mod;
+ * ctx.result += (max + min) / 2;
+ *
+ *
+ * @author Rogiel
+ */
+public class MaximumHPAddCalculator extends CharacterCalculator {
+ public MaximumHPAddCalculator() {
+ super(new CharacterCalculatorFunction(0x100) {
+ @Override
+ public double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ int lvl = c.getLevel() - t.getMinimumLevel();
+ double mod = t.getBaseHPModifier() * lvl;
+ double max = (t.getBaseHPAdd() + mod) * lvl;
+ double min = (t.getBaseHPAdd() * lvl) + mod;
+
+ return value + (max + min) / 2;
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/MaximumMPAddCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumMPAddCalculator.java
new file mode 100644
index 000000000..fc1b15f98
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/MaximumMPAddCalculator.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of l2jserver
+ * int lvl = c.getLevel() - template.getMinimumLevel();
+ * double mod = template.getBaseMPModifier() * lvl;
+ * double max = (template.getBaseMPAdd() + mod) * lvl;
+ * double min = (template.getBaseMPAdd() * lvl) + mod;
+ * ctx.result += (max + min) / 2;
+ *
+ *
+ * @author Rogiel
+ */
+public class MaximumMPAddCalculator extends CharacterCalculator {
+ public MaximumMPAddCalculator() {
+ super(new CharacterCalculatorFunction(0x100) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ int lvl = c.getLevel() - t.getMinimumLevel();
+ double mod = t.getBaseMPModifier() * lvl;
+ double max = (t.getBaseMPAdd() + mod) * lvl;
+ double min = (t.getBaseMPAdd() * lvl) + mod;
+
+ return value + (max + min) / 2;
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackAccuracyCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackAccuracyCalculator.java
new file mode 100644
index 000000000..4a6cffe5c
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackAccuracyCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseAccuracy();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseAttackAccuracyCalculator extends CharacterCalculator {
+ public CharacterBaseAttackAccuracyCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseAccuracy();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackEvasionCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackEvasionCalculator.java
new file mode 100644
index 000000000..f9b3eacb1
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseAttackEvasionCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseEvasion();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseAttackEvasionCalculator extends CharacterCalculator {
+ public CharacterBaseAttackEvasionCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseEvasion();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseCPCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseCPCalculator.java
new file mode 100644
index 000000000..8ba505a29
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseCPCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * return c.getTemplate().getBaseCP();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseCPCalculator extends CharacterCalculator {
+ public CharacterBaseCPCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ public double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseCP();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseConcentrationCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseConcentrationCalculator.java
similarity index 62%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseConcentrationCalculator.java
rename to src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseConcentrationCalculator.java
index cd95006c8..62da08952 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseConcentrationCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseConcentrationCalculator.java
@@ -14,11 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
+ * return c.getTemplate().getBaseHP();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseHPCalculator extends CharacterCalculator {
+ public CharacterBaseHPCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ public double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseHP();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseIntelligenceCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseIntelligenceCalculator.java
similarity index 62%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseIntelligenceCalculator.java
rename to src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseIntelligenceCalculator.java
index b900f1b45..be58cbb32 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseIntelligenceCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseIntelligenceCalculator.java
@@ -14,11 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
+ * return c.getTemplate().getBaseMP();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseMPCalculator extends CharacterCalculator {
+ public CharacterBaseMPCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ public double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseBaseMP();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackCalculator.java
new file mode 100644
index 000000000..a7ac57808
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result *= (((100.0 - 11 + c.getLevel()) / 100.0) ˆ 2)
+ * * (BaseStats.INT.calculateBonus(c.getStats().getIntelligence()) ˆ 2);
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseMagicalAttackCalculator extends CharacterCalculator {
+ public CharacterBaseMagicalAttackCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseMagicalAttack();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackSpeedCalculator.java
new file mode 100644
index 000000000..1bc10bf72
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalAttackSpeedCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseMagicalAttackSpeedCalculator extends CharacterCalculator {
+ public CharacterBaseMagicalAttackSpeedCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseMagicalAttackSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseMagicalCriticalRateCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalCriticalRateCalculator.java
similarity index 55%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseMagicalCriticalRateCalculator.java
rename to src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalCriticalRateCalculator.java
index 2d418507e..9bdeaa203 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseMagicalCriticalRateCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMagicalCriticalRateCalculator.java
@@ -14,12 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
+ * if (inv.has(LEFT_FINGER))
+ * ctx.result -= 5;
+ * if (inv.has(RIGHT_FINGER))
+ * ctx.result -= 5;
+ * if (inv.has(LEFT_EAR))
+ * ctx.result -= 9;
+ * if (inv.has(RIGHT_EAR))
+ * ctx.result -= 9;
+ * if (inv.has(NECK))
+ * ctx.result -= 13;
+ * ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality())
+ * * ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseMagicalDefenseCalculator extends CharacterCalculator {
+ public CharacterBaseMagicalDefenseCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseMagicalDefense();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseMentalityCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMentalityCalculator.java
similarity index 62%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseMentalityCalculator.java
rename to src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMentalityCalculator.java
index 2179ba8e0..1e04bd18b 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseMentalityCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseMentalityCalculator.java
@@ -14,11 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
+ * ctx.result = c.getTemplate().getBasePhysicalAttack();
+ * ctx.result *= BaseStats.STR.calculateBonus(c.getStats().getStrength())
+ * * ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBasePhysicalAttackCalculator extends CharacterCalculator {
+ public CharacterBasePhysicalAttackCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBasePhysicalAttack();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalAttackSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalAttackSpeedCalculator.java
new file mode 100644
index 000000000..1fc6b9eec
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalAttackSpeedCalculator.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBasePhysicalAttackSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBasePhysicalAttackSpeedCalculator extends
+ CharacterCalculator {
+ public CharacterBasePhysicalAttackSpeedCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBasePhysicalAttackSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalCriticalRateCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalCriticalRateCalculator.java
new file mode 100644
index 000000000..f7188dc23
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalCriticalRateCalculator.java
@@ -0,0 +1,46 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseCritical();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ * ctx.result *= 10;
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBasePhysicalCriticalRateCalculator extends
+ CharacterCalculator {
+ public CharacterBasePhysicalCriticalRateCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseCritical();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalDefenseCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalDefenseCalculator.java
new file mode 100644
index 000000000..d5b58b3fe
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBasePhysicalDefenseCalculator.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBasePhysicalDefense();
+ *
+ * if (inv.has(HEAD))
+ * ctx.result -= 12;
+ * final Item chest = inv.getItem(CHEST);
+ * if (chest != null)
+ * ctx.result -= hasMagePDef ? 15 : 31;
+ * if (inv.has(LEGS))
+ * ctx.result -= hasMagePDef ? 8 : 18;
+ * if (inv.has(GLOVES))
+ * ctx.result -= 8;
+ * if (inv.has(FEET))
+ * ctx.result -= 7;
+ * ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBasePhysicalDefenseCalculator extends CharacterCalculator {
+ public CharacterBasePhysicalDefenseCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBasePhysicalDefense();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseRunSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseRunSpeedCalculator.java
new file mode 100644
index 000000000..ab0305276
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseRunSpeedCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseRunSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseRunSpeedCalculator extends CharacterCalculator {
+ public CharacterBaseRunSpeedCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseRunSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseStrengthCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseStrengthCalculator.java
new file mode 100644
index 000000000..c349b965a
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseStrengthCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseStrength();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseStrengthCalculator extends CharacterCalculator {
+ public CharacterBaseStrengthCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseStrength();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWalkSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWalkSpeedCalculator.java
new file mode 100644
index 000000000..52efdf32d
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWalkSpeedCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseWalkSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseWalkSpeedCalculator extends CharacterCalculator {
+ public CharacterBaseWalkSpeedCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseWalkSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWitnessCalculator.java b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWitnessCalculator.java
new file mode 100644
index 000000000..509f81655
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/calculator/base/CharacterBaseWitnessCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseWitness();
+ *
+ *
+ * @author Rogiel
+ */
+public class CharacterBaseWitnessCalculator extends CharacterCalculator {
+ public CharacterBaseWitnessCalculator() {
+ super(new CharacterCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(L2Character c, CharacterTemplate t,
+ double value) {
+ return t.getBaseWitness();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/NPCStats.java b/src/main/java/com/l2jserver/model/world/npc/NPCStats.java
new file mode 100644
index 000000000..5c08d2e28
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/NPCStats.java
@@ -0,0 +1,256 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseAccuracy();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseAttackAccuracyCalculator extends NPCCalculator {
+ public NPCBaseAttackAccuracyCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t, double value) {
+ // return t.getEvasion()
+ // TODO
+ return value;
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseAttackEvasionCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseAttackEvasionCalculator.java
new file mode 100644
index 000000000..e5e52b62f
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseAttackEvasionCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getEvasion();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseAttackEvasionCalculator extends NPCCalculator {
+ public NPCBaseAttackEvasionCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getEvasion();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseConcentrationCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseConcentrationCalculator.java
new file mode 100644
index 000000000..6ba33918b
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseConcentrationCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getConcentration();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseConcentrationCalculator extends NPCCalculator {
+ public NPCBaseConcentrationCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getConcentration();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseDexterityCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseDexterityCalculator.java
new file mode 100644
index 000000000..e906033d9
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseDexterityCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getDexterity();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseDexterityCalculator extends NPCCalculator {
+ public NPCBaseDexterityCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getDexterity();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseHPCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseHPCalculator.java
new file mode 100644
index 000000000..72cd6260b
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseHPCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * return c.getTemplate().getHP();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseHPCalculator extends NPCCalculator {
+ public NPCBaseHPCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ public double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getMaximumHP();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseIntelligenceCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseIntelligenceCalculator.java
new file mode 100644
index 000000000..8f2555bca
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseIntelligenceCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getIntelligence();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseIntelligenceCalculator extends NPCCalculator {
+ public NPCBaseIntelligenceCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getIntelligence();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMPCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMPCalculator.java
new file mode 100644
index 000000000..28d6be92a
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMPCalculator.java
@@ -0,0 +1,42 @@
+/*
+ * This file is part of l2jserver
+ * return c.getTemplate().getMP();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMPCalculator extends NPCCalculator {
+ public NPCBaseMPCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ public double calculate(NPC c, NPCTemplate t, double value) {
+ return t.getMaximumMP();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackCalculator.java
new file mode 100644
index 000000000..d8b470b23
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result *= (((100.0 - 11 + c.getLevel()) / 100.0) ˆ 2)
+ * * (BaseStats.INT.calculateBonus(c.getStats().getIntelligence()) ˆ 2);
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMagicalAttackCalculator extends NPCCalculator {
+ public NPCBaseMagicalAttackCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getMagicalAttack();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackSpeedCalculator.java
new file mode 100644
index 000000000..a879e38db
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalAttackSpeedCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getMagicalAttackSpeed();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMagicalAttackSpeedCalculator extends NPCCalculator {
+ public NPCBaseMagicalAttackSpeedCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getMagicalAttackSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalCriticalRateCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalCriticalRateCalculator.java
new file mode 100644
index 000000000..e980a90ad
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalCriticalRateCalculator.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getCritical(); // must be checked
+ * ctx.result *= BaseStats.WIT.calculateBonus(c.getStats().getWitness());
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMagicalCriticalRateCalculator extends
+ NPCCalculator {
+ public NPCBaseMagicalCriticalRateCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getCritical();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalDefenseCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalDefenseCalculator.java
new file mode 100644
index 000000000..21d239988
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMagicalDefenseCalculator.java
@@ -0,0 +1,54 @@
+/*
+ * This file is part of l2jserver
+ * if (inv.has(LEFT_FINGER))
+ * ctx.result -= 5;
+ * if (inv.has(RIGHT_FINGER))
+ * ctx.result -= 5;
+ * if (inv.has(LEFT_EAR))
+ * ctx.result -= 9;
+ * if (inv.has(RIGHT_EAR))
+ * ctx.result -= 9;
+ * if (inv.has(NECK))
+ * ctx.result -= 13;
+ * ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality())
+ * * ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMagicalDefenseCalculator extends NPCCalculator {
+ public NPCBaseMagicalDefenseCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getMagicalDefense();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMentalityCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMentalityCalculator.java
new file mode 100644
index 000000000..e6ec893a2
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseMentalityCalculator.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getMentality();
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseMentalityCalculator extends NPCCalculator {
+ public NPCBaseMentalityCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getMentality();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackCalculator.java
new file mode 100644
index 000000000..de57d8159
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackCalculator.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getPhysicalAttack();
+ * ctx.result *= BaseStats.STR.calculateBonus(c.getStats().getStrength())
+ * * ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBasePhysicalAttackCalculator extends NPCCalculator {
+ public NPCBasePhysicalAttackCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getPhysicalAttack();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackSpeedCalculator.java
new file mode 100644
index 000000000..47e7ea283
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalAttackSpeedCalculator.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getPhysicalAttackSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBasePhysicalAttackSpeedCalculator extends
+ NPCCalculator {
+ public NPCBasePhysicalAttackSpeedCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getPhysicalAttackSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalCriticalRateCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalCriticalRateCalculator.java
new file mode 100644
index 000000000..e72d0e29e
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalCriticalRateCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseCritical();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ * ctx.result *= 10;
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBasePhysicalCriticalRateCalculator extends NPCCalculator {
+ public NPCBasePhysicalCriticalRateCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t, double value) {
+ return t.getCritical();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalDefenseCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalDefenseCalculator.java
new file mode 100644
index 000000000..aa02790e8
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBasePhysicalDefenseCalculator.java
@@ -0,0 +1,55 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBasePhysicalDefense();
+ *
+ * if (inv.has(HEAD))
+ * ctx.result -= 12;
+ * final Item chest = inv.getItem(CHEST);
+ * if (chest != null)
+ * ctx.result -= hasMagePDef ? 15 : 31;
+ * if (inv.has(LEGS))
+ * ctx.result -= hasMagePDef ? 8 : 18;
+ * if (inv.has(GLOVES))
+ * ctx.result -= 8;
+ * if (inv.has(FEET))
+ * ctx.result -= 7;
+ * ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0);
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBasePhysicalDefenseCalculator extends NPCCalculator {
+ public NPCBasePhysicalDefenseCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t, double value) {
+ return t.getPhysicalDefense();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseRunSpeedCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseRunSpeedCalculator.java
new file mode 100644
index 000000000..a86d171ef
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseRunSpeedCalculator.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver
+ * ctx.result = c.getTemplate().getBaseRunSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseRunSpeedCalculator extends NPCCalculator {
+ public NPCBaseRunSpeedCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getRunSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseStrengthCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseStrengthCalculator.java
similarity index 63%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseStrengthCalculator.java
rename to src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseStrengthCalculator.java
index a9098c8f9..396d332cb 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseStrengthCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseStrengthCalculator.java
@@ -14,11 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
+ * ctx.result = c.getTemplate().getBaseWalkSpeed();
+ * ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
+ *
+ *
+ * @author Rogiel
+ */
+public class NPCBaseWalkSpeedCalculator extends NPCCalculator {
+ public NPCBaseWalkSpeedCalculator() {
+ super(new NPCCalculatorFunction(0x000) {
+ @Override
+ protected double calculate(NPC c, NPCTemplate t,
+ double value) {
+ return t.getWalkSpeed();
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/calculator/BaseWitnessCalculator.java b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseWitnessCalculator.java
similarity index 63%
rename from src/main/java/com/l2jserver/model/world/character/calculator/BaseWitnessCalculator.java
rename to src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseWitnessCalculator.java
index 084ef0042..37cc99a03 100644
--- a/src/main/java/com/l2jserver/model/world/character/calculator/BaseWitnessCalculator.java
+++ b/src/main/java/com/l2jserver/model/world/npc/calculator/base/NPCBaseWitnessCalculator.java
@@ -14,11 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see
*
* @author Rogiel
*/
-public class DivisionFunctionchain value /
* value
*
* @author Rogiel
*/
-public class ModulusFunction|chain value|
*
*
* @author Rogiel
*/
-public class MultiplicationFunctionchain value *
* value
*
* @author Rogiel
*/
-public class NegateFunction-chain value
*
*
* @author Rogiel
*/
-public class PercentFunctionchain value *
* (value / 100)
*
* @author Rogiel
*/
-public class SubtractFunctionchain value -
* value
*
* @author Rogiel
*/
-public class SumFunctionchain value +
* value