{
activeChar.sendPacket(Msg.ALREADY_SPOILED);
}
else
{
L2MonsterInstance monster = (L2MonsterInstance) target;
boolean success;
if(!Config.ALT_SPOIL_FORMULA)
{
int monsterLevel = monster.getLevel();
int modifier = Math.abs(monsterLevel - activeChar.getLevel());
double rateOfSpoil = Config.BASE_SPOIL_RATE;
if(modifier > 8)
{
rateOfSpoil = rateOfSpoil - rateOfSpoil * (modifier - 8) * 9 / 100;
}
rateOfSpoil = rateOfSpoil * getMagicLevel() / monsterLevel;
if(rateOfSpoil < Config.MINIMUM_SPOIL_RATE)
{
rateOfSpoil = Config.MINIMUM_SPOIL_RATE;
}
else if(rateOfSpoil > 99.)
{
rateOfSpoil = 99.;
}
activeChar.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Spoil.Chance", activeChar).addNumber((long) rateOfSpoil));
success = Rnd.chance(rateOfSpoil);
}
else
{
success = Formulas.calcSkillSuccess(activeChar, target, this, getActivateRate());
}
if(success)
{
monster.setSpoiled(true, (L2Player) activeChar);
activeChar.sendPacket(Msg.THE_SPOIL_CONDITION_HAS_BEEN_ACTIVATED);
}
else
{
activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_FAILED).addSkillName(_id, getDisplayLevel()));