Addition of StatAddForStat effect handler.

This commit is contained in:
MobiusDevelopment 2022-02-20 23:27:42 +00:00
parent a33f0f4064
commit 1ee51ad6c2
6 changed files with 122 additions and 0 deletions

View File

@ -348,6 +348,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
EffectHandler.getInstance().registerHandler("StatAddForStat", StatAddForStat::new);
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);

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 handlers.effecthandlers;
import org.l2jmobius.gameserver.enums.StatModifierType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.model.stats.Stat;
/**
* @author Mobius
*/
public class StatAddForStat extends AbstractEffect
{
private final Stat _statCheck;
private final int _min;
private final int _max;
private final Stat _stat;
private final double _amount;
public StatAddForStat(StatSet params)
{
_statCheck = params.getEnum("stat", Stat.class);
_min = params.getInt("min", 0);
_max = params.getInt("max", 2147483647);
_stat = params.getEnum("addStat", Stat.class);
_amount = params.getDouble("amount", 0);
if (params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF) != StatModifierType.DIFF)
{
LOGGER.warning(getClass().getSimpleName() + " can only use DIFF mode.");
}
}
@Override
public void pump(Creature effected, Skill skill)
{
final int currentValue = (int) effected.getStat().getValue(_statCheck);
if ((currentValue >= _min) && (currentValue <= _max))
{
effected.getStat().mergeAdd(_stat, _amount);
}
}
}

View File

@ -315,6 +315,7 @@ SpModify: Bonus SP stat.
Spoil: Spoils a mob activating its extra sweep drop.
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
StatAddForStat: Adds a fixed amount of a Stat based on player current value. (l2jmobius)
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
StatByMoveType: Adds stat based on your movement type (standing, running, walking).

View File

@ -347,6 +347,7 @@ public class EffectMasterHandler
EffectHandler.getInstance().registerHandler("Spoil", Spoil::new);
EffectHandler.getInstance().registerHandler("StatAddForLevel", StatAddForLevel::new);
EffectHandler.getInstance().registerHandler("StatAddForMp", StatAddForMp::new);
EffectHandler.getInstance().registerHandler("StatAddForStat", StatAddForStat::new);
EffectHandler.getInstance().registerHandler("StatBonusSkillCritical", StatBonusSkillCritical::new);
EffectHandler.getInstance().registerHandler("StatBonusSpeed", StatBonusSpeed::new);
EffectHandler.getInstance().registerHandler("StatByMoveType", StatByMoveType::new);

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 handlers.effecthandlers;
import org.l2jmobius.gameserver.enums.StatModifierType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.model.stats.Stat;
/**
* @author Mobius
*/
public class StatAddForStat extends AbstractEffect
{
private final Stat _statCheck;
private final int _min;
private final int _max;
private final Stat _stat;
private final double _amount;
public StatAddForStat(StatSet params)
{
_statCheck = params.getEnum("stat", Stat.class);
_min = params.getInt("min", 0);
_max = params.getInt("max", 2147483647);
_stat = params.getEnum("addStat", Stat.class);
_amount = params.getDouble("amount", 0);
if (params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF) != StatModifierType.DIFF)
{
LOGGER.warning(getClass().getSimpleName() + " can only use DIFF mode.");
}
}
@Override
public void pump(Creature effected, Skill skill)
{
final int currentValue = (int) effected.getStat().getValue(_statCheck);
if ((currentValue >= _min) && (currentValue <= _max))
{
effected.getStat().mergeAdd(_stat, _amount);
}
}
}

View File

@ -314,6 +314,7 @@ SpModify: Bonus SP stat.
Spoil: Spoils a mob activating its extra sweep drop.
StatAddForLevel: Adds a fixed amount of a Stat for a specific player level. (l2jmobius)
StatAddForMp: Adds a fixed amount of a Stat for when player max MP is over a value. (l2jmobius)
StatAddForStat: Adds a fixed amount of a Stat based on player current value. (l2jmobius)
StatBonusSkillCritical: Changes skill critical rate to depend on the specified base stat.
StatBonusSpeed: Changes Speed stat to depend on the specified base stat.
StatByMoveType: Adds stat based on your movement type (standing, running, walking).