Remnants.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package ai.group_template;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.L2Object;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.skills.Skill;
  25. /**
  26. * Remnants AI.
  27. * @author DS
  28. */
  29. public final class Remnants extends AbstractNpcAI
  30. {
  31. private static final int[] NPCS =
  32. {
  33. 18463,
  34. 18464,
  35. 18465
  36. };
  37. private static final int SKILL_HOLY_WATER = 2358;
  38. // TODO: Find retail strings.
  39. // private static final String MSG = "The holy water affects Remnants Ghost. You have freed his soul.";
  40. // private static final String MSG_DEREK = "The holy water affects Derek. You have freed his soul.";
  41. private Remnants()
  42. {
  43. super(Remnants.class.getSimpleName(), "ai/group_template");
  44. addSpawnId(NPCS);
  45. addSkillSeeId(NPCS);
  46. // Do not override onKill for Derek here. Let's make global Hellbound manipulations in Engine where it is possible.
  47. }
  48. @Override
  49. public final String onSpawn(L2Npc npc)
  50. {
  51. npc.setIsMortal(false);
  52. return super.onSpawn(npc);
  53. }
  54. @Override
  55. public final String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
  56. {
  57. if (skill.getId() == SKILL_HOLY_WATER)
  58. {
  59. if (!npc.isDead())
  60. {
  61. if ((targets.length > 0) && (targets[0] == npc))
  62. {
  63. if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) // Lower, than 2%
  64. {
  65. npc.doDie(caster);
  66. //@formatter:off
  67. /*if (npc.getNpcId() == DEREK)
  68. {
  69. caster.sendMessage(MSG_DEREK);
  70. }
  71. else
  72. {
  73. caster.sendMessage(MSG);
  74. }*/
  75. //@formatter:on
  76. }
  77. }
  78. }
  79. }
  80. return super.onSkillSee(npc, caster, skill, targets, isSummon);
  81. }
  82. public static void main(String[] args)
  83. {
  84. new Remnants();
  85. }
  86. }