Replaced StatAddForStat with StatMulForBaseStat effect.

This commit is contained in:
MobiusDevelopment 2022-02-19 09:42:29 +00:00
parent b291b80284
commit c8da606619
6 changed files with 102 additions and 28 deletions

View File

@ -348,10 +348,10 @@ 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);
EffectHandler.getInstance().registerHandler("StatMulForBaseStat", StatMulForBaseStat::new);
EffectHandler.getInstance().registerHandler("StatMulForLevel", StatMulForLevel::new);
EffectHandler.getInstance().registerHandler("StatUp", StatUp::new);
EffectHandler.getInstance().registerHandler("StealAbnormal", StealAbnormal::new);

View File

@ -21,42 +21,84 @@ 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.BaseStat;
import org.l2jmobius.gameserver.model.stats.Stat;
/**
* @author Mobius
*/
public class StatAddForStat extends AbstractEffect
public class StatMulForBaseStat extends AbstractEffect
{
private final Stat _stat;
private final BaseStat _baseStat;
private final int _min;
private final int _max;
private final Stat _stat;
private final double _amount;
private final StatModifierType _mode;
public StatAddForStat(StatSet params)
public StatMulForBaseStat(StatSet params)
{
_stat = params.getEnum("stat", Stat.class);
_baseStat = params.getEnum("baseStat", BaseStat.class);
_min = params.getInt("min", 0);
_max = params.getInt("max", 0);
_stat = params.getEnum("stat", Stat.class);
_amount = params.getDouble("amount", 0);
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
if (params.getEnum("mode", StatModifierType.class, StatModifierType.PER) != StatModifierType.PER)
{
LOGGER.warning(getClass().getSimpleName() + " can only use PER mode.");
}
}
@Override
public void pump(Creature effected, Skill skill)
{
final int currentValue = (int) effected.getStat().getValue(_stat);
if ((currentValue >= _min) && (currentValue <= _max))
int currentValue = 0;
switch (_baseStat)
{
if (_mode == StatModifierType.DIFF)
case STR:
{
effected.getStat().mergeAdd(_stat, _amount);
currentValue = effected.getSTR();
break;
}
else // Add PER difference.
case INT:
{
effected.getStat().mergeAdd(_stat, (currentValue * ((_amount / 100) + 1)) - currentValue);
currentValue = effected.getINT();
break;
}
case DEX:
{
currentValue = effected.getDEX();
break;
}
case WIT:
{
currentValue = effected.getWIT();
break;
}
case CON:
{
currentValue = effected.getCON();
break;
}
case MEN:
{
currentValue = effected.getMEN();
break;
}
case CHA:
{
currentValue = effected.getCHA();
break;
}
case LUC:
{
currentValue = effected.getLUC();
break;
}
}
if (((_min == 0) && (_max == 0)) || ((currentValue >= _min) && (currentValue <= _max)))
{
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
}
}
}

View File

@ -315,10 +315,10 @@ 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 range. (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).
StatMulForBaseStat: Multiplies a Stat based on player current BaseStat value. (l2jmobius)
StatMulForLevel: Multiplies a fixed amount of a Stat for a specific player level. (l2jmobius)
StatUp: Increases the specified base stat.
StealAbnormal: Steals enemy's buffs.

View File

@ -347,10 +347,10 @@ 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);
EffectHandler.getInstance().registerHandler("StatMulForBaseStat", StatMulForBaseStat::new);
EffectHandler.getInstance().registerHandler("StatMulForLevel", StatMulForLevel::new);
EffectHandler.getInstance().registerHandler("StatUp", StatUp::new);
EffectHandler.getInstance().registerHandler("StealAbnormal", StealAbnormal::new);

View File

@ -21,42 +21,74 @@ 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.BaseStat;
import org.l2jmobius.gameserver.model.stats.Stat;
/**
* @author Mobius
*/
public class StatAddForStat extends AbstractEffect
public class StatMulForBaseStat extends AbstractEffect
{
private final Stat _stat;
private final BaseStat _baseStat;
private final int _min;
private final int _max;
private final Stat _stat;
private final double _amount;
private final StatModifierType _mode;
public StatAddForStat(StatSet params)
public StatMulForBaseStat(StatSet params)
{
_stat = params.getEnum("stat", Stat.class);
_baseStat = params.getEnum("baseStat", BaseStat.class);
_min = params.getInt("min", 0);
_max = params.getInt("max", 0);
_stat = params.getEnum("stat", Stat.class);
_amount = params.getDouble("amount", 0);
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
if (params.getEnum("mode", StatModifierType.class, StatModifierType.PER) != StatModifierType.PER)
{
LOGGER.warning(getClass().getSimpleName() + " can only use PER mode.");
}
}
@Override
public void pump(Creature effected, Skill skill)
{
final int currentValue = (int) effected.getStat().getValue(_stat);
if ((currentValue >= _min) && (currentValue <= _max))
int currentValue = 0;
switch (_baseStat)
{
if (_mode == StatModifierType.DIFF)
case STR:
{
effected.getStat().mergeAdd(_stat, _amount);
currentValue = effected.getSTR();
break;
}
else // Add PER difference.
case INT:
{
effected.getStat().mergeAdd(_stat, (currentValue * ((_amount / 100) + 1)) - currentValue);
currentValue = effected.getINT();
break;
}
case DEX:
{
currentValue = effected.getDEX();
break;
}
case WIT:
{
currentValue = effected.getWIT();
break;
}
case CON:
{
currentValue = effected.getCON();
break;
}
case MEN:
{
currentValue = effected.getMEN();
break;
}
}
if (((_min == 0) && (_max == 0)) || ((currentValue >= _min) && (currentValue <= _max)))
{
effected.getStat().mergeMul(_stat, (_amount / 100) + 1);
}
}
}

View File

@ -314,10 +314,10 @@ 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 range. (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).
StatMulForBaseStat: Multiplies a Stat based on player current BaseStat value. (l2jmobius)
StatMulForLevel: Multiplies a fixed amount of a Stat for a specific player level. (l2jmobius)
StatUp: Increases the specified base stat.
StealAbnormal: Steals enemy's buffs.