Gladicek

CrimsonHatuOtis

Apr 13th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.91 KB | None | 0 0
  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.  
  21. import ai.npc.AbstractNpcAI;
  22.  
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.holders.SkillHolder;
  26. import com.l2jserver.gameserver.network.NpcStringId;
  27. import com.l2jserver.gameserver.network.clientpackets.Say2;
  28.  
  29. /**
  30.  * @author Gladicek
  31.  * AI for Kamaloka (33) RB
  32.  */
  33. public final class CrimsonHatuOtis extends AbstractNpcAI
  34. {
  35.     // Npc
  36.     private static final int CRIMSON_HATU_OTIS = 18558;
  37.     // Skills
  38.     private static SkillHolder BOSS_SPINING_SLASH = new SkillHolder(4737, 1);
  39.     private static SkillHolder BOSS_HASTE = new SkillHolder(4175, 1);
  40.    
  41.     private CrimsonHatuOtis(String name, String descr)
  42.     {
  43.         super(name, descr);
  44.         addAttackId(CRIMSON_HATU_OTIS);
  45.         addKillId(CRIMSON_HATU_OTIS);
  46.     }
  47.    
  48.     @Override
  49.     public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  50.     {
  51.         switch (event)
  52.         {
  53.             case "skill":
  54.                 if (npc.isScriptValue(1))
  55.                 {
  56.                     npc.setTarget(player);
  57.                     npc.doCast(BOSS_SPINING_SLASH.getSkill());
  58.                     startQuestTimer("skill", 30000, npc, null);
  59.                 }
  60.             case "buff":
  61.                 if (npc.isScriptValue(2))
  62.                 {
  63.                     npc.setTarget(npc);
  64.                     npc.doCast(BOSS_HASTE.getSkill());
  65.                     npc.setScriptValue(1);
  66.                 }
  67.                 break;
  68.         }
  69.         return null;
  70.     }
  71.    
  72.     @Override
  73.     public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  74.     {
  75.         if (npc.isScriptValue(0))
  76.         {
  77.             npc.setScriptValue(1);
  78.             startQuestTimer("skill", 1000, npc, null);
  79.         }
  80.         else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.3)) && npc.isScriptValue(1))
  81.         {
  82.             broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.IVE_HAD_IT_UP_TO_HERE_WITH_YOU_ILL_TAKE_CARE_OF_YOU);
  83.             npc.setScriptValue(2);
  84.             startQuestTimer("buff", 1000, npc, null);
  85.         }
  86.         return super.onAttack(npc, attacker, damage, isSummon);
  87.     }
  88.    
  89.     @Override
  90.     public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  91.     {
  92.         cancelQuestTimer("skill", npc, null);
  93.         return super.onKill(npc, player, isSummon);
  94.     }
  95.    
  96.     public static void main(String[] args)
  97.     {
  98.         new CrimsonHatuOtis(CrimsonHatuOtis.class.getSimpleName(), "ai");
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment