Allex 155 Опубликовано 27 сентября, 2016 Как убрать рестор рб, исходники lucera Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
masone 298 Опубликовано 27 сентября, 2016 (изменено) сделать запрет package ru.catssoftware.gameserver.handler.skillhandlers; import ru.catssoftware.Config; import ru.catssoftware.gameserver.handler.ISkillHandler; import ru.catssoftware.gameserver.handler.SkillHandler; import ru.catssoftware.gameserver.model.L2Boss; import ru.catssoftware.gameserver.model.L2Character; import ru.catssoftware.gameserver.model.L2ItemInstance; import ru.catssoftware.gameserver.model.L2Skill; import ru.catssoftware.gameserver.model.L2Summon; import ru.catssoftware.gameserver.model.actor.instance.L2DoorInstance; import ru.catssoftware.gameserver.model.actor.instance.L2GuardInstance; import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2SiegeFlagInstance; import ru.catssoftware.gameserver.network.SystemMessageId; import ru.catssoftware.gameserver.network.serverpackets.StatusUpdate; import ru.catssoftware.gameserver.network.serverpackets.SystemMessage; import ru.catssoftware.gameserver.skills.Stats; import ru.catssoftware.gameserver.templates.skills.L2SkillType; public class Heal implements ISkillHandler { private static final L2SkillType[] SKILL_IDS = { L2SkillType.HEAL, L2SkillType.HEAL_PERCENT, L2SkillType.HEAL_STATIC, L2SkillType.HEAL_MOB }; private boolean isForbidToHeal(L2PcInstance player, L2Character target) { if (player == null) { return false; } if (target.hasCelestialBuff() || Math.abs(target.getZ() - player.getZ()) > 200) { return true; } if (target.isGrandBoss() { return true; } if (target.isRaid() && Config.NPC_PROTECTED_HEAL.contains(target.getNpcId())) { return true; } return false; } public void useSkill(L2Character activeChar, L2Skill skill, L2Character... targets) { if (activeChar == null) { return; } SkillHandler.getInstance().getSkillHandler(L2SkillType.BUFF).useSkill(activeChar, skill, targets); L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance(); L2PcInstance player = activeChar.getPlayer(); boolean consumeSoul = true; for (L2Character target : targets) { if (target == null) { continue; } //We should not heal if char is dead if (target.isDead() || isForbidToHeal(player, target)) { continue; } // Player holding a cursed weapon can't be healed and can't heal if (target != activeChar) { if (target instanceof L2PcInstance && ((L2PcInstance) target).isCursedWeaponEquipped()) { continue; } else if (player != null && player.isCursedWeaponEquipped()) { continue; } } if ((target instanceof L2Boss || target instanceof L2GuardInstance) && activeChar.getActingPlayer() != null) { activeChar.getActingPlayer().updatePvPStatus(); } double hp = skill.getPower(); if (skill.getSkillType() == L2SkillType.HEAL_PERCENT) { hp = target.getMaxHp() * hp / 100.0; } else if (skill.getSkillType() != L2SkillType.HEAL_STATIC) { if (weaponInst != null) { if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT) { hp *= 1.5; if (consumeSoul) { weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE); } consumeSoul = false; } else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT) { hp *= 1.3; if (consumeSoul) { weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE); } consumeSoul = false; } } else if (activeChar instanceof L2Summon) { L2Summon activeSummon = (L2Summon) activeChar; if (activeSummon != null) { if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT) { hp *= 1.5; if (consumeSoul) { activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE); } consumeSoul = false; } else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT) { hp *= 1.3; if (consumeSoul) { activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE); } consumeSoul = false; } } } else if (activeChar instanceof L2NpcInstance) { if (((L2NpcInstance) activeChar).isUsingShot(false)) { hp *= 1.5; } } } if (target instanceof L2DoorInstance || target instanceof L2SiegeFlagInstance) { hp = 0; } else { if (skill.getSkillType() == L2SkillType.HEAL_STATIC) { hp = skill.getPower(); } else if (skill.getSkillType() != L2SkillType.HEAL_PERCENT) { hp *= target.calcStat(Stats.HEAL_EFFECTIVNESS, 100, null, null) / 100; // Healer proficiency (since CT1) hp *= activeChar.calcStat(Stats.HEAL_PROFICIENCY, 100, null, null) / 100; // Extra bonus (since CT1.5) if (!skill.isPotion()) { hp += target.calcStat(Stats.HEAL_STATIC_BONUS, 0, null, null); } } } //from CT2 u will receive exact HP, u can't go over it, if u have full HP and u get HP buff, u will receive 0HP restored message if ((target.getStatus().getCurrentHp() + hp) >= target.getMaxHp()) { hp = target.getMaxHp() - target.getStatus().getCurrentHp(); } if (hp > 0) { if (target.getFirstEffect(1367) != null) { hp /= 2; } target.getStatus().increaseHp(hp); target.setLastHealAmount((int) hp); StatusUpdate su = new StatusUpdate(target.getObjectId()); su.addAttribute(StatusUpdate.CUR_HP, (int) target.getStatus().getCurrentHp()); target.sendPacket(su); if (target.getPvpFlag() > 0) { activeChar.updatePvPStatus(); } } if (target instanceof L2PcInstance) { if (skill.getId() == 4051) { //target.sendPacket(SystemMessageId.REJUVENATING_HP); SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_RESTORED); sm.addNumber((int) hp); target.sendPacket(sm); } else { if (activeChar instanceof L2PcInstance && activeChar != target) { SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_RESTORED_BY_S1); sm.addString(activeChar.getName()); sm.addNumber((int) hp); target.sendPacket(sm); } else { SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_RESTORED); sm.addNumber((int) hp); target.sendPacket(sm); } } } } } public L2SkillType[] getSkillIds() { return SKILL_IDS; } } Изменено 27 сентября, 2016 пользователем masone 1 Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты