CrimsonHatuOtis.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.individual;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.holders.SkillHolder;
  24. import com.l2jserver.gameserver.network.NpcStringId;
  25. import com.l2jserver.gameserver.network.clientpackets.Say2;
  26. /**
  27. * AI for Kamaloka (33) - Crimson Hatu Otis
  28. * @author Gladicek
  29. */
  30. public final class CrimsonHatuOtis extends AbstractNpcAI
  31. {
  32. // Npc
  33. private static final int CRIMSON_HATU_OTIS = 18558;
  34. // Skills
  35. private static SkillHolder BOSS_SPINING_SLASH = new SkillHolder(4737, 1);
  36. private static SkillHolder BOSS_HASTE = new SkillHolder(4175, 1);
  37. private CrimsonHatuOtis()
  38. {
  39. super(CrimsonHatuOtis.class.getSimpleName(), "ai/individual");
  40. addAttackId(CRIMSON_HATU_OTIS);
  41. addKillId(CRIMSON_HATU_OTIS);
  42. }
  43. @Override
  44. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  45. {
  46. switch (event)
  47. {
  48. case "SKILL":
  49. {
  50. if (npc.isDead())
  51. {
  52. cancelQuestTimer("SKILL", npc, null);
  53. return null;
  54. }
  55. npc.setTarget(player);
  56. npc.doCast(BOSS_SPINING_SLASH.getSkill());
  57. startQuestTimer("SKILL", 60000, npc, null);
  58. break;
  59. }
  60. case "BUFF":
  61. {
  62. if (npc.isScriptValue(2))
  63. {
  64. npc.setTarget(npc);
  65. npc.doCast(BOSS_HASTE.getSkill());
  66. }
  67. break;
  68. }
  69. }
  70. return super.onAdvEvent(event, npc, player);
  71. }
  72. @Override
  73. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  74. {
  75. if (npc.isScriptValue(0))
  76. {
  77. npc.setScriptValue(1);
  78. startQuestTimer("SKILL", 5000, npc, null);
  79. }
  80. else if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.3)))
  81. {
  82. broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.IVE_HAD_IT_UP_TO_HERE_WITH_YOU_ILL_TAKE_CARE_OF_YOU);
  83. npc.setScriptValue(2);
  84. startQuestTimer("BUFF", 1000, npc, null);
  85. }
  86. return super.onAttack(npc, attacker, damage, isSummon);
  87. }
  88. @Override
  89. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  90. {
  91. cancelQuestTimer("SKILL", npc, null);
  92. cancelQuestTimer("BUFF", npc, null);
  93. return super.onKill(npc, player, isSummon);
  94. }
  95. public static void main(String[] args)
  96. {
  97. new CrimsonHatuOtis();
  98. }
  99. }