CombatPointHeal.java 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.model.L2Skill.SkillType;
  22. import net.sf.l2j.gameserver.network.SystemMessageId;
  23. import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
  24. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  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 Logger _log = Logger.getLogger(CombatPointHeal.class.getName());
  33. /* (non-Javadoc)
  34. * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
  35. */
  36. private static final SkillType[] SKILL_IDS = {SkillType.COMBATPOINTHEAL};
  37. /* (non-Javadoc)
  38. * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
  39. */
  40. public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
  41. {
  42. // L2Character activeChar = actChar;
  43. //check for other effects
  44. try {
  45. ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(SkillType.BUFF);
  46. if (handler != null)
  47. handler.useSkill(actChar, skill, targets);
  48. }
  49. catch (Exception e) {}
  50. L2Character target = null;
  51. for(int index = 0;index < targets.length;index++)
  52. {
  53. target = (L2Character)targets[index];
  54. double cp = skill.getPower();
  55. //int cLev = activeChar.getLevel();
  56. //hp += skill.getPower()/*+(Math.sqrt(cLev)*cLev)+cLev*/;
  57. SystemMessage sm = new SystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
  58. sm.addNumber((int)cp);
  59. target.sendPacket(sm);
  60. target.setCurrentCp(cp+target.getCurrentCp());
  61. StatusUpdate sump = new StatusUpdate(target.getObjectId());
  62. sump.addAttribute(StatusUpdate.CUR_CP, (int)target.getCurrentCp());
  63. target.sendPacket(sump);
  64. }
  65. }
  66. public SkillType[] getSkillIds()
  67. {
  68. return SKILL_IDS;
  69. }
  70. }