NecromancerValley.java 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2004-2013 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.ai.CtrlIntention;
  22. import com.l2jserver.gameserver.model.actor.L2Attackable;
  23. import com.l2jserver.gameserver.model.actor.L2Character;
  24. import com.l2jserver.gameserver.model.actor.L2Npc;
  25. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. import com.l2jserver.util.Rnd;
  27. /**
  28. * Necromancer of the Valley AI.
  29. * @author Micr0, improved by Adry_85
  30. */
  31. public class NecromancerValley extends AbstractNpcAI
  32. {
  33. private static final int NECROMANCER = 22858;
  34. private static final int EXPLODING_ORC_GHOST = 22818;
  35. private static final int WRATHFUL_ORC_GHOST = 22819;
  36. private NecromancerValley(String name, String descr)
  37. {
  38. super(name, descr);
  39. addAttackId(NECROMANCER);
  40. addKillId(NECROMANCER);
  41. }
  42. @Override
  43. public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  44. {
  45. if (Rnd.get(100) < 20)
  46. {
  47. L2Character attacker = isPet ? killer.getSummon() : killer;
  48. L2Attackable Orc = (L2Attackable) addSpawn(EXPLODING_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true);
  49. Orc.setRunning();
  50. Orc.addDamageHate(attacker, 0, 600);
  51. Orc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
  52. L2Attackable Ork2 = (L2Attackable) addSpawn(WRATHFUL_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ() + 20, npc.getHeading(), false, 0, false);
  53. Ork2.setRunning();
  54. Ork2.addDamageHate(attacker, 0, 600);
  55. Ork2.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
  56. }
  57. return super.onKill(npc, killer, isPet);
  58. }
  59. @Override
  60. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  61. {
  62. if (Rnd.get(100) < 1)
  63. {
  64. L2Character player = isPet ? attacker.getSummon() : attacker;
  65. L2Attackable Orc = (L2Attackable) addSpawn(EXPLODING_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true);
  66. Orc.setRunning();
  67. Orc.addDamageHate(player, 0, 600);
  68. Orc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
  69. L2Attackable Ork2 = (L2Attackable) addSpawn(WRATHFUL_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ() + 20, npc.getHeading(), false, 0, false);
  70. Ork2.setRunning();
  71. Ork2.addDamageHate(player, 0, 600);
  72. Ork2.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
  73. }
  74. return super.onAttack(npc, attacker, damage, isPet);
  75. }
  76. public static void main(String[] args)
  77. {
  78. new NecromancerValley(NecromancerValley.class.getSimpleName(), "ai");
  79. }
  80. }