mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
Implemented NPC and Actor calculators. Updated L2Character calculators
to match abstraction Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -18,30 +18,34 @@ package com.l2jserver.model.world.character;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.ActorStats;
|
||||
import com.l2jserver.model.world.actor.stat.Stats.StatType;
|
||||
import com.l2jserver.model.world.character.calculator.BaseAttackAccuracyCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseAttackEvasionCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseCPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseConcentrationCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseDexterityCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseHPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseIntelligenceCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMagicalAttackCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMagicalAttackSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMagicalCriticalRateCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMagicalDefenseCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseMentalityCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BasePhysicalAttackCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BasePhysicalAttackSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BasePhysicalCriticalRateCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BasePhysicalDefenseCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseRunSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseStrengthCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseWalkSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.BaseWitnessCalculator;
|
||||
import com.l2jserver.model.world.actor.stat.StatType;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.MaximumCPAddCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.MaximumCPBonusCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.MaximumHPAddCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.MaximumMPAddCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseAttackAccuracyCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseAttackEvasionCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseCPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseConcentrationCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseDexterityCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseHPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseIntelligenceCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMPCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMagicalAttackCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMagicalAttackSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMagicalCriticalRateCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMagicalDefenseCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseMentalityCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBasePhysicalAttackCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBasePhysicalAttackSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBasePhysicalCriticalRateCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBasePhysicalDefenseCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseRunSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseStrengthCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseWalkSpeedCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.base.CharacterBaseWitnessCalculator;
|
||||
import com.l2jserver.util.calculator.Calculator;
|
||||
|
||||
/**
|
||||
@@ -61,28 +65,29 @@ import com.l2jserver.util.calculator.Calculator;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterStats extends ActorStats {
|
||||
/**
|
||||
* The calculator for base maximum HP
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_HP_CALCULATOR = new BaseHPCalculator();
|
||||
public class CharacterStats extends ActorStats<CharacterCalculatorContext> {
|
||||
// base calculators
|
||||
/**
|
||||
* The calculator for base maximum MP
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_MP_CALCULATOR = new BaseMPCalculator();
|
||||
private static final CharacterCalculator BASE_HP_CALCULATOR = new CharacterBaseHPCalculator();
|
||||
/**
|
||||
* The calculator for base maximum MP
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_MP_CALCULATOR = new CharacterBaseMPCalculator();
|
||||
/**
|
||||
* The calculator for base maximum CP
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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 {
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_INT_CALCULATOR = new BaseIntelligenceCalculator();
|
||||
private static final CharacterCalculator BASE_INT_CALCULATOR = new CharacterBaseIntelligenceCalculator();
|
||||
/**
|
||||
* The calculator for base strength
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_STR_CALCULATOR = new BaseStrengthCalculator();
|
||||
private static final CharacterCalculator BASE_STR_CALCULATOR = new CharacterBaseStrengthCalculator();
|
||||
/**
|
||||
* The calculator for base concentration
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_CON_CALCULATOR = new BaseConcentrationCalculator();
|
||||
private static final CharacterCalculator BASE_CON_CALCULATOR = new CharacterBaseConcentrationCalculator();
|
||||
/**
|
||||
* The calculator for base mentality
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_MEN_CALCULATOR = new BaseMentalityCalculator();
|
||||
private static final CharacterCalculator BASE_MEN_CALCULATOR = new CharacterBaseMentalityCalculator();
|
||||
/**
|
||||
* The calculator for base dexterity
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_DEX_CALCULATOR = new BaseDexterityCalculator();
|
||||
private static final CharacterCalculator BASE_DEX_CALCULATOR = new CharacterBaseDexterityCalculator();
|
||||
/**
|
||||
* The calculator for base witness
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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 {
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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 {
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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 {
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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 {
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new BaseAttackAccuracyCalculator();
|
||||
private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new CharacterBaseAttackAccuracyCalculator();
|
||||
/**
|
||||
* The calculator base evasion
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
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
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator CP_BONUS_CALCULATOR = new MaximumCPBonusCalculator();
|
||||
|
||||
// ADD
|
||||
/**
|
||||
* The calculator for HP add
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator HP_ADD_CALCULATOR = new MaximumHPAddCalculator();
|
||||
/**
|
||||
* The calculator for MP add
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator MP_ADD_CALCULATOR = new MaximumMPAddCalculator();
|
||||
/**
|
||||
* The calculator for CP add
|
||||
* <p>
|
||||
* <u>This calculator does not store any state and thus is safe to be
|
||||
* shared.</u>
|
||||
*/
|
||||
private static final CharacterCalculator CP_ADD_CALCULATOR = new MaximumCPAddCalculator();
|
||||
|
||||
/**
|
||||
* The character
|
||||
*/
|
||||
private final L2Character character;
|
||||
/**
|
||||
* The list of calculators for this character
|
||||
* <p>
|
||||
* 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<L2Character>[] calculators = new Calculator[StatType
|
||||
.values().length];
|
||||
|
||||
/**
|
||||
* Creates a new {@link CharacterStats} and adds default calculators
|
||||
@@ -239,12 +264,10 @@ public class CharacterStats extends ActorStats {
|
||||
* the character
|
||||
*/
|
||||
public CharacterStats(L2Character character) {
|
||||
super();
|
||||
this.character = character;
|
||||
for (int i = 0; i < calculators.length; i++) {
|
||||
calculators[i] = new Calculator<L2Character>();
|
||||
}
|
||||
|
||||
// import default functions
|
||||
// base
|
||||
add(StatType.MAX_HP, BASE_HP_CALCULATOR);
|
||||
add(StatType.MAX_MP, BASE_MP_CALCULATOR);
|
||||
add(StatType.MAX_CP, BASE_CP_CALCULATOR);
|
||||
@@ -272,23 +295,17 @@ public class CharacterStats extends ActorStats {
|
||||
add(StatType.ACCURACY_COMBAT, BASE_ATTACK_ACCURACY_CALCULATOR);
|
||||
add(StatType.EVASION_RATE, BASE_ATTACK_EVASION_CALCULATOR);
|
||||
|
||||
// add hp/mp/cp add functions
|
||||
add(StatType.MAX_HP, HP_ADD_CALCULATOR);
|
||||
add(StatType.MAX_MP, MP_ADD_CALCULATOR);
|
||||
add(StatType.MAX_CP, CP_ADD_CALCULATOR);
|
||||
|
||||
// bonus
|
||||
add(StatType.MAX_CP, CP_BONUS_CALCULATOR);
|
||||
|
||||
// TODO henna stats calculators
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum HP
|
||||
*/
|
||||
public int getMaxHP() {
|
||||
return (int) calc(StatType.MAX_HP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum MP
|
||||
*/
|
||||
public int getMaxMP() {
|
||||
return (int) calc(StatType.MAX_MP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum CP
|
||||
*/
|
||||
@@ -296,132 +313,6 @@ public class CharacterStats extends ActorStats {
|
||||
return (int) calc(StatType.MAX_CP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated intelligence
|
||||
*/
|
||||
public int getIntelligence() {
|
||||
return (int) calc(StatType.STAT_INT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated strength
|
||||
*/
|
||||
public int getStrength() {
|
||||
return (int) calc(StatType.STAT_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated concentration
|
||||
*/
|
||||
public int getConcentration() {
|
||||
return (int) calc(StatType.STAT_CON);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated mentality
|
||||
*/
|
||||
public int getMentality() {
|
||||
return (int) calc(StatType.STAT_MEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated dexterity
|
||||
*/
|
||||
public int getDexterity() {
|
||||
return (int) calc(StatType.STAT_DEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated witness
|
||||
*/
|
||||
public int getWitness() {
|
||||
return (int) calc(StatType.STAT_WIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated run speed
|
||||
*/
|
||||
public int getRunSpeed() {
|
||||
return (int) calc(StatType.RUN_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated walk speed
|
||||
*/
|
||||
public int getWalkSpeed() {
|
||||
return (int) calc(StatType.WALK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack
|
||||
*/
|
||||
public int getPhysicalAttack() {
|
||||
return (int) calc(StatType.POWER_ATTACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack speed
|
||||
*/
|
||||
public int getPhysicalAttackSpeed() {
|
||||
return (int) calc(StatType.POWER_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack critical rate
|
||||
*/
|
||||
public int getPhysicalCriticalRate() {
|
||||
return (int) calc(StatType.CRITICAL_RATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical defense
|
||||
*/
|
||||
public int getPhysicalDefense() {
|
||||
return (int) calc(StatType.POWER_DEFENSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack
|
||||
*/
|
||||
public int getMagicalAttack() {
|
||||
return (int) calc(StatType.MAGIC_ATTACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack speed
|
||||
*/
|
||||
public int getMagicalAttackSpeed() {
|
||||
return (int) calc(StatType.MAGIC_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack critical rate
|
||||
*/
|
||||
public int getMagicalCriticalRate() {
|
||||
return (int) calc(StatType.MCRITICAL_RATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical defense
|
||||
*/
|
||||
public int getMagicalDefense() {
|
||||
return (int) calc(StatType.MAGIC_DEFENSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated accuracy
|
||||
*/
|
||||
public int getAccuracy() {
|
||||
return (int) calc(StatType.ACCURACY_COMBAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated evasion rate
|
||||
*/
|
||||
public int getEvasionRate() {
|
||||
return (int) calc(StatType.EVASION_RATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum load
|
||||
*/
|
||||
@@ -429,34 +320,8 @@ public class CharacterStats extends ActorStats {
|
||||
return (int) calc(StatType.MAX_LOAD);
|
||||
}
|
||||
|
||||
public void add(StatType type, Calculator<L2Character> calculator) {
|
||||
getCalculator(type).importFunctions(calculator);
|
||||
}
|
||||
|
||||
public void remove(StatType type, Calculator<L2Character> calculator) {
|
||||
getCalculator(type).removeFunctions(calculator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param the
|
||||
* calculator {@link StatType}
|
||||
* @return the calculator object associated with the given <tt>type</tt>
|
||||
*/
|
||||
protected Calculator<L2Character> getCalculator(StatType type) {
|
||||
return calculators[type.ordinal()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the calculation of an given {@link StatType}
|
||||
*
|
||||
* @param type
|
||||
* the type
|
||||
* @return the value calculated
|
||||
*/
|
||||
public double calc(StatType type) {
|
||||
final CharacterCalculatorContext ctx = new CharacterCalculatorContext(
|
||||
character);
|
||||
getCalculator(type).calculate(character, ctx);
|
||||
return ctx.result;
|
||||
@Override
|
||||
protected CharacterCalculatorContext createContext() {
|
||||
return new CharacterCalculatorContext(character);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import org.apache.commons.math.util.FastMath;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character base accuracy.
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseAccuracy();
|
||||
* ctx.result += sqrt(DEX) * 6
|
||||
* ctx.result += level;
|
||||
* if (level > 77)
|
||||
* ctx.result += (level - 77) + 1;
|
||||
* if (level > 69)
|
||||
* ctx.result += (level - 69);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseAttackAccuracyCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseAttackAccuracyCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseAccuracy();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
final int level = c.getLevel();
|
||||
|
||||
ctx.result += FastMath.sqrt(c.getStats().getDexterity()) * 6;
|
||||
ctx.result += level;
|
||||
if (level > 77)
|
||||
ctx.result += (level - 77) + 1;
|
||||
if (level > 69)
|
||||
ctx.result += (level - 69);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import org.apache.commons.math.util.FastMath;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character evasion
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseEvasion();
|
||||
* ctx.result += sqrt(DEX) * 6;
|
||||
* ctx.result += level;
|
||||
* if (level > 77)
|
||||
* ctx.result += (level - 77) + 1;
|
||||
* if (level > 69)
|
||||
* ctx.result += (level - 69);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseAttackEvasionCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseAttackEvasionCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseEvasion();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
final int level = c.getLevel();
|
||||
|
||||
ctx.result += FastMath.sqrt(c.getStats().getDexterity()) * 6;
|
||||
ctx.result += level;
|
||||
if (level > 77)
|
||||
ctx.result += (level - 77) + 1;
|
||||
if (level > 69)
|
||||
ctx.result += (level - 69);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum CP
|
||||
*
|
||||
* <pre>
|
||||
* 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());
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseCPCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseCPCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseCP();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
final CharacterTemplate template = c.getTemplate();
|
||||
|
||||
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;
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.CON.calculateBonus(c.getStats()
|
||||
.getConcentration());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum HP
|
||||
*
|
||||
* <pre>
|
||||
* 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());
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseHPCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseHPCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseHP();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
final CharacterTemplate template = c.getTemplate();
|
||||
|
||||
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;
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.CON.calculateBonus(c.getStats()
|
||||
.getConcentration());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterMoveType;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character base HP regeneration
|
||||
*
|
||||
* <pre>
|
||||
* TODO base hp regen
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseHPRegenerationCalculator extends CharacterCalculator {
|
||||
/**
|
||||
* Retail value is 100
|
||||
*/
|
||||
public static final double HP_REGEN_MULTIPLIER = 100;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseHPRegenerationCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
// TODO set base hp regen
|
||||
ctx.result = 0;
|
||||
|
||||
// initial value is changed here
|
||||
ctx.result += (c.getLevel() > 10) ? ((c.getLevel() - 1) / 10.0)
|
||||
: 0.5;
|
||||
|
||||
// Add CON bonus
|
||||
ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0)
|
||||
* BaseStats.CON.calculateBonus(c.getStats()
|
||||
.getConcentration());
|
||||
|
||||
if (ctx.result < 0)
|
||||
ctx.result = 0;
|
||||
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(Integer.MAX_VALUE) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
double hpRegenMultiplier = HP_REGEN_MULTIPLIER;
|
||||
double hpRegenBonus = 0;
|
||||
|
||||
// TODO SevenSigns Festival modifier
|
||||
// if (SevenSignsFestival.getInstance().isFestivalInProgress()
|
||||
// && player.isFestivalParticipant())
|
||||
// hpRegenMultiplier *= calcFestivalRegenModifier(player);
|
||||
// else {
|
||||
// double siegeModifier = calcSiegeRegenModifer(player);
|
||||
// if (siegeModifier > 0)
|
||||
// hpRegenMultiplier *= siegeModifier;
|
||||
// }
|
||||
|
||||
// TODO clan hall regen
|
||||
// if (player.isInsideZone(L2Character.ZONE_CLANHALL)
|
||||
// && player.getClan() != null
|
||||
// && player.getClan().getHasHideout() > 0) {
|
||||
// L2ClanHallZone zone = ZoneManager.getInstance().getZone(
|
||||
// player, L2ClanHallZone.class);
|
||||
// int posChIndex = zone == null ? -1 : zone.getClanHallId();
|
||||
// int clanHallIndex = player.getClan().getHasHideout();
|
||||
// if (clanHallIndex > 0 && clanHallIndex == posChIndex) {
|
||||
// ClanHall clansHall = ClanHallManager.getInstance()
|
||||
// .getClanHallById(clanHallIndex);
|
||||
// if (clansHall != null)
|
||||
// if (clansHall.getFunction(ClanHall.FUNC_RESTORE_HP) != null)
|
||||
// hpRegenMultiplier *= 1 + (double) clansHall
|
||||
// .getFunction(ClanHall.FUNC_RESTORE_HP)
|
||||
// .getLvl() / 100;
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO castle regen
|
||||
// if (player.isInsideZone(L2Character.ZONE_CASTLE)
|
||||
// && player.getClan() != null
|
||||
// && player.getClan().getHasCastle() > 0) {
|
||||
// L2CastleZone zone = ZoneManager.getInstance().getZone(
|
||||
// player, L2CastleZone.class);
|
||||
// int posCastleIndex = zone == null ? -1 : zone.getCastleId();
|
||||
// int castleIndex = player.getClan().getHasCastle();
|
||||
// if (castleIndex > 0 && castleIndex == posCastleIndex) {
|
||||
// Castle castle = CastleManager.getInstance()
|
||||
// .getCastleById(castleIndex);
|
||||
// if (castle != null)
|
||||
// if (castle.getFunction(Castle.FUNC_RESTORE_HP) != null)
|
||||
// hpRegenMultiplier *= 1 + (double) castle
|
||||
// .getFunction(Castle.FUNC_RESTORE_HP)
|
||||
// .getLvl() / 100;
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO fort regen
|
||||
// if (player.isInsideZone(L2Character.ZONE_FORT)
|
||||
// && player.getClan() != null
|
||||
// && player.getClan().getHasFort() > 0) {
|
||||
// L2FortZone zone = ZoneManager.getInstance().getZone(player,
|
||||
// L2FortZone.class);
|
||||
// int posFortIndex = zone == null ? -1 : zone.getFortId();
|
||||
// int fortIndex = player.getClan().getHasFort();
|
||||
// if (fortIndex > 0 && fortIndex == posFortIndex) {
|
||||
// Fort fort = FortManager.getInstance().getFortById(
|
||||
// fortIndex);
|
||||
// if (fort != null)
|
||||
// if (fort.getFunction(Fort.FUNC_RESTORE_HP) != null)
|
||||
// hpRegenMultiplier *= 1 + (double) fort
|
||||
// .getFunction(Fort.FUNC_RESTORE_HP)
|
||||
// .getLvl() / 100;
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO Mother Tree effect is calculated at last
|
||||
// if (player.isInsideZone(L2Character.ZONE_MOTHERTREE)) {
|
||||
// L2MotherTreeZone zone = ZoneManager.getInstance().getZone(
|
||||
// player, L2MotherTreeZone.class);
|
||||
// int hpBonus = zone == null ? 0 : zone.getHpRegenBonus();
|
||||
// hpRegenBonus += hpBonus;
|
||||
// }
|
||||
|
||||
// Calculate Movement bonus
|
||||
// if (player.isSitting())
|
||||
// hpRegenMultiplier *= 1.5; // Sitting
|
||||
// else
|
||||
if (c.isIdle())
|
||||
hpRegenMultiplier *= 1.1; // Staying
|
||||
else if (c.getMoveType() == CharacterMoveType.RUN)
|
||||
hpRegenMultiplier *= 0.7; // Running
|
||||
|
||||
ctx.result = ctx.result * hpRegenMultiplier + hpRegenBonus;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character base MP
|
||||
*
|
||||
* <pre>
|
||||
* 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());
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMPCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMPCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseBaseMP();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
final CharacterTemplate template = c.getTemplate();
|
||||
|
||||
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;
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.MEN.calculateBonus(c.getStats()
|
||||
.getMentality());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the base magical attack speed
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
|
||||
* ctx.result *= BaseStats.WIT.calculateBonus(c.getStats().getWitness());
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMagicalAttackSpeedCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMagicalAttackSpeedCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.WIT.calculateBonus(c.getStats()
|
||||
.getWitness());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_EAR;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEFT_FINGER;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.NECK;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_EAR;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_FINGER;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.model.world.character.CharacterInventory;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character base magical defense.
|
||||
*
|
||||
* <pre>
|
||||
* 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);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMagicalDefenseCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMagicalDefenseCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseMagicalDefense();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
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;
|
||||
|
||||
ctx.result *= BaseStats.MEN.calculateBonus(c.getStats()
|
||||
.getMentality())
|
||||
* ((100.0 - 11 + c.getLevel()) / 100.0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.CHEST;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.FEET;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.GLOVES;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HEAD;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.LEGS;
|
||||
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.world.character.CharacterClass.ClassType;
|
||||
import com.l2jserver.model.world.character.CharacterInventory;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
|
||||
/**
|
||||
* Calculates the character base physical defense
|
||||
*
|
||||
* <pre>
|
||||
* 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);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BasePhysicalDefenseCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BasePhysicalDefenseCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBasePhysicalDefense();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
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;
|
||||
ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,15 @@
|
||||
*/
|
||||
package com.l2jserver.model.world.character.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;
|
||||
|
||||
/**
|
||||
* An calculator for character formulas.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterCalculator extends Calculator<L2Character> {
|
||||
public CharacterCalculator(Function<L2Character>... functions) {
|
||||
public class CharacterCalculator extends ActorCalculator {
|
||||
public CharacterCalculator(CharacterCalculatorFunction... functions) {
|
||||
super(functions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.ActorTemplate;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.calculator.ActorCalculatorFunction;
|
||||
|
||||
/**
|
||||
* An calculator for character formulas.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class CharacterCalculatorFunction extends
|
||||
ActorCalculatorFunction {
|
||||
public CharacterCalculatorFunction(int order) {
|
||||
super(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final double calculate(Actor a, ActorTemplate<?> actorTemplate,
|
||||
double value) {
|
||||
return calculate((L2Character) a, (CharacterTemplate) actorTemplate,
|
||||
value);
|
||||
}
|
||||
|
||||
protected abstract double calculate(L2Character c, CharacterTemplate t,
|
||||
double value);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* Calculates the character base CP
|
||||
*
|
||||
* <pre>
|
||||
* 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;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
|
||||
/**
|
||||
* Calculates the character base CP
|
||||
*
|
||||
* <pre>
|
||||
* 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;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum HP
|
||||
*
|
||||
* <pre>
|
||||
* 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;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* Calculates the character base MP
|
||||
*
|
||||
* <pre>
|
||||
* 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;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base accuracy.
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseAccuracy();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseAttackAccuracyCalculator extends CharacterCalculator {
|
||||
public CharacterBaseAttackAccuracyCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseAccuracy();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character evasion
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseEvasion();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseAttackEvasionCalculator extends CharacterCalculator {
|
||||
public CharacterBaseAttackEvasionCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseEvasion();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum CP
|
||||
*
|
||||
* <pre>
|
||||
* return c.getTemplate().getBaseCP();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseCPCalculator extends CharacterCalculator {
|
||||
public CharacterBaseCPCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseCP();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character concentration
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseConcentrationCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseConcentrationCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseConcentrationCalculator extends CharacterCalculator {
|
||||
public CharacterBaseConcentrationCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseConcentration();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseConcentration();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base dexterity
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseDexterityCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseDexterityCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseDexterityCalculator extends CharacterCalculator {
|
||||
public CharacterBaseDexterityCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseDexterity();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseDexterity();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum HP
|
||||
*
|
||||
* <pre>
|
||||
* return c.getTemplate().getBaseHP();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseHPCalculator extends CharacterCalculator {
|
||||
public CharacterBaseHPCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseHP();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base intelligence
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseIntelligenceCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseIntelligenceCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseIntelligenceCalculator extends CharacterCalculator {
|
||||
public CharacterBaseIntelligenceCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseIntelligence();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseIntelligence();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character maximum HP
|
||||
*
|
||||
* <pre>
|
||||
* return c.getTemplate().getBaseMP();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMPCalculator extends CharacterCalculator {
|
||||
public CharacterBaseMPCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseBaseMP();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base magical attack
|
||||
@@ -31,21 +31,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMagicalAttackCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMagicalAttackCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseMagicalAttackCalculator extends CharacterCalculator {
|
||||
public CharacterBaseMagicalAttackCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseMagicalAttack();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= Math
|
||||
.pow(((100.0 - 11 + c.getLevel()) / 100.0), 2)
|
||||
* Math.pow(BaseStats.INT.calculateBonus(c.getStats()
|
||||
.getIntelligence()), 2);
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseMagicalAttack();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the base magical attack speed
|
||||
*
|
||||
* <pre>
|
||||
* ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMagicalAttackSpeedCalculator extends CharacterCalculator {
|
||||
public CharacterBaseMagicalAttackSpeedCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseMagicalAttackSpeed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the base magical attack critical rate
|
||||
@@ -31,21 +31,14 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMagicalCriticalRateCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMagicalCriticalRateCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseMagicalCriticalRateCalculator extends
|
||||
CharacterCalculator {
|
||||
public CharacterBaseMagicalCriticalRateCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
// XXX is the same as physical????
|
||||
ctx.result = c.getTemplate().getBaseCritical();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x300) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
// TODO only apply if using a weapon
|
||||
ctx.result *= BaseStats.WIT.calculateBonus(c.getStats()
|
||||
.getWitness());
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseCritical();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base magical defense.
|
||||
*
|
||||
* <pre>
|
||||
* 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);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseMagicalDefenseCalculator extends CharacterCalculator {
|
||||
public CharacterBaseMagicalDefenseCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseMagicalDefense();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base mentality
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMentalityCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseMentalityCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseMentalityCalculator extends CharacterCalculator {
|
||||
public CharacterBaseMentalityCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseMentality();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseMentality();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base physical attack
|
||||
@@ -32,19 +32,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BasePhysicalAttackCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BasePhysicalAttackCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBasePhysicalAttackCalculator extends CharacterCalculator {
|
||||
public CharacterBasePhysicalAttackCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBasePhysicalAttack();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x100) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.STR.calculateBonus(c.getStats()
|
||||
.getStrength()) * ((100.0 - 11 + c.getLevel()) / 100.0);
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBasePhysicalAttack();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base physical attack speed
|
||||
@@ -31,19 +31,14 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BasePhysicalAttackSpeedCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BasePhysicalAttackSpeedCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBasePhysicalAttackSpeedCalculator extends
|
||||
CharacterCalculator {
|
||||
public CharacterBasePhysicalAttackSpeedCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBasePhysicalAttackSpeed();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x200) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.DEX.calculateBonus(c.getStats()
|
||||
.getDexterity());
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBasePhysicalAttackSpeed();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base critical rate
|
||||
@@ -32,22 +32,14 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BasePhysicalCriticalRateCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BasePhysicalCriticalRateCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBasePhysicalCriticalRateCalculator extends
|
||||
CharacterCalculator {
|
||||
public CharacterBasePhysicalCriticalRateCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseCritical();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x090) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.DEX.calculateBonus(c.getStats()
|
||||
.getDexterity());
|
||||
ctx.result *= 10;
|
||||
|
||||
// TODO l2j uses another variable here, must check why
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseCritical();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base physical defense
|
||||
*
|
||||
* <pre>
|
||||
* 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);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBasePhysicalDefenseCalculator extends CharacterCalculator {
|
||||
public CharacterBasePhysicalDefenseCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBasePhysicalDefense();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base run speed
|
||||
@@ -31,19 +31,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseRunSpeedCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseRunSpeedCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseRunSpeedCalculator extends CharacterCalculator {
|
||||
public CharacterBaseRunSpeedCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseRunSpeed();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x300) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.DEX.calculateBonus(c.getStats()
|
||||
.getDexterity());
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseRunSpeed();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base strength
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseStrengthCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseStrengthCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseStrengthCalculator extends CharacterCalculator {
|
||||
public CharacterBaseStrengthCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseStrength();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseStrength();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,12 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.stat.BaseStats;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base walk speed
|
||||
@@ -31,19 +31,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseWalkSpeedCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseWalkSpeedCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseWalkSpeedCalculator extends CharacterCalculator {
|
||||
public CharacterBaseWalkSpeedCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseWalkSpeed();
|
||||
}
|
||||
}, new AbstractFunction<L2Character>(0x300) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result *= BaseStats.DEX.calculateBonus(c.getStats()
|
||||
.getDexterity());
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseWalkSpeed();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -14,11 +14,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character.calculator;
|
||||
package com.l2jserver.model.world.character.calculator.base;
|
||||
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.calculator.AbstractFunction;
|
||||
import com.l2jserver.util.calculator.CalculatorContext;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculator;
|
||||
import com.l2jserver.model.world.character.calculator.CharacterCalculatorFunction;
|
||||
|
||||
/**
|
||||
* Calculates the character base witness
|
||||
@@ -29,13 +30,13 @@ import com.l2jserver.util.calculator.CalculatorContext;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseWitnessCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseWitnessCalculator() {
|
||||
super(new AbstractFunction<L2Character>(0x000) {
|
||||
public class CharacterBaseWitnessCalculator extends CharacterCalculator {
|
||||
public CharacterBaseWitnessCalculator() {
|
||||
super(new CharacterCalculatorFunction(0x000) {
|
||||
@Override
|
||||
public void calculate(L2Character c, CalculatorContext ctx) {
|
||||
ctx.result = c.getTemplate().getBaseWitness();
|
||||
protected double calculate(L2Character c, CharacterTemplate t,
|
||||
double value) {
|
||||
return t.getBaseWitness();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user