PolymorphingAngel.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. import java.util.Map;
  17. import javolution.util.FastMap;
  18. import com.l2jserver.gameserver.model.actor.L2Attackable;
  19. import com.l2jserver.gameserver.model.actor.L2Npc;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. *
  23. * Angel spawns...when one of the angels in the keys dies, the other angel will spawn.
  24. *
  25. */
  26. public class PolymorphingAngel extends L2AttackableAIScript
  27. {
  28. private static final Map<Integer,Integer> ANGELSPAWNS = new FastMap<Integer,Integer>();
  29. static
  30. {
  31. ANGELSPAWNS.put(20830,20859);
  32. ANGELSPAWNS.put(21067,21068);
  33. ANGELSPAWNS.put(21062,21063);
  34. ANGELSPAWNS.put(20831,20860);
  35. ANGELSPAWNS.put(21070,21071);
  36. }
  37. public PolymorphingAngel(int questId, String name, String descr)
  38. {
  39. super(questId, name, descr);
  40. int[] temp = {20830,21067,21062,20831,21070};
  41. this.registerMobs(temp, QuestEventType.ON_KILL);
  42. }
  43. @Override
  44. public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)
  45. {
  46. int npcId = npc.getNpcId();
  47. if (ANGELSPAWNS.containsKey(npcId))
  48. {
  49. L2Attackable newNpc = (L2Attackable) this.addSpawn(ANGELSPAWNS.get(npcId),npc);
  50. newNpc.setRunning();
  51. }
  52. return super.onKill(npc,killer,isPet);
  53. }
  54. public static void main(String[] args)
  55. {
  56. // now call the constructor (starts up the ai)
  57. new PolymorphingAngel(-1,"polymorphing_angel","ai");
  58. }
  59. }