From 0e70e68332677f85b8b4d382d28003c305984ccc Mon Sep 17 00:00:00 2001 From: St3eT <St3eT@users.noreply.github.com> Date: Mon, 7 Jul 2014 04:26:28 +0000 Subject: [PATCH] BETA: Implemented '''Hot Springs''' AI. * Patch by: Pandragon * Tested by: St3eT, Pandragon * Reviewed by: St3eT --- L2J_DataPack_BETA/dist/game/data/scripts.cfg | 1 + .../scripts/ai/group_template/HotSprings.java | 109 ++++++++++++++++++ .../dist/game/data/stats/npcs/21300-21400.xml | 24 ---- 3 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/HotSprings.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg index 945f1430aa..9fea1d3fb7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg +++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg @@ -101,6 +101,7 @@ ai/group_template/FeedableBeasts.java ai/group_template/FleeMonsters.java ai/group_template/FrozenLabyrinth.java ai/group_template/GiantsCave.java +ai/group_template/HotSprings.java ai/group_template/IsleOfPrayer.java ai/group_template/LairOfAntharas.java ai/group_template/MithrilMines.java diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/HotSprings.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/HotSprings.java new file mode 100644 index 0000000000..0be7338cff --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/HotSprings.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2004-2014 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack 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. + * + * L2J DataPack 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 ai.npc.AbstractNpcAI; + +import com.l2jserver.gameserver.datatables.SkillData; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.model.skills.Skill; + +/** + * Hot Springs AI. + * @author Pandragon + */ +public final class HotSprings extends AbstractNpcAI +{ + // NPCs + private static final int BANDERSNATCHLING = 21314; + private static final int FLAVA = 21316; + private static final int ATROXSPAWN = 21317; + private static final int NEPENTHES = 21319; + private static final int ATROX = 21321; + private static final int BANDERSNATCH = 21322; + // Skills + private static final int RHEUMATISM = 4551; + private static final int CHOLERA = 4552; + private static final int FLU = 4553; + private static final int MALARIA = 4554; + // Misc + private static final int DISEASE_CHANCE = 10; + + private HotSprings() + { + super(HotSprings.class.getSimpleName(), "ai/group_template"); + addAttackId(BANDERSNATCHLING, FLAVA, ATROXSPAWN, NEPENTHES, ATROX, BANDERSNATCH); + } + + @Override + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) + { + if (getRandom(100) < DISEASE_CHANCE) + { + tryToInfect(npc, attacker, MALARIA); + } + + if (getRandom(100) < DISEASE_CHANCE) + { + switch (npc.getId()) + { + case BANDERSNATCHLING: + case ATROX: + { + tryToInfect(npc, attacker, RHEUMATISM); + break; + } + case FLAVA: + case NEPENTHES: + { + tryToInfect(npc, attacker, CHOLERA); + break; + } + case ATROXSPAWN: + case BANDERSNATCH: + { + tryToInfect(npc, attacker, FLU); + break; + } + } + } + return super.onAttack(npc, attacker, damage, isSummon); + } + + private void tryToInfect(L2Npc npc, L2Character player, int diseaseId) + { + final BuffInfo info = player.getEffectList().getBuffInfoBySkillId(diseaseId); + final int skillLevel = (info == null) ? 1 : (info.getSkill().getLevel() < 10) ? info.getSkill().getLevel() + 1 : 10; + final Skill skill = SkillData.getInstance().getSkill(diseaseId, skillLevel); + + if ((skill != null) && !npc.isCastingNow() && npc.checkDoCastConditions(skill)) + { + npc.setTarget(player); + npc.doCast(skill); + } + } + + public static void main(String[] args) + { + new HotSprings(); + } +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/stats/npcs/21300-21400.xml b/L2J_DataPack_BETA/dist/game/data/stats/npcs/21300-21400.xml index 94be6eed07..8c4cfbcd59 100644 --- a/L2J_DataPack_BETA/dist/game/data/stats/npcs/21300-21400.xml +++ b/L2J_DataPack_BETA/dist/game/data/stats/npcs/21300-21400.xml @@ -1346,8 +1346,6 @@ <skill name="PhysicalSpecial" id="4073" level="7" /> <!-- Stun --> <skill name="Buff1" id="4074" level="2" /> <!-- NPC Haste --> <skill name="Buff2" id="4096" level="3" /> <!-- NPC Hawkeye --> - <skill name="DeBuff1" id="4551" level="1" /> <!-- Hot Springs Rheumatism --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>BEAST</race> <sex>MALE</sex> @@ -1382,8 +1380,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="4" /> <!--One-handed Sword --> <skill id="4416" level="3" /> <!--Beasts --> - <skill id="4551" level="1" /> <!--Hot Springs Rheumatism --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="3" /> <!--NPC High Level --> </skill_list> @@ -1596,8 +1592,6 @@ <skill name="PhysicalSpecial" id="4073" level="7" /> <!-- Stun --> <skill name="Buff1" id="4099" level="2" /> <!-- NPC Berserk --> <skill name="Buff2" id="4074" level="2" /> <!-- NPC Haste --> - <skill name="DeBuff1" id="4552" level="1" /> <!-- Hot Springs Cholera --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>PLANT</race> <sex>MALE</sex> @@ -1632,8 +1626,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="5" /> <!--Blunt Weapons --> <skill id="4416" level="5" /> <!--Plants --> - <skill id="4552" level="1" /> <!--Hot Springs Cholera --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="3" /> <!--NPC High Level --> </skill_list> @@ -1725,8 +1717,6 @@ <skill name="PhysicalSpecial" id="4073" level="7" /> <!-- Stun --> <skill name="Buff1" id="4074" level="2" /> <!-- NPC Haste --> <skill name="Buff2" id="4096" level="3" /> <!-- NPC Hawkeye --> - <skill name="DeBuff1" id="4553" level="1" /> <!-- Hot Springs Flu --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>BUG</race> <sex>MALE</sex> @@ -1761,8 +1751,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="4" /> <!--One-handed Sword --> <skill id="4416" level="12" /> <!--Bugs --> - <skill id="4553" level="1" /> <!--Hot Springs Flu --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="3" /> <!--NPC High Level --> </skill_list> @@ -1983,8 +1971,6 @@ <skill name="RangePhysicalSpecial" id="4072" level="8" /> <!-- Stun --> <skill name="Buff1" id="4074" level="2" /> <!-- NPC Haste --> <skill name="Buff2" id="4099" level="2" /> <!-- NPC Berserk --> - <skill name="DeBuff1" id="4552" level="1" /> <!-- Hot Springs Cholera --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>PLANT</race> <sex>MALE</sex> @@ -2020,8 +2006,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="6" /> <!--Blunt Weapons --> <skill id="4416" level="5" /> <!--Plants --> - <skill id="4552" level="1" /> <!--Hot Springs Cholera --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="4" /> <!--NPC High Level --> </skill_list> @@ -2231,8 +2215,6 @@ <skill name="PhysicalSpecial" id="4073" level="8" /> <!-- Stun --> <skill name="Buff1" id="4074" level="2" /> <!-- NPC Haste --> <skill name="Buff2" id="4096" level="3" /> <!-- NPC Hawkeye --> - <skill name="DeBuff1" id="4551" level="1" /> <!-- Hot Springs Rheumatism --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>BUG</race> <sex>MALE</sex> @@ -2267,8 +2249,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="4" /> <!--One-handed Sword --> <skill id="4416" level="12" /> <!--Bugs --> - <skill id="4551" level="1" /> <!--Hot Springs Rheumatism --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="4" /> <!--NPC High Level --> </skill_list> @@ -2352,8 +2332,6 @@ <skill name="PhysicalSpecial" id="4073" level="8" /> <!-- Stun --> <skill name="Buff1" id="4074" level="2" /> <!-- NPC Haste --> <skill name="Buff2" id="4099" level="2" /> <!-- NPC Berserk --> - <skill name="DeBuff1" id="4553" level="1" /> <!-- Hot Springs Flu --> - <skill name="DeBuff1" id="4554" level="1" /> <!-- Hot Spring Malaria --> </parameters> <race>BEAST</race> <sex>MALE</sex> @@ -2388,8 +2366,6 @@ <skill id="4414" level="2" /> <!--Standard Type --> <skill id="4415" level="4" /> <!--One-handed Sword --> <skill id="4416" level="3" /> <!--Beasts --> - <skill id="4553" level="1" /> <!--Hot Springs Flu --> - <skill id="4554" level="1" /> <!--Hot Spring Malaria --> <skill id="4555" level="1" /> <!--NPC Resist Mutant --> <skill id="4789" level="4" /> <!--NPC High Level --> </skill_list> -- GitLab