Incubator of Evil initial commit.

This commit is contained in:
MobiusDev
2016-02-14 22:25:27 +00:00
parent 560576e2d4
commit 5d1e8973b1
23 changed files with 756 additions and 50 deletions

View File

@ -0,0 +1,4 @@
<html><body>Aden Vanguard Captain Adolph:<br>
As Shilen grows in power, more monsters will emerge from here. We can't just let this happen without fighting back!<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil">Quest</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Aden Vanguard Captain Adolph:<br>
You've caught me resting after a particularly tough battle. So, you're the soldier Orven has sent? Good! You can help my squad with that never-ending stream of monsters. Got any questions?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil 33170-3.htm">"I'm ready."</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Aden Vanguard Captain Adolph:<br>
See my subordinates there? They are elite veterans who have known many victories. Two of them will wait here, while you, me, and the other two enter the enemy base.<br>
Go and talk to my squad and pick out two you'd like to have at your side.
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Officer Barton:<br>
Not to brag, but a star soldier such as myself can make the difference between winning and losing.<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil 33170-5.htm">Quest</Button>
</body></html>

View File

@ -0,0 +1,5 @@
<html><body>Aden Vanguard Captain Adolph:<br>
I see you've chosen strong allies.<br1>
This battle will be fierce, and if you see me go down, do not hesitate to run. We can't afford to lose any more people, and if that happens, you will need time to regroup.<br1>Now, I hope you're ready to take this fight to the enemy, because we're going into their base.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil start_battle">"I'm ready."</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Priest Alice:<br>
Even the strongest soldier will fall if they cannot be healed in battle. My healing power will lead us to victory.<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil">Quest</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Priest Alice:<br>
Do you need my help? I can heal, and provide support in combat.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil select_alice">Select</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Officer Barton:<br>
Not to brag, but a star soldier such as myself can make the difference between winning and losing.<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil">Quest</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Officer Barton:<br>
You need my help? Well, you look like a capable sort. I need someone like you to watch my back.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil select_barton">Select</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Sniper Hayuk:<br>
If you can defeat your enemy before they get close, you can annihilate their forces without incurring any damage to your own team. Heh! That there is what's called strategy!<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil">Quest</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Sniper Hayuk:<br>
Do you need my help? Of course! I will cover your back! You can trust me.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil select_hayuk">"Yes, I could use some help."</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Magus Eliyah:<br>
The Ivory Tower's magic is much too powerful for these monsters. We have no need to skulk on the sidelines!<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h Quest IncubatorOfEvil">Quest</Button>
</body></html>

View File

@ -0,0 +1,4 @@
<html><body>Magus Eliyah:<br>
You need my help? Well, if you protect me from the monsters, I suppose I can help.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest IncubatorOfEvil select_eliyah">Select</Button>
</body></html>

View File

@ -0,0 +1,3 @@
<html><body>Van Archer:<br>
We're the strong, the proud, the vanguard of Aden! We're accepting applications... we really could use a second trombone for the marching band.
</body></html>

View File

@ -0,0 +1,3 @@
<html><body>Van Infantry:<br>
We're the strong, the proud, the vanguard of Aden! We're accepting applications... we really could use a second trombone for the marching band.
</body></html>

View File

@ -16,12 +16,23 @@
*/
package instances.IncubatorOfEvil;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.npc.FighterAI;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2QuestGuardInstance;
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
import com.l2jmobius.gameserver.model.quest.QuestState;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import instances.AbstractInstance;
import quests.Q10341_DayOfDestinyHumansFate.Q10341_DayOfDestinyHumansFate;
@ -32,33 +43,57 @@ import quests.Q10345_DayOfDestinyDwarfsFate.Q10345_DayOfDestinyDwarfsFate;
import quests.Q10346_DayOfDestinyKamaelsFate.Q10346_DayOfDestinyKamaelsFate;
/**
* Incubator of Evil Instance Zone.<br>
* TODO: Implement this!
* Incubator of Evil Instance Zone.
* @author Mobius
*/
public final class IncubatorOfEvil extends AbstractInstance
{
// NPCs
private static final int OFFICER = 19155;
private static final int ADOLPH = 33170;
private static final int ALICE = 33171;
private static final int BARTON = 33172;
private static final int HAYUK = 33173;
private static final int ELIYAH = 33174;
private static final int ARCHER = 33414;
private static final int INFANTRY = 33415;
// Monsters
private static final int FINAL_BOSS = 27425;
private static final List<Integer> MONSTERS = new ArrayList<>();
static
{
MONSTERS.add(27430);
MONSTERS.add(27431);
MONSTERS.add(27432);
MONSTERS.add(27433);
MONSTERS.add(27434);
}
// Rewards
private static final int SOE = 736;
// Locations
private static final Location START_LOC = new Location(56180, -172898, -7952);
@SuppressWarnings("unused")
private static final Location FIGHT_LOC = new Location(56177, -175627, -7952);
@SuppressWarnings("unused")
private static final Location EXIT_LOC = new Location(185798, 20400, -3345);
// Misc
private static final int TEMPLATE_ID = 185;
protected class IOE extends InstanceWorld
class IOEWorld extends InstanceWorld
{
L2QuestGuardInstance adolph = null;
L2QuestGuardInstance alice = null;
L2QuestGuardInstance barton = null;
L2QuestGuardInstance hayuk = null;
L2QuestGuardInstance eliyah = null;
int selectionCount = 0;
final List<L2Npc> savedSpawns = new CopyOnWriteArrayList<>();
}
public IncubatorOfEvil()
{
super(IncubatorOfEvil.class.getSimpleName());
addStartNpc(OFFICER);
addTalkId(OFFICER);
addFirstTalkId(OFFICER);
addStartNpc(ADOLPH);
addTalkId(ADOLPH, BARTON, HAYUK, ELIYAH, ALICE);
addFirstTalkId(ADOLPH, BARTON, HAYUK, ELIYAH, ALICE, ARCHER, INFANTRY);
addKillId(MONSTERS);
addKillId(FINAL_BOSS);
}
@Override
@ -66,28 +101,460 @@ public final class IncubatorOfEvil extends AbstractInstance
{
if (event.equals("enter_instance"))
{
if (getPlayerQuestState(player) == null)
final QuestState qs = getPlayerQuestState(player);
if ((qs == null) || (qs.getCond() < 4) || qs.isCond(13))
{
return null;
}
enterInstance(player, new IOE(), "IncubatorOfEvil.xml", TEMPLATE_ID);
qs.setCond(5, true);
enterInstance(player, new IOEWorld(), "IncubatorOfEvil.xml", TEMPLATE_ID);
return null;
}
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if ((tmpworld == null) || !(tmpworld instanceof IOE))
if ((tmpworld == null) || !(tmpworld instanceof IOEWorld))
{
return null;
}
@SuppressWarnings("unused")
final IOE world = (IOE) tmpworld;
final IOEWorld world = (IOEWorld) tmpworld;
String htmltext = null;
switch (event)
{
case "33170-5.htm":
{
htmltext = event;
break;
}
case "33170-3.htm":
{
final QuestState qs = getPlayerQuestState(player);
if ((qs != null) && qs.isCond(5))
{
qs.setCond(6, true);
htmltext = event;
}
break;
}
case "select_alice":
{
htmltext = addVanguard(player, ALICE);
break;
}
case "select_barton":
{
htmltext = addVanguard(player, BARTON);
break;
}
case "select_hayuk":
{
htmltext = addVanguard(player, HAYUK);
break;
}
case "select_eliyah":
{
htmltext = addVanguard(player, ELIYAH);
break;
}
case "start_battle":
{
if (world.selectionCount == 2)
{
final QuestState qs = getPlayerQuestState(player);
if ((qs != null) && qs.isCond(7))
{
world.setStatus(1);
qs.setCond(8, true);
teleportPlayer(player, FIGHT_LOC, world.getInstanceId(), false);
if (world.adolph != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, world.adolph), 1000);
}
if (world.alice != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, world.alice), 1000);
}
if (world.barton != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, world.barton), 1000);
}
if (world.hayuk != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, world.hayuk), 1000);
}
if (world.eliyah != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, world.eliyah), 1000);
}
final List<L2Npc> archers = spawnGroup("archers", world.getInstanceId());
for (L2Npc spawn : archers)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((L2QuestGuardInstance) spawn)), 1000);
}
final List<L2Npc> infantry = spawnGroup("infantry", world.getInstanceId());
for (L2Npc spawn : infantry)
{
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((L2QuestGuardInstance) spawn)), 1000);
}
world.savedSpawns.addAll(spawnGroup("wave1", world.getInstanceId()));
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
startQuestTimer("checkStatus", 5000, null, player, true);
}
}
break;
}
case "checkStatus":
{
// Check if finished.
if (world.getStatus() > 13)
{
final QuestState qs = getPlayerQuestState(player);
if (qs != null)
{
rewardItems(player, SOE, 1);
qs.setCond(13, true);
}
// 5 minute exit timer.
InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(Config.INSTANCE_FINISH_TIME);
InstanceManager.getInstance().getInstance(world.getInstanceId()).setEmptyDestroyTime(0);
// Stop quest timer.
cancelQuestTimers("checkStatus");
return null;
}
// Remove monsters killed by guards.
for (L2Npc spawn : world.savedSpawns)
{
if (spawn.isDead())
{
world.savedSpawns.remove(spawn);
if (spawn.getId() == FINAL_BOSS)
{
for (L2Npc monster : world.savedSpawns)
{
monster.deleteMe();
}
world.incStatus();
}
}
}
// Act according to world status.
switch (world.getStatus())
{
case 1:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave2", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 2:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave3", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 3:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave4", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 4:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave5", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 5:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave6", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 6:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave7", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 7:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave8", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 8:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave9", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 9:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave10", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 10:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave11", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 11:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave12", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 12:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
world.savedSpawns.addAll(spawnGroup("wave13", world.getInstanceId()));
showScreenMessage(player, NpcStringId.CREATURES_RESURRECTED_DEFEND_YOURSELF);
for (L2Npc spawn : world.savedSpawns)
{
addAttackDesire(spawn, player);
}
}
break;
}
case 13:
{
if (world.savedSpawns.isEmpty())
{
world.incStatus();
}
break;
}
}
break;
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
final QuestState qs = getPlayerQuestState(player);
if (qs == null)
{
return null;
}
String htmltext = getNoQuestMsg(player);
switch (npc.getId())
{
case ADOLPH:
{
switch (qs.getCond())
{
case 5:
{
htmltext = "33170-2.htm";
break;
}
case 6:
{
htmltext = "33170-3.htm";
break;
}
}
break;
}
case ALICE:
case BARTON:
case HAYUK:
case ELIYAH:
{
switch (qs.getCond())
{
case 6:
{
htmltext = npc.getId() + "-2.htm";
break;
}
}
break;
}
}
return htmltext;
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
final QuestState qs = getPlayerQuestState(player);
if (qs == null)
{
return null;
}
return super.onAdvEvent(event, npc, player);
switch (npc.getId())
{
case ADOLPH:
{
switch (qs.getCond())
{
case 4:
case 5:
case 6:
{
return "33170-1.htm";
}
case 7:
{
return "33170-4.htm";
}
}
break;
}
case ALICE:
case BARTON:
case HAYUK:
case ELIYAH:
{
switch (qs.getCond())
{
case 4:
case 5:
case 6:
{
return npc.getId() + "-1.htm";
}
// case 8: ?
}
break;
}
case ARCHER:
case INFANTRY:
{
return npc.getId() + "-1.htm";
}
}
return null;
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(killer);
if ((world == null) || !(world instanceof IOEWorld))
{
return null;
}
((IOEWorld) world).savedSpawns.remove(npc);
if (npc.getId() == FINAL_BOSS)
{
for (L2Npc monster : ((IOEWorld) world).savedSpawns)
{
monster.deleteMe();
}
((IOEWorld) world).incStatus();
}
return super.onKill(npc, killer, isSummon);
}
@Override
@ -95,7 +562,7 @@ public final class IncubatorOfEvil extends AbstractInstance
{
if (firstEntrance)
{
world.setStatus(1);
world.setStatus(0);
world.addAllowed(player.getObjectId());
}
teleportPlayer(player, START_LOC, world.getInstanceId());
@ -139,4 +606,69 @@ public final class IncubatorOfEvil extends AbstractInstance
}
return qs;
}
private String addVanguard(L2PcInstance player, int addedNpcId)
{
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if ((world == null) || !(world instanceof IOEWorld) || (world.getStatus() > 1) //
|| (player.getTarget() == null) || !player.getTarget().isNpc() || (((L2Npc) player.getTarget()).getId() != addedNpcId))
{
return null;
}
switch (addedNpcId)
{
case ALICE:
{
((L2Character) player.getTarget()).deleteMe();
((IOEWorld) world).selectionCount++;
((IOEWorld) world).alice = (L2QuestGuardInstance) addSpawn(ALICE, FIGHT_LOC, true, 0, false, world.getInstanceId());
break;
}
case BARTON:
{
((L2Character) player.getTarget()).deleteMe();
((IOEWorld) world).selectionCount++;
((IOEWorld) world).barton = (L2QuestGuardInstance) addSpawn(BARTON, FIGHT_LOC, true, 0, false, world.getInstanceId());
break;
}
case HAYUK:
{
((L2Character) player.getTarget()).deleteMe();
((IOEWorld) world).selectionCount++;
((IOEWorld) world).hayuk = (L2QuestGuardInstance) addSpawn(HAYUK, FIGHT_LOC, true, 0, false, world.getInstanceId());
break;
}
case ELIYAH:
{
((L2Character) player.getTarget()).deleteMe();
((IOEWorld) world).selectionCount++;
((IOEWorld) world).eliyah = (L2QuestGuardInstance) addSpawn(ELIYAH, FIGHT_LOC, true, 0, false, world.getInstanceId());
break;
}
}
if (((IOEWorld) world).selectionCount == 2)
{
((IOEWorld) world).adolph = (L2QuestGuardInstance) addSpawn(ADOLPH, FIGHT_LOC, true, 0, false, world.getInstanceId());
final QuestState qs = getPlayerQuestState(player);
if ((qs != null) && qs.isCond(6))
{
qs.setCond(7, true);
}
// Remove remaining vanguards.
for (L2Character ch : player.getKnownList().getKnownCharactersInRadius(500))
{
if (ch.isNpc() && (((L2Npc) ch).getId() != ADOLPH))
{
ch.deleteMe();
}
}
}
return null;
}
private void showScreenMessage(L2PcInstance player, NpcStringId stringId)
{
player.sendPacket(new ExShowScreenMessage(2, -1, 2, 0, 0, 0, 0, true, 10000, false, null, stringId, null));
}
}

View File

@ -1,121 +0,0 @@
/*
* 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 instances.KartiasLabyrinth.AI;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2QuestGuardInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.Util;
import com.l2jmobius.util.Rnd;
/**
* @author Mobius
*/
public final class Fighter implements Runnable
{
private L2PcInstance _player;
private final L2QuestGuardInstance _guard;
private int _followRange = 150;
public Fighter(L2PcInstance player, L2QuestGuardInstance guard)
{
_player = player;
_guard = guard;
_guard.setIsRunning(true);
if (_guard.getSpawn() != null)
{
_guard.setSpawn(null);
}
}
public void setPlayer(L2PcInstance player)
{
_player = player;
}
public void setFollowRange(int range)
{
_followRange = range;
}
@Override
public void run()
{
// Schedule new task only when necessary.
if ((_guard == null) || _guard.isDead() || (_player == null))
{
return;
}
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(_player, _guard), _guard.isInCombat() ? 1000 : 3000);
// Guard is occupied. Use skills logic.
if (_guard.isInCombat())
{
if ((_guard.getTarget() != null) && _guard.getTarget().isMonster() && ((L2Character) _guard.getTarget()).isAlikeDead())
{
for (Skill skill : _guard.getSkills().values())
{
if (skill.isBad() && (skill.getCoolTime() <= 0) && !_guard.isCastingNow() && (_guard.calculateDistance(_guard.getTarget(), false, false) < skill.getCastRange()))
{
_guard.setHeading(Util.calculateHeadingFrom(_guard, _guard.getTarget()));
skill.activateSkill(_guard, _guard.getTarget());
break;
}
}
}
return; // Guard is occupied, no need to proceed.
}
// Assist combat logic.
if (_player.isInCombat() && (_player.getTarget() != null) && _player.getTarget().isMonster() && !_player.getTarget().isInvul() //
&& ((L2Character) _player.getTarget()).isInCombat() && !((L2Character) _player.getTarget()).isAlikeDead())
{
if (_guard.calculateDistance(_player.getTarget(), false, false) > 50)
{
_guard.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, _player.getTarget().getLocation());
}
else if (_guard.getTarget() != _player.getTarget())
{
_guard.addDamageHate((L2Character) _player.getTarget(), 0, 1000);
}
}
// Try to kill nearby monsters logic.
for (L2Character ch : _guard.getKnownList().getKnownCharacters())
{
if (ch.isMonster() && !ch.isInvul() && !ch.isAlikeDead())
{
_guard.addDamageHate(ch, 0, 1000);
break;
}
}
// Out of combat follow logic.
if (!_guard.isInCombat())
{
final int moveToLocX = _player.getLocation().getX() + Rnd.get((_followRange * -1), _followRange);
final int moveToLocY = _player.getLocation().getY() + Rnd.get((_followRange * -1), _followRange);
final int moveToLocZ = _player.getLocation().getZ();
final Location moveToLocation = new Location(moveToLocX, moveToLocY, moveToLocZ);
_guard.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, moveToLocation);
}
}
}

View File

@ -1,129 +0,0 @@
/*
* 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 instances.KartiasLabyrinth.AI;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2QuestGuardInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.Util;
import com.l2jmobius.util.Rnd;
/**
* @author Mobius
*/
final class Healer implements Runnable
{
private L2PcInstance _player;
private final L2QuestGuardInstance _guard;
private int _followRange = 200;
public Healer(L2PcInstance player, L2QuestGuardInstance guard)
{
_player = player;
_guard = guard;
_guard.setIsRunning(true);
if (_guard.getSpawn() != null)
{
_guard.setSpawn(null);
}
}
public void setPlayer(L2PcInstance player)
{
_player = player;
}
public void setFollowRange(int range)
{
_followRange = range;
}
@Override
public void run()
{
// Schedule new task only when necessary.
if ((_guard == null) || _guard.isDead() || (_player == null))
{
return;
}
ThreadPoolManager.getInstance().scheduleGeneral(new Healer(_player, _guard), _guard.isInCombat() ? 1000 : 3000);
// Guard is occupied. Use skills logic.
if (_guard.isInCombat())
{
L2PcInstance targetPlayer = null;
for (L2Character ch : _guard.getKnownList().getKnownCharacters())
{
if (ch.isPlayer() && !ch.isAlikeDead())
{
targetPlayer = (L2PcInstance) ch;
break;
}
}
for (Skill skill : _guard.getSkills().values())
{
if ((targetPlayer != null) && !targetPlayer.isAlikeDead() //
&& !skill.isBad() && !_guard.isCastingNow() && (_guard.calculateDistance(targetPlayer, false, false) < skill.getCastRange()))
{
_guard.setHeading(Util.calculateHeadingFrom(_guard, targetPlayer));
_guard.setTarget(targetPlayer);
skill.activateSkill(_guard, targetPlayer);
break;
}
}
return; // Guard is occupied, no need to proceed.
}
// Assist combat logic.
if (_player.isInCombat() && (_player.getTarget() != null) && _player.getTarget().isMonster() && !_player.getTarget().isInvul() //
&& ((L2Character) _player.getTarget()).isInCombat() && !((L2Character) _player.getTarget()).isAlikeDead())
{
if (_guard.calculateDistance(_player.getTarget(), false, false) > 50)
{
_guard.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, _player.getTarget().getLocation());
}
else if (_guard.getTarget() != _player.getTarget())
{
_guard.addDamageHate((L2Character) _player.getTarget(), 0, 1000);
}
}
// Try to kill nearby monsters logic.
for (L2Character ch : _guard.getKnownList().getKnownCharacters())
{
if (ch.isMonster() && !ch.isInvul() && !ch.isAlikeDead())
{
_guard.addDamageHate(ch, 0, 1000);
break;
}
}
// Out of combat follow logic.
if (!_guard.isInCombat())
{
final int moveToLocX = _player.getLocation().getX() + Rnd.get((_followRange * -1), _followRange);
final int moveToLocY = _player.getLocation().getY() + Rnd.get((_followRange * -1), _followRange);
final int moveToLocZ = _player.getLocation().getZ();
final Location moveToLocation = new Location(moveToLocX, moveToLocY, moveToLocZ);
_guard.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, moveToLocation);
}
}
}

View File

@ -23,6 +23,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.npc.FighterAI;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
@ -38,7 +39,6 @@ import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jmobius.gameserver.util.Util;
import instances.AbstractInstance;
import instances.KartiasLabyrinth.AI.Fighter;
import quests.Q00494_IncarnationOfGreedZellakaGroup.Q00494_IncarnationOfGreedZellakaGroup;
import quests.Q00495_IncarnationOfJealousyPellineGroup.Q00495_IncarnationOfJealousyPellineGroup;
import quests.Q00496_IncarnationOfGluttonyKaliosGroup.Q00496_IncarnationOfGluttonyKaliosGroup;
@ -831,23 +831,23 @@ public final class KartiasLabyrinth extends AbstractInstance
}
if (((KartiaWorld) world).adolph != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(player, ((KartiaWorld) world).adolph), 1000);
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((KartiaWorld) world).adolph), 1000);
}
if (((KartiaWorld) world).barton != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(player, ((KartiaWorld) world).barton), 1000);
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((KartiaWorld) world).barton), 1000);
}
if (((KartiaWorld) world).hayuk != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(player, ((KartiaWorld) world).hayuk), 1000);
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((KartiaWorld) world).hayuk), 1000);
}
if (((KartiaWorld) world).eliyah != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(player, ((KartiaWorld) world).eliyah), 1000);
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((KartiaWorld) world).eliyah), 1000);
}
if (((KartiaWorld) world).elise != null)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Fighter(player, ((KartiaWorld) world).elise), 1000);
ThreadPoolManager.getInstance().scheduleGeneral(new FighterAI(player, ((KartiaWorld) world).elise), 1000);
}
((KartiaWorld) world).savedSpawns.addAll(spawnGroup("wave1", world.getInstanceId()));
startQuestTimer("checkStatus", 5000, null, player, true);