Jump to content

[Share] PrimevalIsleAI (Sprignant)


MadΜax

Recommended Posts

Thanks to L2jHeaven Team!

 

PrimevalIsleAI

 

Index: /trunk/dist/game/data/scripts/ai/group_template/PrimevalIsle.java
===================================================================
--- /trunk/dist/game/data/scripts/ai/group_template/PrimevalIsle.java   (revision 91)
+++ /trunk/dist/game/data/scripts/ai/group_template/PrimevalIsle.java   (revision 91)
@@ -0,0 +1,182 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ai.group_template;
+
+import com.l2jserver.gameserver.ai.CtrlIntention;
+import com.l2jserver.gameserver.datatables.SkillTable;
+import com.l2jserver.gameserver.datatables.SpawnTable;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.L2Skill;
+import com.l2jserver.gameserver.model.L2Spawn;
+import com.l2jserver.gameserver.model.actor.L2Attackable;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.NpcSay;
+import com.l2jserver.gameserver.util.Util;
+
+import gnu.trove.map.hash.TIntObjectHashMap;
+
+
+/**
+* Primeval Isle AI.
+* Controls monster's behaviour.
+* Based on Sandro's part of code
+*
+* @author MadMax
+* @author corbin12
+* @author Sandro
+*/
+
+public class PrimevalIsle extends L2AttackableAIScript
+{
+       private static final int SPRIGNANT_ANESTHESIA = 18345;
+       private static final int SPRIGNANT_POISON =     18346;
+       private static final int TREX_1 =               22215;
+       private static final int TREX_2 =               22216;
+       private static final int TREX_3 =               22217;
+       private static final int ANCIENT_EGG =          18344;
+        
+       private final TIntObjectHashMap<int[]> SKILLS_HP = new TIntObjectHashMap<int[]>();
+        
+       public PrimevalIsle(int id, String name, String descr)
+       {
+                super(id, name, descr);
+           SKILLS_HP.put(3626, new int[] { 65, 100 });
+           SKILLS_HP.put(3627, new int[] { 25, 65 });
+           SKILLS_HP.put(3628, new int[] { 0, 25 });
+                addSkillSeeId(TREX_1);
+                addSkillSeeId(TREX_2);
+                addSkillSeeId(TREX_3);
+                addAggroRangeEnterId(TREX_1);
+                addAggroRangeEnterId(TREX_2);
+                addAggroRangeEnterId(TREX_3);
+           addAttackId(ANCIENT_EGG);
+          
+            int[] mob =
+            {
+                SPRIGNANT_ANESTHESIA, SPRIGNANT_POISON
+            };
+                
+                registerMobs(mob);
+                
+                for (L2Spawn npc : SpawnTable.getInstance().getSpawnTable())
+                {
+                       if (Util.contains(mob, npc.getNpcid()) && npc.getLastSpawn() != null)
+                                startQuestTimer("Skill", 5000, npc.getLastSpawn(), null);
+                }
+                
+                for (int i : mob)
+                        addSpawnId(i);
+        }
+        
+      @Override
+       public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isPet)
+       {
+         if (npc.getNpcId() == TREX_1 || npc.getNpcId() == TREX_2 || npc.getNpcId() == TREX_3)
+         {
+                 npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), "?"));
+                npc.setTarget(player);
+                npc.setIsRunning(true);
+                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
+         }
+             return super.onAggroRangeEnter(npc, player, isPet);
+       }
+        
+        @Override
+        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+        {
+                if (npc == null)
+                        return null;
+                
+                L2Attackable mob = null;
+                
+                if (npc instanceof L2Attackable)
+                        mob = (L2Attackable) npc;
+                
+                if (mob == null)
+                        return null;
+              
+                if (event.equalsIgnoreCase("Skill"))
+                {
+                       int npcId = npc.getNpcId();
+                       if (npcId == SPRIGNANT_ANESTHESIA)
+                        {
+                                npc.setTarget(npc);
+                                npc.doCast(SkillTable.getInstance().getInfo(5085, 1));
+                       }
+                       else if (npcId == SPRIGNANT_POISON)
+                       {
+                               npc.setTarget(npc);
+                               npc.doCast(SkillTable.getInstance().getInfo(5086, 1));
+                       }
+                       startQuestTimer("Skill", 15000, npc, null);
+               }
+               return null;
+       }
+      
+       @Override
+       public String onSkillSee(L2Npc npc, L2PcInstance player, L2Skill skill, L2Object[] targets, boolean isPet)
+       {
+      if (npc.getNpcId() == TREX_1 || npc.getNpcId() == TREX_2 || npc.getNpcId() == TREX_3)
+                {
+          boolean b = false;
+          for (final L2Object trg : targets)
+          {
+             if (trg == npc)
+                b = true;
+          }
+          if (!b)
+             return super.onSkillSee(npc, player, skill, targets, isPet);
+          
+          final int skillId = skill.getId();
+          if (skillId >= 3626 && skillId <= 3628)
+          {
+             final int trexHp = (int)npc.getCurrentHp();
+             final int trexMaxHp = npc.getMaxHp();
+             final int minHp = (SKILLS_HP.get(skillId))[0] * trexMaxHp / 100;
+             final int maxHp = (SKILLS_HP.get(skillId))[1] * trexMaxHp / 100;
+             if (trexHp < minHp || trexHp > maxHp)
+             {
+                npc.stopSkillEffects(skillId);
+                player.sendMessage("The conditions are not right to use this skill now.");
+             }
+          }
+          return super.onSkillSee(npc, player, skill, targets, isPet);
+       }
+         return null;
+       }
+        
+       @Override
+       public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet, L2Skill skill)
+       {
+           int npcId = npc.getNpcId();
+           if (npcId == ANCIENT_EGG)
+           {
+            player.setTarget(player);
+            player.doCast(SkillTable.getInstance().getInfo(5088, 1));
+          
+           }
+          return "";
+
+       }
+      
+       public String onSpawn(L2Npc npc)
+       {
+               startQuestTimer("Skill", 5000, npc, null);
+               return super.onSpawn(npc);
+       }
+      
+       public static void main(String[] args)
+       {
+               new PrimevalIsle(-1, "PrimevalIsle", "ai/group_template");
+       }
+}
Index: /trunk/dist/game/data/scripts.cfg
===================================================================
--- /trunk/dist/game/data/scripts.cfg   (revision 81)
+++ /trunk/dist/game/data/scripts.cfg   (revision 91)
@@ -30,4 +30,5 @@
ai/group_template/PolymorphingAngel.java
ai/group_template/PolymorphingOnAttack.java
+ai/group_template/PrimevalIsle.java
ai/group_template/PrisonGuards.java
ai/group_template/RandomSpawn.java
Index: /trunk/dist/game/data/stats/skills/05000-05099.xml
===================================================================
--- /trunk/dist/game/data/stats/skills/05000-05099.xml   (revision 72)
+++ /trunk/dist/game/data/stats/skills/05000-05099.xml   (revision 91)
@@ -1035,20 +1035,40 @@
    </skill>
    <skill id="5085" levels="1" name="Anesthesia">
-      <!-- Temporarily stunned and Immobilized. -->
-      <set name="target" val="TARGET_NONE" />
-      <set name="skillType" val="NOTDONE" />
-      <set name="operateType" val="OP_PASSIVE" />
-      <set name="hitTime" val="3300" />
-      <set name="saveVs" val="MEN" />
+      <!--  Temporarily stunned and immobilized. -->
+      <set name="mpConsume" val="23"/>
+      <set name="power" val="80"/>
+      <set name="target" val="TARGET_AURA"/>
+      <set name="element" val="6"/>
+      <set name="hitTime" val="3300"/>
+      <set name="skillType" val="MDAM"/>
+      <set name="reuseDelay" val="30000"/>
+      <set name="operateType" val="OP_ACTIVE"/>
+      <set name="castRange" val="-1"/>
+      <set name="effectRange" val="400"/>
+      <set name="effectType" val="STUN"/>
+      <set name="effectPower" val="80"/>
+      <set name="skillRadius" val="400"/>
+      <for>
+         <effect count="1" name="Stun" time="9" val="0" stackOrder="1" stackType="Stun"/>
+      </for>
    </skill>
    <skill id="5086" levels="1" name="Deadly Poison">
       <!-- Infected with poison and gradually losing HP. If HP falls to 0, death will ensue. -->
-      <set name="target" val="TARGET_NONE" />
-      <set name="skillType" val="NOTDONE" />
-      <set name="operateType" val="OP_PASSIVE" />
-      <set name="hitTime" val="3300" />
-      <set name="saveVs" val="CON" />
-      <set name="lvlDepend" val="1" />
-      <set name="trait" val="POISON" />
+      <set name="target" val="TARGET_AURA"/>
+      <set name="skillType" val="POISON"/>
+      <set name="operateType" val="OP_ACTIVE"/>
+      <set name="skillRadius" val="200"/>
+      <set name="reuseDelay" val="15000"/>
+      <set name="mpConsume" val="23"/>
+      <set name="power" val="100"/>
+      <set name="element" val="6"/>
+      <set name="hitTime" val="3300"/>
+      <set name="castRange" val="-1"/>
+      <set name="effectType" val="POISON"/>
+      <set name="effectLevel" val="7"/>
+      <set name="effectRange" val="400"/>
+      <for>
+         <effect count="10" name="DamOverTime" time="3" val="203" abnormal="poison"/>
+      </for>
    </skill>
    <skill id="5087" levels="2" name="Berserk">

Link to comment
Share on other sites

Merge of 3 existing AIs. What more to say, except you could do it even better.

 

Ty for share, that avoid some rework at least, lol.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt  
    • Server Rates: » Xp 500x. » Sp 500x. » Aden 500x. » Drop 1x. » PartyXp 2x. » PartySp 2x. » Starting character level -61. Enchant rates: » Safe enchant +4. » Blessed and simple scrolls max enchant (+16). » Crystal scrolls max enchant (+20). » Simple enchant scrolls chance – 65%. » Blessed enchant scrolls chance – 100%. » Crystal enchant scrolls chance – 50% Augmentations: » Mid life stone skill chance – 5%. » High life stone skill chance – 10%. » Top life stone skill chance – 20%. » Augments 1+1 Unique features: » Main town – Giran » Automatic-Manual Potions. » Working 2 castle sieges. (Giran-Aden) » SPS cancel lasts 10 seconds and than buffs come back. » Stackable scrolls, lifestones, book of giants. » Unique pvp zone » More then 11 active raid bosses. » Wedding system. » Unique farming areas. » Npc skill enchanter. » Full npc buffer with auto buff. » Max count of buffs – 55. » Max subclasses – 4. » Free and no quest class change. » Free and no quest sub class. » Raid boss drop nobless item. » No weight limit. » Unique protection anti-hwy armor for archers/daggers etc. » Ingame password change. » Top pvp/pk/online ranks NPC. » Unique monsters & NPC. » Interlude retail skills. » Server up-time [24/7] [99]%. » Perfect class balance (all class can kill all class depending on players skill and setup knowledge,gear,augmentations). » Announcements on double kills triple kills etc. » Announcements on Grand Boss death , with the name of the killer as well as clan name of the player. » Information Npc in game with all servers infromations. Custom server gear : 1). Titanium Armor Lv.1 2). Epic Armor Lv.2 3). Epic Weapons-Kamikaze-Black S grade (Same Stats) 4). Demonic-Angelic Wings-Baium Hair-Custom Accessories (SameStats) 5). Custom Fighter/Mage tattoo Lv1-Lv2-Lv3 6). Shirt (STR,CON,INT +1) 7). Custom Shields Server Commands: .tvtjoin .tvtleave – Join or leave tvt event. .ctfjoin .ctfleave – Join or leave ctf event. .dmjoin .dmleave – Join of leave dm event. .online – current online players count. .repair – repairs stuck character in world. .menu – opens online menu panel. .exit – PVP zone exit in case you are bullied. .changepassword - Opens online menu then u can change ur password in game. .farm - Enable/disable autofarm Event system: » TVT event » CTF event » DM event » Tournament Event » Party Zone » Unique event shop. Olympiad game: » Retail olympiad game. » Competition period [1] week. » Olympiad start time [18:00] end [00:00] GMT+2. » New Heroes every Sunday.
    • Tomorrow grand opening lests go 🙂 
  • Topics

×
×
  • Create New...