CombatPointHeal.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.handler.skillhandlers;
  16. import net.sf.l2j.gameserver.handler.ISkillHandler;
  17. import net.sf.l2j.gameserver.handler.SkillHandler;
  18. import net.sf.l2j.gameserver.model.L2Character;
  19. import net.sf.l2j.gameserver.model.L2Object;
  20. import net.sf.l2j.gameserver.model.L2Skill;
  21. import net.sf.l2j.gameserver.network.SystemMessageId;
  22. import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
  23. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  24. import net.sf.l2j.gameserver.templates.L2SkillType;
  25. /**
  26. * This class ...
  27. *
  28. * @version $Revision: 1.1.2.2.2.1 $ $Date: 2005/03/02 15:38:36 $
  29. */
  30. public class CombatPointHeal implements ISkillHandler
  31. {
  32. private static final L2SkillType[] SKILL_IDS =
  33. {
  34. L2SkillType.COMBATPOINTHEAL
  35. };
  36. /**
  37. *
  38. * @see net.sf.l2j.gameserver.handler.ISkillHandler#useSkill(net.sf.l2j.gameserver.model.L2Character, net.sf.l2j.gameserver.model.L2Skill, net.sf.l2j.gameserver.model.L2Object[])
  39. */
  40. public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
  41. {
  42. //check for other effects
  43. try
  44. {
  45. ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(L2SkillType.BUFF);
  46. if (handler != null)
  47. handler.useSkill(actChar, skill, targets);
  48. }
  49. catch (Exception e)
  50. {
  51. }
  52. L2Character target = null;
  53. for (int index = 0; index < targets.length; index++)
  54. {
  55. target = (L2Character) targets[index];
  56. double cp = skill.getPower();
  57. //int cLev = activeChar.getLevel();
  58. //hp += skill.getPower()/*+(Math.sqrt(cLev)*cLev)+cLev*/;
  59. SystemMessage sm = new SystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
  60. sm.addNumber((int) cp);
  61. target.sendPacket(sm);
  62. target.setCurrentCp(cp + target.getCurrentCp());
  63. StatusUpdate sump = new StatusUpdate(target.getObjectId());
  64. sump.addAttribute(StatusUpdate.CUR_CP, (int) target.getCurrentCp());
  65. target.sendPacket(sump);
  66. }
  67. }
  68. public L2SkillType[] getSkillIds()
  69. {
  70. return SKILL_IDS;
  71. }
  72. }