Spoil success calculation by level.
This commit is contained in:
parent
a7f367e4cd
commit
b898bfd655
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@ -23,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,22 @@ public final class Spoil extends AbstractEffect
|
||||
@Override
|
||||
public boolean calcSuccess(L2Character effector, L2Character effected, Skill skill)
|
||||
{
|
||||
return Formulas.calcMagicSuccess(effector, effected, skill);
|
||||
final int lvlDifference = (effected.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : effector.getLevel()));
|
||||
final double lvlModifier = Math.pow(1.3, lvlDifference);
|
||||
float targetModifier = 1;
|
||||
if (effected.isAttackable() && !effected.isRaid() && !effected.isRaidMinion() && (effected.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY) && (effector.getActingPlayer() != null) && ((effected.getLevel() - effector.getActingPlayer().getLevel()) >= 3))
|
||||
{
|
||||
final int lvlDiff = effected.getLevel() - effector.getActingPlayer().getLevel() - 2;
|
||||
if (lvlDiff >= Config.NPC_SKILL_CHANCE_PENALTY.size())
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
|
||||
}
|
||||
}
|
||||
return Rnd.get(100) < (100 - Math.round((float) (lvlModifier * targetModifier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user