CrimsonHatuOtis.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2004-2014 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. if (npc.isDead())
  50. {
  51. cancelQuestTimer("skill", npc, null);
  52. return null;
  53. }
  54. npc.setTarget(player);
  55. npc.doCast(BOSS_SPINING_SLASH.getSkill());
  56. startQuestTimer("skill", 60000, npc, null);
  57. break;
  58. case "buff":
  59. if (npc.isScriptValue(2))
  60. {
  61. npc.setTarget(npc);
  62. npc.doCast(BOSS_HASTE.getSkill());
  63. }
  64. break;
  65. }
  66. return null;
  67. }
  68. @Override
  69. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  70. {
  71. if (npc.isScriptValue(0))
  72. {
  73. npc.setScriptValue(1);
  74. startQuestTimer("skill", 5000, npc, null);
  75. }
  76. else if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.3)))
  77. {
  78. broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.IVE_HAD_IT_UP_TO_HERE_WITH_YOU_ILL_TAKE_CARE_OF_YOU);
  79. npc.setScriptValue(2);
  80. startQuestTimer("buff", 1000, npc, null);
  81. }
  82. return super.onAttack(npc, attacker, damage, isSummon);
  83. }
  84. @Override
  85. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  86. {
  87. cancelQuestTimer("skill", npc, null);
  88. cancelQuestTimer("buff", npc, null);
  89. return super.onKill(npc, player, isSummon);
  90. }
  91. public static void main(String[] args)
  92. {
  93. new CrimsonHatuOtis();
  94. }
  95. }