Enchant bonus data rework.

This commit is contained in:
MobiusDev
2016-03-23 13:27:18 +00:00
parent 3576fb4454
commit a2b0e531ac
14 changed files with 372 additions and 13 deletions

View File

@ -148,6 +148,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
private final boolean _ex_immediate_effect;
private final int _defaultEnchantLevel;
private final ActionType _defaultAction;
private final boolean _isBlessedItem;
protected int _type1; // needed for item list (inventory)
protected int _type2; // different lists for armor, weapon, etc
@ -208,6 +209,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_ex_immediate_effect = set.getBoolean("ex_immediate_effect", false);
_defaultAction = set.getEnum("default_action", ActionType.class, ActionType.NONE);
_isBlessedItem = set.getBoolean("isBlessedItem", false);
_useSkillDisTime = set.getInt("useSkillDisTime", 0);
_defaultEnchantLevel = set.getInt("enchanted", 0);
_reuseDelay = set.getInt("reuse_delay", 0);
@ -996,6 +998,14 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
return _defaultAction;
}
/**
* @return {@code true} else item it is blessed (example: ID: 18084)
*/
public boolean isBlessedItem()
{
return _isBlessedItem;
}
public int useSkillDisTime()
{
return _useSkillDisTime;

View File

@ -2141,6 +2141,11 @@ public final class L2ItemInstance extends L2Object
}
}
public boolean isBlessedItem()
{
return getItem().isBlessedItem();
}
@Override
public boolean isItem()
{

View File

@ -0,0 +1,59 @@
/*
* 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.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public class FuncEnchantAccEvas extends AbstractFunction
{
private static final double blessedBonus = 1.5;
public FuncEnchantAccEvas(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();
if (item.getEnchantLevel() > 3)
{
// Increases Phys.Evasion / Mag. Evasion for helmets
// Increases Phys.Accuracy / Mag.Accuracy for gloves
if (item.getEnchantLevel() == 4)
{
value += (0.2 * blessedBonus);
}
else
{
value += (0.2 * blessedBonus * ((item.getEnchantLevel() * 2) - 9));
}
}
return initVal;
}
}

View File

@ -16,7 +16,7 @@
*/
package com.l2jmobius.gameserver.model.stats.functions;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.conditions.Condition;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@ -44,7 +44,7 @@ public class FuncEnchantHp extends AbstractFunction
final L2ItemInstance item = (L2ItemInstance) getFuncOwner();
if (item.getEnchantLevel() > 0)
{
return initVal + EnchantItemHPBonusData.getInstance().getHPBonus(item);
return initVal + EnchantItemBonusData.getInstance().getHPBonus(item);
}
return initVal;
}

View File

@ -0,0 +1,58 @@
/*
* 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.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public class FuncEnchantMAtk extends AbstractFunction
{
private static final double blessedBonus = 1.5;
public FuncEnchantMAtk(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();
if (item.getEnchantLevel() > 3)
{
// Increases Mag. Atk for chest
if (item.getEnchantLevel() == 4)
{
value += (1.4 * blessedBonus);
}
else
{
value += (1.4 * blessedBonus * ((item.getEnchantLevel() * 2) - 9));
}
}
return initVal;
}
}

View File

@ -0,0 +1,58 @@
/*
* 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.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public class FuncEnchantPAtk extends AbstractFunction
{
private static final double blessedBonus = 1.5;
public FuncEnchantPAtk(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();
if (item.getEnchantLevel() > 3)
{
// Increases Phys.Atk for chest
if (item.getEnchantLevel() == 4)
{
value += (2 * blessedBonus);
}
else
{
value += (2 * blessedBonus * ((item.getEnchantLevel() * 2) - 9));
}
}
return initVal;
}
}

View File

@ -0,0 +1,58 @@
/*
* 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.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public class FuncEnchantPMCritRate extends AbstractFunction
{
private static final double blessedBonus = 1.5;
public FuncEnchantPMCritRate(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();
if (item.getEnchantLevel() > 3)
{
// Increases P. Critical Rate / magic damage for legs
if (item.getEnchantLevel() == 4)
{
value += (0.34 * blessedBonus);
}
else
{
value += (0.34 * blessedBonus * ((item.getEnchantLevel() * 2) - 9));
}
}
return initVal;
}
}

View File

@ -0,0 +1,58 @@
/*
* 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.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
public abstract class FuncEnchantRunSpd extends AbstractFunction
{
private static final double blessedBonus = 1.5;
public FuncEnchantRunSpd(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();
if (item.getEnchantLevel() > 3)
{
// Increases speed for feets
if (item.getEnchantLevel() == 4)
{
value += (0.6 * blessedBonus);
}
else
{
value += (0.6 * blessedBonus * ((item.getEnchantLevel() * 2) - 9));
}
}
return initVal;
}
}