Project update.
This commit is contained in:
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user