Advertisement
Guest User

FrenzyOnAttack

a guest
Sep 25th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  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 ai.group_template;
  16.  
  17. import net.sf.l2j.gameserver.datatables.SkillTable;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  19. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  20. import net.sf.l2j.gameserver.model.quest.Quest;
  21. import net.sf.l2j.gameserver.serverpackets.CreatureSay;
  22. import net.sf.l2j.util.Rnd;
  23.  
  24. /**
  25. * Frenzy behavior on low health.
  26. * Few others monsters got that skillId too, need to check "retail C4" :
  27. * and remove npc_skills for those too.
  28. * Halisha's Officer
  29. * Executioner of Halisha
  30. * by Karakan for L2JLisvus
  31. */
  32. public class FrenzyOnAttack extends Quest
  33. {
  34. private static final int BREKA_ORC_OVERLORD = 270;
  35. private static final int TUREK_ORC_OVERLORD = 495;
  36. private static final int TIMAK_ORC_OVERLORD = 588;
  37. private static final int RAGNA_ORC_OVERLORD = 778;
  38. private static final int HAMES_ORC_OVERLORD = 1116;
  39. private static final int ALPEN_KOOKABURRA = 1468;
  40. private static final int ALPEN_KOOKABURRA2 = 1469;
  41. private static final int ALPEN_BUFFALO = 1487;
  42. private static final int ALPEN_BUFFALO2 = 1488;
  43. private static final int ALPEN_COUGAR = 1506;
  44. private static final int ALPEN_COUGAR2 = 1507;
  45. //private static final int HALISHAS_OFFICER = 12955;
  46. //private static final int HALISHAS_OFFICER2 = 12961;
  47. //private static final int HALISHAS_OFFICER3 = 12964;
  48. //private static final int EXECUTIONER_OF_HALISHA = 12993;
  49. //private static final int EXECUTIONER_OF_HALISHA2 = 12994;
  50. //private static final int EXECUTIONER_OF_HALISHA3 = 12995;
  51. //private static final int EXECUTIONER_OF_HALISHA4 = 12996;
  52. //private static final int EXECUTIONER_OF_HALISHA5 = 12997;
  53. //private static final int EXECUTIONER_OF_HALISHA6 = 12998;
  54. //private static final int EXECUTIONER_OF_HALISHA7 = 12999;
  55. //private static final int EXECUTIONER_OF_HALISHA8 = 13000;
  56.  
  57. private static final String[] ORCS_WORDS =
  58. {
  59. "Dear ultimate power!!!",
  60. "The battle has just begun!",
  61. "I never thought I'd use this against a novice!",
  62. "You won't take me down easily."
  63. };
  64.  
  65. public FrenzyOnAttack (int questId, String name, String descr)
  66. {
  67. super(questId, name, descr);
  68. int[] mobs =
  69. {
  70. BREKA_ORC_OVERLORD,
  71. TUREK_ORC_OVERLORD,
  72. TIMAK_ORC_OVERLORD,
  73. RAGNA_ORC_OVERLORD,
  74. HAMES_ORC_OVERLORD,
  75. ALPEN_KOOKABURRA,
  76. ALPEN_KOOKABURRA2,
  77. ALPEN_BUFFALO,
  78. ALPEN_BUFFALO2,
  79. ALPEN_COUGAR,
  80. ALPEN_COUGAR2
  81. // HALISHAS_OFFICER,
  82. // HALISHAS_OFFICER,
  83. // HALISHAS_OFFICER,
  84. // EXECUTIONER_OF_HALISHA,
  85. // EXECUTIONER_OF_HALISHA2,
  86. // EXECUTIONER_OF_HALISHA3,
  87. // EXECUTIONER_OF_HALISHA4,
  88. // EXECUTIONER_OF_HALISHA5,
  89. // EXECUTIONER_OF_HALISHA6,
  90. // EXECUTIONER_OF_HALISHA7,
  91. // EXECUTIONER_OF_HALISHA8
  92. };
  93. registerMobs(mobs);
  94. }
  95.  
  96. @Override
  97. public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
  98. {
  99. // The only requirements are HP < 25%.
  100. if (npc.getCurrentHp() / npc.getMaxHp() < 0.25 && Rnd.get(10) == 0)
  101. {
  102. npc.broadcastPacket(new CreatureSay(npc.getObjectId(),0,npc.getName(),(ORCS_WORDS[Rnd.get(ORCS_WORDS.length)])));
  103. npc.setTarget(npc);
  104. //ULTIMATE_BUFF
  105. npc.doCast(SkillTable.getInstance().getInfo(4318,1));
  106. }
  107. return super.onAttack(npc, attacker, damage, isPet);
  108. }
  109.  
  110. public static void main(String[] args)
  111. {
  112. // Quest class and state definition
  113. new FrenzyOnAttack(-1, "frenzyonattack", "ai/group_template");
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement