Raidboss changes.

Contributed by champzix1.
This commit is contained in:
MobiusDevelopment
2019-05-10 14:14:40 +00:00
parent 068aaddc0e
commit 1d4142937a
104 changed files with 3640 additions and 2770 deletions

View File

@@ -847,7 +847,7 @@ public class Trasken extends AbstractNpcAI
{
tie_trasken = addSpawn(TAIL_TRASKEN, CENTER_LOCATION, false, 0, true);
hp_tail = tie_trasken.getCurrentHp();
startQuestTimer("spawn_rnd", 30000, tie_trasken, null);
startQuestTimer("spawn_rnd", 3000000, tie_trasken, null);
break;
}
case 3:
@@ -858,7 +858,7 @@ public class Trasken extends AbstractNpcAI
trasken.doCast(SKILL_TRASKEN_UP.getSkill());
hp_trasken = trasken.getCurrentHp();
startQuestTimer("spawn_rnd", 70000, trasken, null);
startQuestTimer("spawn_rnd", 9000000, trasken, null);
for (Location loc : Spawn_Larva_1)
{
addSpawn(LAVRA_1, loc, false, 0, true);

View File

@@ -16,32 +16,23 @@
*/
package ai.bosses.Valakas;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.MountType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.skills.BuffInfo;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.skills.SkillCaster;
import org.l2jmobius.gameserver.model.zone.ZoneType;
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
import org.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
@@ -54,36 +45,36 @@ public final class Valakas extends AbstractNpcAI
// NPC
private static final int VALAKAS = 29028;
// Skills
private static final SkillHolder VALAKAS_LAVA_SKIN = new SkillHolder(4680, 1);
// private static final SkillHolder VALAKAS_LAVA_SKIN = new SkillHolder(4680, 1);
private static final int VALAKAS_REGENERATION = 4691;
private static final SkillHolder[] VALAKAS_REGULAR_SKILLS =
{
new SkillHolder(4681, 1), // Valakas Trample
new SkillHolder(4682, 1), // Valakas Trample
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
};
private static final SkillHolder[] VALAKAS_LOWHP_SKILLS =
{
new SkillHolder(4681, 1), // Valakas Trample
new SkillHolder(4682, 1), // Valakas Trample
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
new SkillHolder(4690, 1), // Valakas Meteor Storm
};
private static final SkillHolder[] VALAKAS_AOE_SKILLS =
{
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4684, 1), // Valakas Dragon Breath
new SkillHolder(4685, 1), // Valakas Tail Stomp
new SkillHolder(4686, 1), // Valakas Tail Stomp
new SkillHolder(4688, 1), // Valakas Stun
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
new SkillHolder(4690, 1), // Valakas Meteor Storm
};
// private static final SkillHolder[] VALAKAS_REGULAR_SKILLS =
// {
// new SkillHolder(4681, 1), // Valakas Trample
// new SkillHolder(4682, 1), // Valakas Trample
// new SkillHolder(4683, 1), // Valakas Dragon Breath
// new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
// };
//
// private static final SkillHolder[] VALAKAS_LOWHP_SKILLS =
// {
// new SkillHolder(4681, 1), // Valakas Trample
// new SkillHolder(4682, 1), // Valakas Trample
// new SkillHolder(4683, 1), // Valakas Dragon Breath
// new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
// new SkillHolder(4690, 1), // Valakas Meteor Storm
// };
//
// private static final SkillHolder[] VALAKAS_AOE_SKILLS =
// {
// new SkillHolder(4683, 1), // Valakas Dragon Breath
// new SkillHolder(4684, 1), // Valakas Dragon Breath
// new SkillHolder(4685, 1), // Valakas Tail Stomp
// new SkillHolder(4686, 1), // Valakas Tail Stomp
// new SkillHolder(4688, 1), // Valakas Stun
// new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
// new SkillHolder(4690, 1), // Valakas Meteor Storm
// };
// Locations
private static final Location TELEPORT_CUBE_LOCATIONS[] =
@@ -114,7 +105,7 @@ public final class Valakas extends AbstractNpcAI
private static final byte DEAD = 3; // Valakas has been killed. Entry is locked.
// Misc
private long _timeTracker = 0; // Time tracker for last attack on Valakas.
private Playable _actualVictim; // Actual target of Valakas.
// private Playable _actualVictim; // Actual target of Valakas.
private static ZoneType ZONE;
private Valakas()
@@ -355,10 +346,10 @@ public final class Valakas extends AbstractNpcAI
startQuestTimer("remove_players", 900000, null, null);
}
else if (event.equalsIgnoreCase("skill_task"))
{
callSkillAI(npc);
}
// else if (event.equalsIgnoreCase("skill_task"))
// {
// callSkillAI(npc);
// }
}
else if (event.equalsIgnoreCase("valakas_unlock"))
{
@@ -373,12 +364,12 @@ public final class Valakas extends AbstractNpcAI
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSpawn(Npc npc)
{
npc.disableCoreAI(true);
return super.onSpawn(npc);
}
// @Override
// public String onSpawn(Npc npc)
// {
// npc.disableCoreAI(true);
// return super.onSpawn(npc);
// }
@Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -449,105 +440,105 @@ public final class Valakas extends AbstractNpcAI
return super.onKill(npc, killer, isSummon);
}
@Override
public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon)
{
return null;
}
private void callSkillAI(Npc npc)
{
if (npc.isInvul() || npc.isCastingNow(SkillCaster::isAnyNormalType))
{
return;
}
// Pickup a target if no or dead victim. 10% luck he decides to reconsiders his target.
if ((_actualVictim == null) || _actualVictim.isDead() || !(npc.isInSurroundingRegion(_actualVictim)) || (getRandom(10) == 0))
{
_actualVictim = getRandomTarget(npc);
}
// If result is still null, Valakas will roam. Don't go deeper in skill AI.
if (_actualVictim == null)
{
if (getRandom(10) == 0)
{
final int posX = npc.getX() + getRandom(-1400, 1400);
final int posY = npc.getY() + getRandom(-1400, 1400);
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, npc.getZ(), npc.getInstanceWorld()))
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, npc.getZ(), 0));
}
}
return;
}
final Skill skill = getRandomSkill(npc).getSkill();
// Cast the skill or follow the target.
if (Util.checkIfInRange((skill.getCastRange() < 600) ? 600 : skill.getCastRange(), npc, _actualVictim, true))
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.setTarget(_actualVictim);
npc.doCast(skill);
}
else
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, _actualVictim, null);
}
}
/**
* Pick a random skill.<br>
* Valakas will mostly use utility skills. If Valakas feels surrounded, he will use AoE skills.<br>
* Lower than 50% HPs, he will begin to use Meteor skill.
* @param npc valakas
* @return a skill holder
*/
private SkillHolder getRandomSkill(Npc npc)
{
final int hpRatio = (int) ((npc.getCurrentHp() / npc.getMaxHp()) * 100);
// Valakas Lava Skin has priority.
if ((hpRatio < 75) && (getRandom(150) == 0) && !npc.isAffectedBySkill(VALAKAS_LAVA_SKIN.getSkillId()))
{
return VALAKAS_LAVA_SKIN;
}
// Valakas will use mass spells if he feels surrounded.
if (World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 1200).size() >= 20)
{
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
}
if (hpRatio > 50)
{
return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)];
}
return VALAKAS_LOWHP_SKILLS[getRandom(VALAKAS_LOWHP_SKILLS.length)];
}
/**
* Pickup a random Playable from the zone, deads targets aren't included.
* @param npc
* @return a random Playable.
*/
private Playable getRandomTarget(Npc npc)
{
final List<Playable> result = new ArrayList<>();
World.getInstance().forEachVisibleObject(npc, Playable.class, obj ->
{
if (!obj.isPet() && !obj.isDead())
{
result.add(obj);
}
});
return (result.isEmpty()) ? null : result.get(getRandom(result.size()));
}
// @Override
// public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon)
// {
// return null;
// }
//
// private void callSkillAI(Npc npc)
// {
// if (npc.isInvul() || npc.isCastingNow(SkillCaster::isAnyNormalType))
// {
// return;
// }
//
// // Pickup a target if no or dead victim. 10% luck he decides to reconsiders his target.
// if ((_actualVictim == null) || _actualVictim.isDead() || !(npc.isInSurroundingRegion(_actualVictim)) || (getRandom(10) == 0))
// {
// _actualVictim = getRandomTarget(npc);
// }
//
// // If result is still null, Valakas will roam. Don't go deeper in skill AI.
// if (_actualVictim == null)
// {
// if (getRandom(10) == 0)
// {
// final int posX = npc.getX() + getRandom(-1400, 1400);
// final int posY = npc.getY() + getRandom(-1400, 1400);
// if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, npc.getZ(), npc.getInstanceWorld()))
// {
// npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, npc.getZ(), 0));
// }
// }
// return;
// }
//
// final Skill skill = getRandomSkill(npc).getSkill();
//
// // Cast the skill or follow the target.
// if (Util.checkIfInRange((skill.getCastRange() < 600) ? 600 : skill.getCastRange(), npc, _actualVictim, true))
// {
// npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
// npc.setTarget(_actualVictim);
// npc.doCast(skill);
// }
// else
// {
// npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, _actualVictim, null);
// }
// }
//
// /**
// * Pick a random skill.<br>
// * Valakas will mostly use utility skills. If Valakas feels surrounded, he will use AoE skills.<br>
// * Lower than 50% HPs, he will begin to use Meteor skill.
// * @param npc valakas
// * @return a skill holder
// */
// private SkillHolder getRandomSkill(Npc npc)
// {
// final int hpRatio = (int) ((npc.getCurrentHp() / npc.getMaxHp()) * 100);
//
// // Valakas Lava Skin has priority.
// if ((hpRatio < 75) && (getRandom(150) == 0) && !npc.isAffectedBySkill(VALAKAS_LAVA_SKIN.getSkillId()))
// {
// return VALAKAS_LAVA_SKIN;
// }
//
// // Valakas will use mass spells if he feels surrounded.
// if (World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 1200).size() >= 20)
// {
// return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
// }
//
// if (hpRatio > 50)
// {
// return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)];
// }
//
// return VALAKAS_LOWHP_SKILLS[getRandom(VALAKAS_LOWHP_SKILLS.length)];
// }
//
// /**
// * Pickup a random Playable from the zone, deads targets aren't included.
// * @param npc
// * @return a random Playable.
// */
// private Playable getRandomTarget(Npc npc)
// {
// final List<Playable> result = new ArrayList<>();
//
// World.getInstance().forEachVisibleObject(npc, Playable.class, obj ->
// {
// if (!obj.isPet() && !obj.isDead())
// {
// result.add(obj);
// }
// });
//
// return (result.isEmpty()) ? null : result.get(getRandom(result.size()));
// }
public static void main(String[] args)
{