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">