Cyrax changes.
Source: Liamxroy
This commit is contained in:
@@ -14,10 +14,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ai.bosses.Cyrax;
|
package ai.bosses.Cyrax;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.CommonUtil;
|
||||||
|
import org.l2jmobius.gameserver.model.Party;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||||
|
|
||||||
import ai.AbstractNpcAI;
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
@@ -28,18 +36,161 @@ public class Cyrax extends AbstractNpcAI
|
|||||||
{
|
{
|
||||||
// NPC
|
// NPC
|
||||||
private static final int CYRAX = 29374;
|
private static final int CYRAX = 29374;
|
||||||
|
// Skills
|
||||||
|
private static final SkillHolder AQUA_WAVE = new SkillHolder(32742, 1);
|
||||||
|
private static final SkillHolder SURGE_WAVE = new SkillHolder(32743, 1);
|
||||||
// Item
|
// Item
|
||||||
private static final int FONDUS_STONE = 80322;
|
private static final int FONDUS_STONE = 80322;
|
||||||
|
|
||||||
public Cyrax()
|
public Cyrax()
|
||||||
{
|
{
|
||||||
addKillId(CYRAX);
|
registerMobs(CYRAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||||
|
{
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case "MANAGE_SKILLS":
|
||||||
|
{
|
||||||
|
if (npc != null)
|
||||||
|
{
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onAdvEvent(event, npc, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||||
|
{
|
||||||
|
if (npc.getId() == CYRAX)
|
||||||
|
{
|
||||||
|
if (skill == null)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 1000));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 100));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 20));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 20));
|
||||||
|
}
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onAttack(npc, attacker, damage, isSummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, damage, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage, int aggro)
|
||||||
|
{
|
||||||
|
final int newAggroVal = damage + getRandom(3000);
|
||||||
|
final int aggroVal = aggro + 1000;
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (attacker == vars.getObject("c_quest" + i, Creature.class))
|
||||||
|
{
|
||||||
|
if (vars.getInt("i_quest" + i) < aggroVal)
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, newAggroVal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMinValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
vars.set("i_quest" + index, newAggroVal);
|
||||||
|
vars.set("c_quest" + index, attacker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
|
||||||
|
{
|
||||||
|
startQuestTimer("MANAGE_SKILLS", 1000, npc, null);
|
||||||
|
return super.onSpellFinished(npc, player, skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageSkills(Npc npc)
|
||||||
|
{
|
||||||
|
if (npc.isCastingNow(SkillCaster::isAnyNormalType) || npc.isCoreAIDisabled() || !npc.isInCombat())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
final Creature attacker = vars.getObject("c_quest" + i, Creature.class);
|
||||||
|
if ((attacker == null) || ((npc.calculateDistance3D(attacker) > 9000) || attacker.isDead()))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMaxValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
final Creature player = vars.getObject("c_quest" + index, Creature.class);
|
||||||
|
final int i2 = vars.getInt("i_quest" + index);
|
||||||
|
if ((i2 > 0) && (getRandom(100) < 70))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + index, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillHolder skillToCast = null;
|
||||||
|
if ((player != null) && !player.isDead())
|
||||||
|
{
|
||||||
|
if (getRandom(100) < 30)
|
||||||
|
{
|
||||||
|
skillToCast = SURGE_WAVE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skillToCast = AQUA_WAVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((skillToCast != null) && SkillCaster.checkUseConditions(npc, skillToCast.getSkill()))
|
||||||
|
{
|
||||||
|
npc.setTarget(player);
|
||||||
|
npc.doCast(skillToCast.getSkill());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||||
{
|
{
|
||||||
npc.dropItem(killer, FONDUS_STONE, 1);
|
if (killer.isInParty())
|
||||||
|
{
|
||||||
|
final Party party = killer.getParty();
|
||||||
|
if (party.getCommandChannel() != null)
|
||||||
|
{
|
||||||
|
giveItems(party.getCommandChannel().getLeader(), FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
giveItems(party.getLeader(), FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
giveItems(killer, FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
return super.onKill(npc, killer, isSummon);
|
return super.onKill(npc, killer, isSummon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
176
L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Cyrax/TempleEliteWizard.java
vendored
Normal file
176
L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Cyrax/TempleEliteWizard.java
vendored
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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.bosses.Cyrax;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.CommonUtil;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||||
|
|
||||||
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author NviX
|
||||||
|
*/
|
||||||
|
public class TempleEliteWizard extends AbstractNpcAI
|
||||||
|
{
|
||||||
|
// NPC
|
||||||
|
private static final int TEMPLE_ELITE_WIZARD = 29378;
|
||||||
|
// Skills
|
||||||
|
private static final SkillHolder WATER_ARROW = new SkillHolder(32740, 1);
|
||||||
|
private static final SkillHolder ARROW_FLUSH = new SkillHolder(32741, 1);
|
||||||
|
|
||||||
|
private TempleEliteWizard()
|
||||||
|
{
|
||||||
|
registerMobs(TEMPLE_ELITE_WIZARD);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||||
|
{
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case "MANAGE_SKILLS":
|
||||||
|
{
|
||||||
|
if (npc != null)
|
||||||
|
{
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onAdvEvent(event, npc, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||||
|
{
|
||||||
|
if (npc.getId() == TEMPLE_ELITE_WIZARD)
|
||||||
|
{
|
||||||
|
if (skill == null)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 1000));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 100));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 20));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 20));
|
||||||
|
}
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onAttack(npc, attacker, damage, isSummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, damage, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage, int aggro)
|
||||||
|
{
|
||||||
|
final int newAggroVal = damage + getRandom(3000);
|
||||||
|
final int aggroVal = aggro + 1000;
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (attacker == vars.getObject("c_quest" + i, Creature.class))
|
||||||
|
{
|
||||||
|
if (vars.getInt("i_quest" + i) < aggroVal)
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, newAggroVal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMinValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
vars.set("i_quest" + index, newAggroVal);
|
||||||
|
vars.set("c_quest" + index, attacker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
|
||||||
|
{
|
||||||
|
startQuestTimer("MANAGE_SKILLS", 1000, npc, null);
|
||||||
|
|
||||||
|
return super.onSpellFinished(npc, player, skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageSkills(Npc npc)
|
||||||
|
{
|
||||||
|
if (npc.isCastingNow(SkillCaster::isAnyNormalType) || npc.isCoreAIDisabled() || !npc.isInCombat())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
final Creature attacker = vars.getObject("c_quest" + i, Creature.class);
|
||||||
|
if ((attacker == null) || ((npc.calculateDistance3D(attacker) > 9000) || attacker.isDead()))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMaxValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
final Creature player = vars.getObject("c_quest" + index, Creature.class);
|
||||||
|
final int i2 = vars.getInt("i_quest" + index);
|
||||||
|
if ((i2 > 0) && (getRandom(100) < 70))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + index, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillHolder skillToCast = null;
|
||||||
|
if ((player != null) && !player.isDead())
|
||||||
|
{
|
||||||
|
if (getRandom(100) < 30)
|
||||||
|
{
|
||||||
|
skillToCast = ARROW_FLUSH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skillToCast = WATER_ARROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((skillToCast != null) && SkillCaster.checkUseConditions(npc, skillToCast.getSkill()))
|
||||||
|
{
|
||||||
|
npc.setTarget(player);
|
||||||
|
npc.doCast(skillToCast.getSkill());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new TempleEliteWizard();
|
||||||
|
}
|
||||||
|
}
|
@@ -14,10 +14,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ai.bosses.Cyrax;
|
package ai.bosses.Cyrax;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.CommonUtil;
|
||||||
|
import org.l2jmobius.gameserver.model.Party;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||||
|
|
||||||
import ai.AbstractNpcAI;
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
@@ -28,18 +36,161 @@ public class Cyrax extends AbstractNpcAI
|
|||||||
{
|
{
|
||||||
// NPC
|
// NPC
|
||||||
private static final int CYRAX = 29374;
|
private static final int CYRAX = 29374;
|
||||||
|
// Skills
|
||||||
|
private static final SkillHolder AQUA_WAVE = new SkillHolder(32742, 1);
|
||||||
|
private static final SkillHolder SURGE_WAVE = new SkillHolder(32743, 1);
|
||||||
// Item
|
// Item
|
||||||
private static final int FONDUS_STONE = 80322;
|
private static final int FONDUS_STONE = 80322;
|
||||||
|
|
||||||
public Cyrax()
|
public Cyrax()
|
||||||
{
|
{
|
||||||
addKillId(CYRAX);
|
registerMobs(CYRAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||||
|
{
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case "MANAGE_SKILLS":
|
||||||
|
{
|
||||||
|
if (npc != null)
|
||||||
|
{
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onAdvEvent(event, npc, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||||
|
{
|
||||||
|
if (npc.getId() == CYRAX)
|
||||||
|
{
|
||||||
|
if (skill == null)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 1000));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 100));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 20));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 20));
|
||||||
|
}
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onAttack(npc, attacker, damage, isSummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, damage, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage, int aggro)
|
||||||
|
{
|
||||||
|
final int newAggroVal = damage + getRandom(3000);
|
||||||
|
final int aggroVal = aggro + 1000;
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (attacker == vars.getObject("c_quest" + i, Creature.class))
|
||||||
|
{
|
||||||
|
if (vars.getInt("i_quest" + i) < aggroVal)
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, newAggroVal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMinValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
vars.set("i_quest" + index, newAggroVal);
|
||||||
|
vars.set("c_quest" + index, attacker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
|
||||||
|
{
|
||||||
|
startQuestTimer("MANAGE_SKILLS", 1000, npc, null);
|
||||||
|
return super.onSpellFinished(npc, player, skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageSkills(Npc npc)
|
||||||
|
{
|
||||||
|
if (npc.isCastingNow(SkillCaster::isAnyNormalType) || npc.isCoreAIDisabled() || !npc.isInCombat())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
final Creature attacker = vars.getObject("c_quest" + i, Creature.class);
|
||||||
|
if ((attacker == null) || ((npc.calculateDistance3D(attacker) > 9000) || attacker.isDead()))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMaxValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
final Creature player = vars.getObject("c_quest" + index, Creature.class);
|
||||||
|
final int i2 = vars.getInt("i_quest" + index);
|
||||||
|
if ((i2 > 0) && (getRandom(100) < 70))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + index, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillHolder skillToCast = null;
|
||||||
|
if ((player != null) && !player.isDead())
|
||||||
|
{
|
||||||
|
if (getRandom(100) < 30)
|
||||||
|
{
|
||||||
|
skillToCast = SURGE_WAVE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skillToCast = AQUA_WAVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((skillToCast != null) && SkillCaster.checkUseConditions(npc, skillToCast.getSkill()))
|
||||||
|
{
|
||||||
|
npc.setTarget(player);
|
||||||
|
npc.doCast(skillToCast.getSkill());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||||
{
|
{
|
||||||
npc.dropItem(killer, FONDUS_STONE, 1);
|
if (killer.isInParty())
|
||||||
|
{
|
||||||
|
final Party party = killer.getParty();
|
||||||
|
if (party.getCommandChannel() != null)
|
||||||
|
{
|
||||||
|
giveItems(party.getCommandChannel().getLeader(), FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
giveItems(party.getLeader(), FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
giveItems(killer, FONDUS_STONE, 1);
|
||||||
|
}
|
||||||
return super.onKill(npc, killer, isSummon);
|
return super.onKill(npc, killer, isSummon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
176
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Cyrax/TempleEliteWizard.java
vendored
Normal file
176
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Cyrax/TempleEliteWizard.java
vendored
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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.bosses.Cyrax;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.CommonUtil;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
|
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||||
|
|
||||||
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author NviX
|
||||||
|
*/
|
||||||
|
public class TempleEliteWizard extends AbstractNpcAI
|
||||||
|
{
|
||||||
|
// NPC
|
||||||
|
private static final int TEMPLE_ELITE_WIZARD = 29378;
|
||||||
|
// Skills
|
||||||
|
private static final SkillHolder WATER_ARROW = new SkillHolder(32740, 1);
|
||||||
|
private static final SkillHolder ARROW_FLUSH = new SkillHolder(32741, 1);
|
||||||
|
|
||||||
|
private TempleEliteWizard()
|
||||||
|
{
|
||||||
|
registerMobs(TEMPLE_ELITE_WIZARD);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||||
|
{
|
||||||
|
switch (event)
|
||||||
|
{
|
||||||
|
case "MANAGE_SKILLS":
|
||||||
|
{
|
||||||
|
if (npc != null)
|
||||||
|
{
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onAdvEvent(event, npc, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||||
|
{
|
||||||
|
if (npc.getId() == TEMPLE_ELITE_WIZARD)
|
||||||
|
{
|
||||||
|
if (skill == null)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 1000));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 100));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 20));
|
||||||
|
}
|
||||||
|
else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75))
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, (damage * 10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, ((damage / 3) * 20));
|
||||||
|
}
|
||||||
|
manageSkills(npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onAttack(npc, attacker, damage, isSummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage)
|
||||||
|
{
|
||||||
|
refreshAiParams(attacker, npc, damage, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void refreshAiParams(Creature attacker, Npc npc, int damage, int aggro)
|
||||||
|
{
|
||||||
|
final int newAggroVal = damage + getRandom(3000);
|
||||||
|
final int aggroVal = aggro + 1000;
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (attacker == vars.getObject("c_quest" + i, Creature.class))
|
||||||
|
{
|
||||||
|
if (vars.getInt("i_quest" + i) < aggroVal)
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, newAggroVal);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMinValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
vars.set("i_quest" + index, newAggroVal);
|
||||||
|
vars.set("c_quest" + index, attacker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
|
||||||
|
{
|
||||||
|
startQuestTimer("MANAGE_SKILLS", 1000, npc, null);
|
||||||
|
|
||||||
|
return super.onSpellFinished(npc, player, skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void manageSkills(Npc npc)
|
||||||
|
{
|
||||||
|
if (npc.isCastingNow(SkillCaster::isAnyNormalType) || npc.isCoreAIDisabled() || !npc.isInCombat())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final NpcVariables vars = npc.getVariables();
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
final Creature attacker = vars.getObject("c_quest" + i, Creature.class);
|
||||||
|
if ((attacker == null) || ((npc.calculateDistance3D(attacker) > 9000) || attacker.isDead()))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int index = CommonUtil.getIndexOfMaxValue(vars.getInt("i_quest0"), vars.getInt("i_quest1"), vars.getInt("i_quest2"));
|
||||||
|
final Creature player = vars.getObject("c_quest" + index, Creature.class);
|
||||||
|
final int i2 = vars.getInt("i_quest" + index);
|
||||||
|
if ((i2 > 0) && (getRandom(100) < 70))
|
||||||
|
{
|
||||||
|
vars.set("i_quest" + index, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillHolder skillToCast = null;
|
||||||
|
if ((player != null) && !player.isDead())
|
||||||
|
{
|
||||||
|
if (getRandom(100) < 30)
|
||||||
|
{
|
||||||
|
skillToCast = ARROW_FLUSH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skillToCast = WATER_ARROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((skillToCast != null) && SkillCaster.checkUseConditions(npc, skillToCast.getSkill()))
|
||||||
|
{
|
||||||
|
npc.setTarget(player);
|
||||||
|
npc.doCast(skillToCast.getSkill());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new TempleEliteWizard();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user