22.03.2011, 17:22
|
#5
|
Постоялец
Регистрация: 06.08.2009
Возраст: 33
Сообщений: 289
Отблагодарили 34 раз(а)
Рейтинг мнений:
|
Re: Скил спойл
на л2ж хуже, там нету розщета по лвлам для спойла, споил ито как маг скил, и штраф по лвлам как у маг скила
я нашел
Свернуть ↑
Код:
/*
* 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.skillhandlers;
import l2.universe.Config;
import l2.universe.gameserver.ai.CtrlEvent;
import l2.universe.gameserver.handler.ISkillHandler;
import l2.universe.gameserver.model.L2Object;
import l2.universe.gameserver.model.L2Skill;
import l2.universe.gameserver.model.actor.L2Character;
import l2.universe.gameserver.model.actor.instance.L2MonsterInstance;
import l2.universe.gameserver.model.actor.instance.L2PcInstance;
import l2.universe.gameserver.network.SystemMessageId;
import l2.universe.gameserver.network.serverpackets.SystemMessage;
import l2.universe.gameserver.skills.Formulas;
import l2.universe.gameserver.templates.skills.L2SkillType;
/**
* @author _drunk_
*
*/
public class Spoil implements ISkillHandler
{
private static final L2SkillType[] SKILL_IDS =
{
L2SkillType.SPOIL
};
@Override
public void useSkill(final L2Character activeChar, final L2Skill skill, final L2Object[] targets)
{
if (!(activeChar instanceof L2PcInstance))
return;
if (targets == null)
return;
for (final L2Object tgt : targets)
{
if (!(tgt instanceof L2MonsterInstance))
continue;
final L2MonsterInstance target = (L2MonsterInstance) tgt;
if (target.isSpoil())
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_SPOILED));
continue;
}
// SPOIL SYSTEM by Lbaldi
boolean spoil = false;
if (target.isDead() == false)
{
spoil = Formulas.calcMagicSuccess(activeChar, (L2Character) tgt, skill);
if (spoil)
{
target.setSpoil(true);
target.setIsSpoiledBy(activeChar.getObjectId());
if (Config.SHOW_TO_PARTY_MEMBERS_SPOIL_SUCCESS && (activeChar.getParty() != null))
activeChar.getParty().broadcastToPartyMembers(SystemMessage.getSystemMessage(SystemMessageId.SPOIL_SUCCESS));
else
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SPOIL_SUCCESS));
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_RESISTED_YOUR_S2);
sm.addCharName(target);
sm.addSkillName(skill);
activeChar.sendPacket(sm);
}
target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, activeChar);
}
}
}
@Override
public L2SkillType[] getSkillIds()
{
return SKILL_IDS;
}
}
Свернуть ↑Развернуть ↓
но там нету системы сравнение лвлов
нашел ток в формулах...
Свернуть ↑
Код:
public static boolean calcMagicSuccess(L2Character attacker, L2Character target, L2Skill skill)
{
// DS: remove skill magic level dependence from nukes
//int lvlDifference = (target.getLevel() - (skill.getMagicLevel() > 0 ? skill.getMagicLevel() : attacker.getLevel()));
int lvlDifference = (target.getLevel() - (skill.getSkillType() == L2SkillType.SPOIL ? skill.getMagicLevel() : attacker.getLevel()));
double lvlModifier = Math.pow(1.3, lvlDifference);
float targetModifier = 1;
if (target instanceof L2Attackable && !target.isRaid() && !target.isRaidMinion()
&& target.getLevel() >= Config.MIN_NPC_LVL_MAGIC_PENALTY && attacker.getActingPlayer() != null
&& (target.getLevel() - attacker.getActingPlayer().getLevel()) >= 3)
{
int lvlDiff = target.getLevel() - attacker.getActingPlayer().getLevel() - 2;
if (lvlDiff > Config.NPC_SKILL_CHANCE_PENALTY.size())
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(Config.NPC_SKILL_CHANCE_PENALTY.size());
else
targetModifier = Config.NPC_SKILL_CHANCE_PENALTY.get(lvlDiff);
}
// general magic resist
final double resModifier = target.calcStat(Stats.MAGIC_SUCCESS_RES, 1, null, skill);
final double failureModifier = attacker.calcStat(Stats.MAGIC_FAILURE_RATE, 1, target, skill);
int rate = 100 - Math.round((float)(lvlModifier * targetModifier * resModifier * failureModifier));
if (rate > skill.getMaxChance())
rate = skill.getMaxChance();
else if (rate < skill.getMinChance())
rate = skill.getMinChance();
if (attacker.isDebug() || Config.DEVELOPER)
{
final StringBuilder stat = new StringBuilder(100);
StringUtil.append(stat,
skill.getName(),
" lvlDiff:", String.valueOf(lvlDifference),
" lvlMod:", String.format("%1.2f", lvlModifier),
" res:", String.format("%1.2f", resModifier),
" fail:", String.format("%1.2f", failureModifier),
" tgt:", String.valueOf(targetModifier),
" total:", String.valueOf(rate)
);
final String result = stat.toString();
if (attacker.isDebug())
attacker.sendDebugMessage(result);
if (Config.DEVELOPER)
_log.info(result);
}
return (Rnd.get(100) < rate);
}
Свернуть ↑Развернуть ↓
|
|
|