Project update.

This commit is contained in:
MobiusDev
2015-12-31 23:53:41 +00:00
parent e0d681a17e
commit ad2bcd79be
4084 changed files with 83696 additions and 86998 deletions

View File

@ -0,0 +1,100 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats;
import com.l2jmobius.gameserver.model.actor.L2Character;
/**
* @author Sdw
*/
public enum BaseStats
{
STR // #TODO Check if correct
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.009, actor.getSTR() - 49);
}
},
INT // @TODO Update
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.01, actor.getINT() - 49.4);
}
},
DEX // Updated and better Formula to match Ertheia
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.004558949443461, actor.getDEX() - 19.27356040917275);
}
},
WIT // Updated and better Formula to match Ertheia
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.013832042738272, actor.getWIT() - 64.57078483041223);
}
},
CON // Updated and better Formula to match Ertheia
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.011685289099497, actor.getCON() - 34.80273839854561);
}
},
MEN // Updated and better Formula to match Ertheia
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.003687502032154, actor.getMEN() + 30.4505503162);
}
},
CHA // Addition for Ertheia
{
@Override
public double calcBonus(L2Character actor)
{
return Math.pow(1.001, actor.getCHA() - 43);
}
},
LUC // @TODO: Implement
{
@Override
public double calcBonus(L2Character actor)
{
return 1;
}
},
NONE
{
@Override
public double calcBonus(L2Character actor)
{
return 1;
}
};
public abstract double calcBonus(L2Character actor);
}

View File

@ -0,0 +1,223 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* A calculator is created to manage and dynamically calculate the effect of a character property (ex : MAX_HP, REGENERATE_HP_RATE...).<br>
* In fact, each calculator is a table of Func object in which each Func represents a mathematical function:<br>
* FuncAtkAccuracy -> Math.sqrt(_player.getDEX())*6+_player.getLevel()<br>
* When the calc method of a calculator is launched, each mathematical function is called according to its priority <B>_order</B>.<br>
* Indeed, Func with lowest priority order is executed first and Funcs with the same order are executed in unspecified order.<br>
* The result of the calculation is stored in the value property of an Env class instance.<br>
* Method addFunc and removeFunc permit to add and remove a Func object from a Calculator.
*/
public final class Calculator
{
/** Empty Func table definition */
private static final AbstractFunction[] EMPTY_FUNCS = new AbstractFunction[0];
/** Table of Func object */
private AbstractFunction[] _functions;
/**
* Constructor of Calculator (Init value : emptyFuncs).
*/
public Calculator()
{
_functions = EMPTY_FUNCS;
}
/**
* Constructor of Calculator (Init value : Calculator c).
* @param c
*/
public Calculator(Calculator c)
{
_functions = c._functions;
}
/**
* Check if 2 calculators are equals.
* @param c1
* @param c2
* @return
*/
public static boolean equalsCals(Calculator c1, Calculator c2)
{
if (c1 == c2)
{
return true;
}
if ((c1 == null) || (c2 == null))
{
return false;
}
final AbstractFunction[] funcs1 = c1._functions;
final AbstractFunction[] funcs2 = c2._functions;
if (funcs1 == funcs2)
{
return true;
}
if (funcs1.length != funcs2.length)
{
return false;
}
if (funcs1.length == 0)
{
return true;
}
for (int i = 0; i < funcs1.length; i++)
{
if (funcs1[i] != funcs2[i])
{
return false;
}
}
return true;
}
/**
* Return the number of Funcs in the Calculator.
* @return
*/
public int size()
{
return _functions.length;
}
/**
* Adds a function to the Calculator.
* @param function the function
*/
public synchronized void addFunc(AbstractFunction function)
{
final AbstractFunction[] funcs = _functions;
final AbstractFunction[] tmp = new AbstractFunction[funcs.length + 1];
final int order = function.getOrder();
int i;
for (i = 0; (i < funcs.length) && (order >= funcs[i].getOrder()); i++)
{
tmp[i] = funcs[i];
}
tmp[i] = function;
for (; i < funcs.length; i++)
{
tmp[i + 1] = funcs[i];
}
_functions = tmp;
}
/**
* Removes a function from the Calculator.
* @param function the function
*/
public synchronized void removeFunc(AbstractFunction function)
{
final AbstractFunction[] funcs = _functions;
final AbstractFunction[] tmp = new AbstractFunction[funcs.length - 1];
int i;
for (i = 0; (i < (funcs.length - 1)) && (function != funcs[i]); i++)
{
tmp[i] = funcs[i];
}
if (i == funcs.length)
{
return;
}
for (i++; i < funcs.length; i++)
{
tmp[i - 1] = funcs[i];
}
if (tmp.length == 0)
{
_functions = EMPTY_FUNCS;
}
else
{
_functions = tmp;
}
}
/**
* Remove each Func with the specified owner of the Calculator.
* @param owner the owner
* @return a list of modified stats
*/
public synchronized List<Stats> removeOwner(Object owner)
{
final List<Stats> modifiedStats = new ArrayList<>();
for (AbstractFunction func : _functions)
{
if (func.getFuncOwner() == owner)
{
modifiedStats.add(func.getStat());
removeFunc(func);
}
}
return modifiedStats;
}
/**
* Run each function of the Calculator.
* @param caster the caster
* @param target the target
* @param skill the skill
* @param initVal the initial value
* @return the calculated value
*/
public double calc(L2Character caster, L2Character target, Skill skill, double initVal)
{
double value = initVal;
for (AbstractFunction func : _functions)
{
value = func.calc(caster, target, skill, value);
}
return value;
}
/**
* Get array of all function, dont use for add/remove
* @return
*/
public AbstractFunction[] getFunctions()
{
return _functions;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats;
/**
* Enum of move types.
* @author GKR
*/
public enum MoveType
{
WALK,
RUN,
FAST_SWIM,
SLOW_SWIM,
FAST_FLY,
SLOW_FLY
}

View File

@ -0,0 +1,246 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats;
import java.util.NoSuchElementException;
/**
* Enum of basic stats.
* @author mkizub
*/
public enum Stats
{
// Base stats, for each in Calculator a slot is allocated
// HP, MP & CP
MAX_HP("maxHp"),
MAX_MP("maxMp"),
MAX_CP("maxCp"),
MAX_RECOVERABLE_HP("maxRecoverableHp"), // The maximum HP that is able to be recovered trough heals
MAX_RECOVERABLE_MP("maxRecoverableMp"),
MAX_RECOVERABLE_CP("maxRecoverableCp"),
REGENERATE_HP_RATE("regHp"),
REGENERATE_CP_RATE("regCp"),
REGENERATE_MP_RATE("regMp"),
MANA_CHARGE("manaCharge"),
HEAL_EFFECT("healEffect"),
// ATTACK & DEFENCE
POWER_DEFENCE("pDef"),
MAGIC_DEFENCE("mDef"),
POWER_ATTACK("pAtk"),
MAGIC_ATTACK("mAtk"),
PHYSICAL_SKILL_POWER("physicalSkillPower"),
PHYSICAL_SKILL_POWER_ADD("physicalSkillPowerAdd"),
POWER_ATTACK_SPEED("pAtkSpd"),
MAGIC_ATTACK_SPEED("mAtkSpd"), // Magic Skill Casting Time Rate
ATK_REUSE("atkReuse"), // Bows Hits Reuse Rate
P_REUSE("pReuse"), // Physical Skill Reuse Rate
MAGIC_REUSE_RATE("mReuse"), // Magic Skill Reuse Rate
DANCE_REUSE("dReuse"), // Dance Skill Reuse Rate
SHIELD_DEFENCE("sDef"),
CRITICAL_DAMAGE("critDmg"),
CRITICAL_DAMAGE_POS("critDmgPos"),
CRITICAL_DAMAGE_ADD("critDmgAdd"), // this is another type for special critical damage mods - vicious stance, critical power and critical damage SA
MAGIC_CRIT_DMG("mCritPower"),
MAGIC_CRIT_DMG_ADD("mCritPowerAdd"),
MOMENTUM_SKILL_POWER("momentumSkillPower"),
// PVP BONUS
PVP_PHYSICAL_DMG("pvpPhysDmg"),
PVP_MAGICAL_DMG("pvpMagicalDmg"),
PVP_PHYS_SKILL_DMG("pvpPhysSkillsDmg"),
PVP_PHYSICAL_DEF("pvpPhysDef"),
PVP_MAGICAL_DEF("pvpMagicalDef"),
PVP_PHYS_SKILL_DEF("pvpPhysSkillsDef"),
// PVE BONUS
PVE_PHYSICAL_DMG("pvePhysDmg"),
PVE_PHYS_SKILL_DMG("pvePhysSkillsDmg"),
PVE_BOW_DMG("pveBowDmg"),
PVE_BOW_SKILL_DMG("pveBowSkillsDmg"),
PVE_MAGICAL_DMG("pveMagicalDmg"),
// ATTACK & DEFENCE RATES
EVASION_RATE("rEvas"),
MAGIC_EVASION_RATE("mEvas"),
P_SKILL_EVASION("pSkillEvas"),
DEFENCE_CRITICAL_RATE("defCritRate"),
DEFENCE_CRITICAL_RATE_ADD("defCritRateAdd"),
DEFENCE_CRITICAL_DAMAGE("defCritDamage"),
DEFENCE_CRITICAL_DAMAGE_ADD("defCritDamageAdd"), // Resistance to critical damage in value (Example: +100 will be 100 more critical damage, NOT 100% more).
SHIELD_RATE("rShld"),
CRITICAL_RATE("critRate"),
CRITICAL_RATE_POS("critRatePos"),
MAX_PHYS_CRIT_RATE("maxPhysCritRate"),
BLOW_RATE("blowRate"),
MCRITICAL_RATE("mCritRate"),
EXPSP_RATE("rExp"),
BONUS_EXP("bonusExp"),
BONUS_SP("bonusSp"),
ATTACK_CANCEL("cancel"),
// ACCURACY & RANGE
ACCURACY_COMBAT("accCombat"),
ACCURACY_MAGIC("accMagic"),
POWER_ATTACK_RANGE("pAtkRange"),
MAGIC_ATTACK_RANGE("mAtkRange"),
ATTACK_COUNT_MAX("atkCountMax"),
// Run speed, walk & escape speed are calculated proportionally, magic speed is a buff
MOVE_SPEED("runSpd"),
// BASIC STATS
STAT_STR("STR"),
STAT_CON("CON"),
STAT_DEX("DEX"),
STAT_INT("INT"),
STAT_WIT("WIT"),
STAT_MEN("MEN"),
STAT_LUC("LUC"),
STAT_CHA("CHA"),
// Special stats, share one slot in Calculator
// VARIOUS
BREATH("breath"),
FALL("fall"),
// VULNERABILITIES
DAMAGE_ZONE_VULN("damageZoneVuln"),
MOVEMENT_VULN("movementVuln"),
CANCEL_VULN("cancelVuln"), // Resistance for cancel type skills
DEBUFF_VULN("debuffVuln"),
BUFF_VULN("buffVuln"),
// RESISTANCES
FIRE_RES("fireRes"),
WIND_RES("windRes"),
WATER_RES("waterRes"),
EARTH_RES("earthRes"),
HOLY_RES("holyRes"),
DARK_RES("darkRes"),
MAGIC_SUCCESS_RES("magicSuccRes"),
// ELEMENT POWER
FIRE_POWER("firePower"),
WATER_POWER("waterPower"),
WIND_POWER("windPower"),
EARTH_POWER("earthPower"),
HOLY_POWER("holyPower"),
DARK_POWER("darkPower"),
WEAPON_ELEMENT_POWER("weaponElementPower"),
// PROFICIENCY
CANCEL_PROF("cancelProf"),
REFLECT_DAMAGE_PERCENT("reflectDam"),
REFLECT_SKILL_MAGIC("reflectSkillMagic"),
REFLECT_SKILL_PHYSIC("reflectSkillPhysic"),
REFLECT_DAMAGE_RESISTANCE("reflectDamageRes"),
VENGEANCE_SKILL_MAGIC_DAMAGE("vengeanceMdam"),
VENGEANCE_SKILL_PHYSICAL_DAMAGE("vengeancePdam"),
ABSORB_DAMAGE_PERCENT("absorbDam"),
TRANSFER_DAMAGE_PERCENT("transDam"),
MANA_SHIELD_PERCENT("manaShield"),
TRANSFER_DAMAGE_TO_PLAYER("transDamToPlayer"),
ABSORB_MANA_DAMAGE_PERCENT("absorbDamMana"),
RECEIVED_DAMAGE_MODIFIER("receivedDamageModifier"),
WEIGHT_LIMIT("weightLimit"),
WEIGHT_PENALTY("weightPenalty"),
// ExSkill
INV_LIM("inventoryLimit"),
WH_LIM("whLimit"),
FREIGHT_LIM("freightLimit"),
P_SELL_LIM("privateSellLimit"),
P_BUY_LIM("privateBuyLimit"),
REC_D_LIM("dwarfRecipeLimit"),
REC_C_LIM("commonRecipeLimit"),
// C4 Stats
PHYSICAL_MP_CONSUME_RATE("physicalMpConsumeRate"),
MAGICAL_MP_CONSUME_RATE("magicalMpConsumeRate"),
DANCE_MP_CONSUME_RATE("danceMpConsumeRate"),
BOW_MP_CONSUME_RATE("bowMpConsumeRate"),
MP_CONSUME("mpConsume"),
// Shield Stats
SHIELD_DEFENCE_ANGLE("shieldDefAngle"),
// Skill mastery
SKILL_CRITICAL("skillCritical"),
SKILL_CRITICAL_PROBABILITY("skillCriticalProbability"),
CRAFT_MASTERY("craftMastery"),
// Vitality
VITALITY_CONSUME_RATE("vitalityConsumeRate"),
// Souls
MAX_SOULS("maxSouls"),
REDUCE_EXP_LOST_BY_PVP("reduceExpLostByPvp"),
REDUCE_EXP_LOST_BY_MOB("reduceExpLostByMob"),
REDUCE_EXP_LOST_BY_RAID("reduceExpLostByRaid"),
REDUCE_DEATH_PENALTY_BY_PVP("reduceDeathPenaltyByPvp"),
REDUCE_DEATH_PENALTY_BY_MOB("reduceDeathPenaltyByMob"),
REDUCE_DEATH_PENALTY_BY_RAID("reduceDeathPenaltyByRaid"),
// Fishing
FISHING_EXPERTISE("fishingExpertise"),
// Brooches
BROOCH_JEWELS("broochJewels"),
// Summon Points
MAX_SUMMON_POINTS("summonPoints"),
// Max Skill Damage Receive
MAX_SKILL_DAMAGE("maxSkillDamage"),
// Hp restore on kill enemy
HP_RESTORE_ON_KILL("hpRestoreOnKill");
public static final int NUM_STATS = values().length;
private String _value;
public String getValue()
{
return _value;
}
private Stats(String s)
{
_value = s;
}
public static Stats valueOfXml(String name)
{
name = name.intern();
for (Stats s : values())
{
if (s.getValue().equals(name))
{
return s;
}
}
throw new NoSuchElementException("Unknown name '" + name + "' for enum " + Stats.class.getSimpleName());
}
}

View File

@ -0,0 +1,90 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats;
/**
* @author UnAfraid, NosBit
*/
public enum TraitType
{
UNK_0(0, 0),
SWORD(1, 1),
BLUNT(2, 1),
DAGGER(3, 1),
POLE(4, 1),
FIST(5, 1),
BOW(6, 1),
ETC(7, 1),
UNK_8(8, 0),
POISON(9, 3),
HOLD(10, 3),
BLEED(11, 3),
SLEEP(12, 3),
SHOCK(13, 3),
DERANGEMENT(14, 3),
BUG_WEAKNESS(15, 2),
ANIMAL_WEAKNESS(16, 2),
PLANT_WEAKNESS(17, 2),
BEAST_WEAKNESS(18, 2),
DRAGON_WEAKNESS(19, 2),
PARALYZE(20, 3),
DUAL(21, 1),
DUALFIST(22, 1),
BOSS(23, 3),
GIANT_WEAKNESS(24, 2),
CONSTRUCT_WEAKNESS(25, 2),
DEATH(26, 3),
VALAKAS(27, 2),
UNK_28(28, 2),
UNK_29(29, 3),
ROOT_PHYSICALLY(30, 3),
UNK_31(31, 3),
RAPIER(32, 1),
CROSSBOW(33, 1),
ANCIENTSWORD(34, 1),
TURN_STONE(35, 3),
GUST(36, 3),
PHYSICAL_BLOCKADE(37, 3),
UNK_38(38, 3),
UNK_39(39, 3),
UNK_40(40, 3),
DUALDAGGER(41, 1),
DUALBLUNT(42, 1),
KNOCKBACK(43, 3),
KNOCKDOWN(44, 3),
MUTE(45, 3),
NONE(46, 0);
private final int _id;
private final int _type; // 1 = weapon, 2 = weakness, 3 = resistance
TraitType(int id, int type)
{
_id = id;
_type = type;
}
public int getId()
{
return _id;
}
public int getType()
{
return _type;
}
}

View File

@ -0,0 +1,130 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* A Function object is a component of a Calculator created to manage and dynamically calculate the effect of a character property (ex : MAX_HP, REGENERATE_HP_RATE...).<br>
* In fact, each calculator is a table of functions object in which each function represents a mathematics function:<br>
* FuncAtkAccuracy -> Math.sqrt(_player.getDEX())*6+_player.getLevel()<br>
* When the calc method of a calculator is launched, each mathematics function is called according to its priority <B>_order</B>.<br>
* Indeed, functions with lowest priority order is executed first and functions with the same order are executed in unspecified order.<br>
* @author Zoey76
*/
public abstract class AbstractFunction
{
/** Logger. */
protected static final Logger LOG = Logger.getLogger(AbstractFunction.class.getName());
/** Statistics, that is affected by this function (See L2Character.CALCULATOR_XXX constants) */
private final Stats _stat;
/**
* Order of functions calculation.<br>
* Functions with lower order are executed first.<br>
* Functions with the same order are executed in unspecified order.<br>
* Usually add/subtract functions has lowest order,<br>
* then bonus/penalty functions (multiply/divide) are applied, then functions that do more complex<br>
* calculations (non-linear functions).
*/
private final int _order;
/**
* Owner can be an armor, weapon, skill, system event, quest, etc.<br>
* Used to remove all functions added by this owner.
*/
private final Object _funcOwner;
/** Function may be disabled by attached condition. */
private final Condition _applayCond;
/** The value. */
private final double _value;
/**
* Constructor of Func.
* @param stat the stat
* @param order the order
* @param owner the owner
* @param value the value
* @param applayCond the apply condition
*/
public AbstractFunction(Stats stat, int order, Object owner, double value, Condition applayCond)
{
_stat = stat;
_order = order;
_funcOwner = owner;
_value = value;
_applayCond = applayCond;
}
/**
* Gets the apply condition
* @return the apply condition
*/
public Condition getApplayCond()
{
return _applayCond;
}
/**
* Gets the fuction owner.
* @return the function owner
*/
public final Object getFuncOwner()
{
return _funcOwner;
}
/**
* Gets the function order.
* @return the order
*/
public final int getOrder()
{
return _order;
}
/**
* Gets the stat.
* @return the stat
*/
public final Stats getStat()
{
return _stat;
}
/**
* Gets the value.
* @return the value
*/
public final double getValue()
{
return _value;
}
/**
* Run the mathematics function of the Func.
* @param effector the effector
* @param effected the effected
* @param skill the skill
* @param initVal the initial value
* @return the calculated value
*/
public abstract double calc(L2Character effector, L2Character effected, Skill skill, double initVal);
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Returns the initial value plus the function value, if the condition are met.
* @author Zoey76
*/
public class FuncAdd extends AbstractFunction
{
public FuncAdd(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
{
return initVal + getValue();
}
return initVal;
}
}

View File

@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Returns the initial value divided the function value, if the condition are met.
* @author Zoey76
*/
public class FuncDiv extends AbstractFunction
{
public FuncDiv(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
{
try
{
return initVal / getValue();
}
catch (Exception e)
{
LOG.warning(FuncDiv.class.getSimpleName() + ": Division by zero: " + getValue() + "!");
}
}
return initVal;
}
}

View File

@ -0,0 +1,269 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.WeaponType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public class FuncEnchant extends AbstractFunction
{
public FuncEnchant(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
double value = initVal;
if ((getApplayCond() != null) && !getApplayCond().test(effector, effected, skill))
{
return value;
}
final L2ItemInstance item = (L2ItemInstance) getFuncOwner();
int enchant = item.getEnchantLevel();
if (enchant <= 0)
{
return value;
}
int overenchant = 0;
if (enchant > 3)
{
overenchant = enchant - 3;
enchant = 3;
}
if (effector.isPlayer())
{
if (effector.getActingPlayer().isInOlympiadMode() && (Config.ALT_OLY_ENCHANT_LIMIT >= 0) && ((enchant + overenchant) > Config.ALT_OLY_ENCHANT_LIMIT))
{
if (Config.ALT_OLY_ENCHANT_LIMIT > 3)
{
overenchant = Config.ALT_OLY_ENCHANT_LIMIT - 3;
}
else
{
overenchant = 0;
enchant = Config.ALT_OLY_ENCHANT_LIMIT;
}
}
}
if ((getStat() == Stats.MAGIC_DEFENCE) || (getStat() == Stats.POWER_DEFENCE))
{
switch (item.getItem().getCrystalTypePlus())
{
case R:
{
value += (2 * enchant) + (4 * overenchant);
break;
}
case S:
case A:
case B:
case C:
case D:
case NONE:
{
value += enchant + (3 * overenchant);
break;
}
}
return value;
}
if (getStat() == Stats.MAGIC_ATTACK)
{
switch (item.getItem().getCrystalTypePlus())
{
case R:
{
// M. Atk. increases by 5 for all weapons.
// Starting at +4, M. Atk. bonus double.
value += (5 * enchant) + (10 * overenchant);
break;
}
case S:
{
// M. Atk. increases by 4 for all weapons.
// Starting at +4, M. Atk. bonus double.
value += (4 * enchant) + (8 * overenchant);
break;
}
case A:
case B:
case C:
{
// M. Atk. increases by 3 for all weapons.
// Starting at +4, M. Atk. bonus double.
value += (3 * enchant) + (6 * overenchant);
break;
}
case D:
case NONE:
{
// M. Atk. increases by 2 for all weapons. Starting at +4, M. Atk. bonus double.
// Starting at +4, M. Atk. bonus double.
value += (2 * enchant) + (4 * overenchant);
break;
}
}
return value;
}
if (item.isWeapon())
{
final WeaponType type = (WeaponType) item.getItemType();
switch (item.getItem().getCrystalTypePlus())
{
case R:
{
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
{
if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
{
// P. Atk. increases by 12 for bows.
// Starting at +4, P. Atk. bonus double.
value += (12 * enchant) + (24 * overenchant);
}
else
{
// P. Atk. increases by 7 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
// Starting at +4, P. Atk. bonus double.
value += (7 * enchant) + (14 * overenchant);
}
}
else
{
// P. Atk. increases by 6 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
// Starting at +4, P. Atk. bonus double.
value += (6 * enchant) + (12 * overenchant);
}
break;
}
case S:
{
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
{
if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
{
// P. Atk. increases by 10 for bows.
// Starting at +4, P. Atk. bonus double.
value += (10 * enchant) + (20 * overenchant);
}
else
{
// P. Atk. increases by 6 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
// Starting at +4, P. Atk. bonus double.
value += (6 * enchant) + (12 * overenchant);
}
}
else
{
// P. Atk. increases by 5 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
// Starting at +4, P. Atk. bonus double.
value += (5 * enchant) + (10 * overenchant);
}
break;
}
case A:
{
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
{
if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
{
// P. Atk. increases by 8 for bows.
// Starting at +4, P. Atk. bonus double.
value += (8 * enchant) + (16 * overenchant);
}
else
{
// P. Atk. increases by 5 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
// Starting at +4, P. Atk. bonus double.
value += (5 * enchant) + (10 * overenchant);
}
}
else
{
// P. Atk. increases by 4 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
// Starting at +4, P. Atk. bonus double.
value += (4 * enchant) + (8 * overenchant);
}
break;
}
case B:
case C:
{
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
{
if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
{
// P. Atk. increases by 6 for bows.
// Starting at +4, P. Atk. bonus double.
value += (6 * enchant) + (12 * overenchant);
}
else
{
// P. Atk. increases by 4 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
// Starting at +4, P. Atk. bonus double.
value += (4 * enchant) + (8 * overenchant);
}
}
else
{
// P. Atk. increases by 3 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
// Starting at +4, P. Atk. bonus double.
value += (3 * enchant) + (6 * overenchant);
}
break;
}
case D:
case NONE:
{
switch (type)
{
case BOW:
case CROSSBOW:
{
// Bows increase by 4.
// Starting at +4, P. Atk. bonus double.
value += (4 * enchant) + (8 * overenchant);
break;
}
default:
{
// P. Atk. increases by 2 for all weapons with the exception of bows.
// Starting at +4, P. Atk. bonus double.
value += (2 * enchant) + (4 * overenchant);
break;
}
}
break;
}
}
}
return value;
}
}

View File

@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Yamaneko
*/
public class FuncEnchantHp extends AbstractFunction
{
public FuncEnchantHp(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() != null) && !getApplayCond().test(effector, effected, skill))
{
return initVal;
}
final L2ItemInstance item = (L2ItemInstance) getFuncOwner();
if (item.getEnchantLevel() > 0)
{
return initVal + EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
return initVal;
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Returns the initial value plus the function value, if the condition are met.
* @author Zoey76
*/
public class FuncMul extends AbstractFunction
{
public FuncMul(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
{
return initVal * getValue();
}
return initVal;
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Returns the function value, if the condition are met.
* @author Zoey76
*/
public class FuncSet extends AbstractFunction
{
public FuncSet(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
{
return getValue();
}
return initVal;
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Returns the initial value minus the function value, if the condition are met.
* @author Zoey76
*/
public class FuncSub extends AbstractFunction
{
public FuncSub(Stats stat, int order, Object owner, double value, Condition applayCond)
{
super(stat, order, owner, value, applayCond);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
if ((getApplayCond() == null) || getApplayCond().test(effector, effected, skill))
{
return initVal - getValue();
}
return initVal;
}
}

View File

@ -0,0 +1,155 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions;
import java.lang.reflect.Constructor;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.enums.StatFunction;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Function template.
* @author mkizub, Zoey76
*/
public final class FuncTemplate
{
private static final Logger LOG = Logger.getLogger(FuncTemplate.class.getName());
private final Condition _attachCond;
private final Condition _applayCond;
private final Constructor<?> _constructor;
private final Stats _stat;
private final int _order;
private final double _value;
public FuncTemplate(Condition attachCond, Condition applayCond, String functionName, int order, Stats stat, double value)
{
final StatFunction function = StatFunction.valueOf(functionName.toUpperCase());
if (order >= 0)
{
_order = order;
}
else
{
_order = function.getOrder();
}
_attachCond = attachCond;
_applayCond = applayCond;
_stat = stat;
_value = value;
try
{
final Class<?> functionClass = Class.forName("com.l2jmobius.gameserver.model.stats.functions.Func" + function.getName());
_constructor = functionClass.getConstructor(Stats.class, // Stats to update
Integer.TYPE, // Order of execution
Object.class, // Owner
Double.TYPE, // Value for function
Condition.class // Condition
);
}
catch (ClassNotFoundException | NoSuchMethodException e)
{
throw new RuntimeException(e);
}
}
/**
* Gets the function stat.
* @return the stat.
*/
public Stats getStat()
{
return _stat;
}
/**
* Gets the function priority order.
* @return the order
*/
public int getOrder()
{
return _order;
}
/**
* Gets the function value.
* @return the value
*/
public double getValue()
{
return _value;
}
/**
* Gets the functions for skills.
* @param caster the caster
* @param target the target
* @param skill the skill
* @param owner the owner
* @return the function if conditions are met, {@code null} otherwise
*/
public AbstractFunction getFunc(L2Character caster, L2Character target, Skill skill, Object owner)
{
return getFunc(caster, target, skill, null, owner);
}
/**
* Gets the functions for items.
* @param caster the caster
* @param target the target
* @param item the item
* @param owner the owner
* @return the function if conditions are met, {@code null} otherwise
*/
public AbstractFunction getFunc(L2Character caster, L2Character target, L2ItemInstance item, Object owner)
{
return getFunc(caster, target, null, item, owner);
}
/**
* Gets the functions for skills and items.
* @param caster the caster
* @param target the target
* @param skill the skill
* @param item the item
* @param owner the owner
* @return the function if conditions are met, {@code null} otherwise
*/
private AbstractFunction getFunc(L2Character caster, L2Character target, Skill skill, L2ItemInstance item, Object owner)
{
if ((_attachCond != null) && !_attachCond.test(caster, target, skill))
{
return null;
}
try
{
return (AbstractFunction) _constructor.newInstance(_stat, _order, owner, _value, _applayCond);
}
catch (Exception e)
{
LOG.warning(FuncTemplate.class.getSimpleName() + ": " + e.getMessage());
}
return null;
}
}

View File

@ -0,0 +1,113 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData;
import com.l2jmobius.gameserver.model.L2ArmorSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncArmorSet extends AbstractFunction
{
private static final Map<Stats, FuncArmorSet> _fh_instance = new HashMap<>();
public static AbstractFunction getInstance(Stats st)
{
if (!_fh_instance.containsKey(st))
{
_fh_instance.put(st, new FuncArmorSet(st));
}
return _fh_instance.get(st);
}
private FuncArmorSet(Stats stat)
{
super(stat, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
double value = initVal;
final L2PcInstance player = effector.getActingPlayer();
if (player != null)
{
final L2ItemInstance chest = player.getChestArmorInstance();
if (chest != null)
{
final L2ArmorSet set = ArmorSetsData.getInstance().getSet(chest.getId());
if ((set != null) && (set.getPiecesCount(player) >= set.getMinimumPieces()))
{
switch (getStat())
{
case STAT_STR:
{
value += set.getSTR();
break;
}
case STAT_DEX:
{
value += set.getDEX();
break;
}
case STAT_INT:
{
value += set.getINT();
break;
}
case STAT_MEN:
{
value += set.getMEN();
break;
}
case STAT_CON:
{
value += set.getCON();
break;
}
case STAT_WIT:
{
value += set.getWIT();
break;
}
case STAT_LUC:
{
value += set.getLUC();
break;
}
case STAT_CHA:
{
value += set.getCHA();
break;
}
}
}
}
}
return value;
}
}

View File

@ -0,0 +1,69 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncAtkAccuracy extends AbstractFunction
{
private static final FuncAtkAccuracy _faa_instance = new FuncAtkAccuracy();
public static AbstractFunction getInstance()
{
return _faa_instance;
}
private FuncAtkAccuracy()
{
super(Stats.ACCURACY_COMBAT, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
final int level = effector.getLevel();
// [Square(DEX)] * 5 + lvl + weapon hitbonus;
double value = initVal + (Math.sqrt(effector.getDEX()) * 5) + level;
if (level > 77)
{
value += 1;
}
if (level > 80)
{
value += 2;
}
if (level > 87)
{
value += 2;
}
if (level > 92)
{
value += 1;
}
if (level > 97)
{
value += 1;
}
return value;
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncAtkCritical extends AbstractFunction
{
private static final FuncAtkCritical _fac_instance = new FuncAtkCritical();
public static AbstractFunction getInstance()
{
return _fac_instance;
}
private FuncAtkCritical()
{
super(Stats.CRITICAL_RATE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.DEX.calcBonus(effector) * 10;
}
}

View File

@ -0,0 +1,86 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncAtkEvasion extends AbstractFunction
{
private static final FuncAtkEvasion _fae_instance = new FuncAtkEvasion();
public static AbstractFunction getInstance()
{
return _fae_instance;
}
private FuncAtkEvasion()
{
super(Stats.EVASION_RATE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
final int level = effector.getLevel();
double value = initVal;
if (effector.isPlayer())
{
// [Square(DEX)] * 5 + lvl;
value += (Math.sqrt(effector.getDEX()) * 5) + level;
if (level > 69)
{
value += level - 69;
}
if (level > 77)
{
value += 1;
}
if (level > 80)
{
value += 2;
}
if (level > 87)
{
value += 2;
}
if (level > 92)
{
value += 1;
}
if (level > 97)
{
value += 1;
}
}
else
{
// [Square(DEX)] * 5 + lvl;
value += (Math.sqrt(effector.getDEX()) * 5) + level;
if (level > 69)
{
value += (level - 69) + 2;
}
}
return (int) value;
}
}

View File

@ -0,0 +1,102 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncHenna extends AbstractFunction
{
private static final Map<Stats, FuncHenna> _fh_instance = new HashMap<>();
public static AbstractFunction getInstance(Stats st)
{
if (!_fh_instance.containsKey(st))
{
_fh_instance.put(st, new FuncHenna(st));
}
return _fh_instance.get(st);
}
private FuncHenna(Stats stat)
{
super(stat, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
final L2PcInstance pc = effector.getActingPlayer();
double value = initVal;
if (pc != null)
{
switch (getStat())
{
case STAT_STR:
{
value += pc.getHennaStatSTR();
break;
}
case STAT_CON:
{
value += pc.getHennaStatCON();
break;
}
case STAT_DEX:
{
value += pc.getHennaStatDEX();
break;
}
case STAT_INT:
{
value += pc.getHennaStatINT();
break;
}
case STAT_WIT:
{
value += pc.getHennaStatWIT();
break;
}
case STAT_MEN:
{
value += pc.getHennaStatMEN();
break;
}
case STAT_LUC:
{
value += pc.getHennaStatLUC();
break;
}
case STAT_CHA:
{
value += pc.getHennaStatCHA();
break;
}
}
}
return value;
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMAtkCritical extends AbstractFunction
{
private static final FuncMAtkCritical _fac_instance = new FuncMAtkCritical();
public static AbstractFunction getInstance()
{
return _fac_instance;
}
private FuncMAtkCritical()
{
super(Stats.MCRITICAL_RATE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.WIT.calcBonus(effector) * 10;
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMAtkMod extends AbstractFunction
{
private static final FuncMAtkMod _fma_instance = new FuncMAtkMod();
public static AbstractFunction getInstance()
{
return _fma_instance;
}
private FuncMAtkMod()
{
super(Stats.MAGIC_ATTACK, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
// Level Modifier^2 * INT Modifier^2
final double lvlMod = effector.isPlayer() ? BaseStats.INT.calcBonus(effector.getActingPlayer()) : BaseStats.INT.calcBonus(effector);
final double intMod = effector.isPlayer() ? effector.getActingPlayer().getLevelMod() : effector.getLevelMod();
return initVal * Math.pow(lvlMod, 2) * Math.pow(intMod, 2) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMAtkSpeed extends AbstractFunction
{
private static final FuncMAtkSpeed _fas_instance = new FuncMAtkSpeed();
public static AbstractFunction getInstance()
{
return _fas_instance;
}
private FuncMAtkSpeed()
{
super(Stats.MAGIC_ATTACK_SPEED, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.WIT.calcBonus(effector) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,79 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMDefMod extends AbstractFunction
{
private static final FuncMDefMod _fmm_instance = new FuncMDefMod();
public static AbstractFunction getInstance()
{
return _fmm_instance;
}
private FuncMDefMod()
{
super(Stats.MAGIC_DEFENCE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
double value = initVal;
if (effector.isPlayer())
{
final L2PcInstance p = effector.getActingPlayer();
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_LFINGER))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_LFINGER) : Inventory.PAPERDOLL_LFINGER);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_RFINGER))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_RFINGER) : Inventory.PAPERDOLL_RFINGER);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_LEAR))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_LEAR) : Inventory.PAPERDOLL_LEAR);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_REAR))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_REAR) : Inventory.PAPERDOLL_REAR);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_NECK))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_NECK) : Inventory.PAPERDOLL_NECK);
}
value *= BaseStats.CHA.calcBonus(effector);
}
else if (effector.isPet() && (effector.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK) != 0))
{
value -= 13;
}
return value * BaseStats.MEN.calcBonus(effector) * effector.getLevelMod();
}
}

View File

@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author Sdw
*/
public class FuncMatkAccuracy extends AbstractFunction
{
private static final FuncMatkAccuracy _faa_instance = new FuncMatkAccuracy();
public static AbstractFunction getInstance()
{
return _faa_instance;
}
private FuncMatkAccuracy()
{
super(Stats.ACCURACY_MAGIC, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal + (Math.sqrt(effector.getWIT()) * 3) + (effector.getLevel() * 2);
}
}

View File

@ -0,0 +1,62 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMatkEvasion extends AbstractFunction
{
private static final FuncMatkEvasion _fae_instance = new FuncMatkEvasion();
public static AbstractFunction getInstance()
{
return _fae_instance;
}
private FuncMatkEvasion()
{
super(Stats.MAGIC_EVASION_RATE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
final int level = effector.getLevel();
double value = initVal;
if (effector.isPlayer())
{
// [Square(WIT)] * 3 + lvl;
value += (Math.sqrt(effector.getWIT()) * 3) + (level * 2);
}
else
{
// [Square(DEX)] * 6 + lvl;
value += (Math.sqrt(effector.getWIT()) * 3) + (level * 2);
if (level > 69)
{
value += (level - 69) + 2;
}
}
return value;
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMaxCpMul extends AbstractFunction
{
private static final FuncMaxCpMul _fmcm_instance = new FuncMaxCpMul();
public static AbstractFunction getInstance()
{
return _fmcm_instance;
}
private FuncMaxCpMul()
{
super(Stats.MAX_CP, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.CON.calcBonus(effector) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMaxHpMul extends AbstractFunction
{
private static final FuncMaxHpMul _fmhm_instance = new FuncMaxHpMul();
public static AbstractFunction getInstance()
{
return _fmhm_instance;
}
private FuncMaxHpMul()
{
super(Stats.MAX_HP, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.CON.calcBonus(effector) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMaxMpMul extends AbstractFunction
{
private static final FuncMaxMpMul _fmmm_instance = new FuncMaxMpMul();
public static AbstractFunction getInstance()
{
return _fmmm_instance;
}
private FuncMaxMpMul()
{
super(Stats.MAX_MP, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.MEN.calcBonus(effector) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncMoveSpeed extends AbstractFunction
{
private static final FuncMoveSpeed _fms_instance = new FuncMoveSpeed();
public static AbstractFunction getInstance()
{
return _fms_instance;
}
private FuncMoveSpeed()
{
super(Stats.MOVE_SPEED, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.DEX.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncPAtkMod extends AbstractFunction
{
private static final FuncPAtkMod _fpa_instance = new FuncPAtkMod();
public static AbstractFunction getInstance()
{
return _fpa_instance;
}
private FuncPAtkMod()
{
super(Stats.POWER_ATTACK, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.STR.calcBonus(effector) * effector.getLevelMod() * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncPAtkSpeed extends AbstractFunction
{
private static final FuncPAtkSpeed _fas_instance = new FuncPAtkSpeed();
public static AbstractFunction getInstance()
{
return _fas_instance;
}
private FuncPAtkSpeed()
{
super(Stats.POWER_ATTACK_SPEED, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
return initVal * BaseStats.DEX.calcBonus(effector) * BaseStats.CHA.calcBonus(effector);
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.stats.functions.formulas;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.functions.AbstractFunction;
/**
* @author UnAfraid
*/
public class FuncPDefMod extends AbstractFunction
{
private static final FuncPDefMod _fmm_instance = new FuncPDefMod();
public static AbstractFunction getInstance()
{
return _fmm_instance;
}
private FuncPDefMod()
{
super(Stats.POWER_DEFENCE, 1, null, 0, null);
}
@Override
public double calc(L2Character effector, L2Character effected, Skill skill, double initVal)
{
double value = initVal;
if (effector.isPlayer())
{
final L2PcInstance p = effector.getActingPlayer();
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_CHEST))
{
value -= p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_CHEST) : p.getTemplate().getBaseDefBySlot(Inventory.PAPERDOLL_CHEST);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_LEGS) || (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_CHEST) && (p.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_LEGS) : Inventory.PAPERDOLL_LEGS);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_HEAD))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_HEAD) : Inventory.PAPERDOLL_HEAD);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_FEET))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_FEET) : Inventory.PAPERDOLL_FEET);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_GLOVES))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_GLOVES) : Inventory.PAPERDOLL_GLOVES);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_UNDER))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_UNDER) : Inventory.PAPERDOLL_UNDER);
}
if (!p.getInventory().isPaperdollSlotEmpty(Inventory.PAPERDOLL_CLOAK))
{
value -= p.getTemplate().getBaseDefBySlot(p.isTransformed() ? p.getTransformation().getBaseDefBySlot(p, Inventory.PAPERDOLL_CLOAK) : Inventory.PAPERDOLL_CLOAK);
}
value *= BaseStats.CHA.calcBonus(p);
}
return value * effector.getLevelMod();
}
}