PolymorphingAngel.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 java.util.HashMap;
  21. import java.util.Map;
  22. import ai.npc.AbstractNpcAI;
  23. import com.l2jserver.gameserver.model.actor.L2Attackable;
  24. import com.l2jserver.gameserver.model.actor.L2Npc;
  25. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. /**
  27. * Angel spawns...when one of the angels in the keys dies, the other angel will spawn.
  28. */
  29. public final class PolymorphingAngel extends AbstractNpcAI
  30. {
  31. private static final Map<Integer, Integer> ANGELSPAWNS = new HashMap<>();
  32. static
  33. {
  34. ANGELSPAWNS.put(20830, 20859);
  35. ANGELSPAWNS.put(21067, 21068);
  36. ANGELSPAWNS.put(21062, 21063);
  37. ANGELSPAWNS.put(20831, 20860);
  38. ANGELSPAWNS.put(21070, 21071);
  39. }
  40. private PolymorphingAngel()
  41. {
  42. super(PolymorphingAngel.class.getSimpleName(), "ai/group_template");
  43. addKillId(ANGELSPAWNS.keySet());
  44. }
  45. @Override
  46. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  47. {
  48. final L2Attackable newNpc = (L2Attackable) addSpawn(ANGELSPAWNS.get(npc.getId()), npc);
  49. newNpc.setRunning();
  50. return super.onKill(npc, killer, isSummon);
  51. }
  52. public static void main(String[] args)
  53. {
  54. new PolymorphingAngel();
  55. }
  56. }