FrozenLabyrinth.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.skills.Skill;
  24. /**
  25. * Frozen Labyrinth AI.
  26. * @author malyelfik
  27. */
  28. public final class FrozenLabyrinth extends AbstractNpcAI
  29. {
  30. // Monsters
  31. private static final int PRONGHORN_SPIRIT = 22087;
  32. private static final int PRONGHORN = 22088;
  33. private static final int LOST_BUFFALO = 22093;
  34. private static final int FROST_BUFFALO = 22094;
  35. private FrozenLabyrinth()
  36. {
  37. super(FrozenLabyrinth.class.getSimpleName(), "ai/group_template");
  38. addAttackId(PRONGHORN, FROST_BUFFALO);
  39. }
  40. @Override
  41. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill)
  42. {
  43. if (npc.isScriptValue(0) && (skill != null) && !skill.isMagic())
  44. {
  45. final int spawnId = (npc.getId() == PRONGHORN) ? PRONGHORN_SPIRIT : LOST_BUFFALO;
  46. int diff = 0;
  47. for (int i = 0; i < 6; i++)
  48. {
  49. final int x = diff < 60 ? npc.getX() + diff : npc.getX();
  50. final int y = diff >= 60 ? npc.getY() + (diff - 40) : npc.getY();
  51. final L2Npc monster = addSpawn(spawnId, x, y, npc.getZ(), npc.getHeading(), false, 0);
  52. addAttackPlayerDesire(monster, attacker);
  53. diff += 20;
  54. }
  55. npc.setScriptValue(1);
  56. npc.deleteMe();
  57. }
  58. return super.onAttack(npc, attacker, damage, isSummon, skill);
  59. }
  60. public static void main(String[] args)
  61. {
  62. new FrozenLabyrinth();
  63. }
  64. }