Apherus AI.

Contributed by gigilo1968.
This commit is contained in:
MobiusDev 2016-12-29 20:23:17 +00:00
parent bc0201f223
commit 794862a60d
6 changed files with 217 additions and 9 deletions

View File

@ -0,0 +1,196 @@
/*
* 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.areas.GardenOfGenesis.Apherus;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.TeleportWhereType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import ai.AbstractNpcAI;
/**
* Apherus RB
* @author Gigi
*/
public final class Apherus extends AbstractNpcAI
{
private static final int APHERUS = 25775;
private static final int APHERUS_SUBORDINATE = 25865;
private static final int[] APHERUS_DOOR_NPCS =
{
33133,
33134,
33135,
33136
};
private static int[] APHERUS_DOORS =
{
26210041,
26210042,
26210043,
26210044
};
private static final int[] APHERUS_DOOR_GUARD =
{
25776,
25777,
25778
};
private static final SkillHolder GARDEN_APHERUS_RECOVERY = new SkillHolder(14088, 1);
private static final SkillHolder APHERUS_INVICIBILITY = new SkillHolder(14201, 1);
private static final int APERUS_KEY = 17373;
private static final int APHERUS_ZONE_ID = 60060;
private static boolean _doorIsOpen = false;
public Apherus()
{
addAttackId(APHERUS);
addKillId(APHERUS);
addSpawnId(APHERUS);
addTalkId(APHERUS_DOOR_NPCS);
addStartNpc(APHERUS_DOOR_NPCS);
addFirstTalkId(APHERUS_DOOR_NPCS);
addEnterZoneId(APHERUS_ZONE_ID);
addExitZoneId(APHERUS_ZONE_ID);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("buff"))
{
L2World.getInstance().forEachVisibleObjectInRange(npc, L2Npc.class, 3000, apherus ->
{
if ((apherus.getId() == APHERUS))
{
apherus.stopSkillEffects(APHERUS_INVICIBILITY.getSkill());
}
});
return null;
}
return event;
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
if ((getRandom(120) < 2) && !npc.isDead())
{
final L2Npc minions = addSpawn(APHERUS_SUBORDINATE, npc.getX() + getRandom(-30, 30), npc.getY() + getRandom(-30, 30), npc.getZ(), npc.getHeading(), true, 300000, false);
addAttackPlayerDesire(minions, attacker);
}
return super.onAttack(npc, attacker, damage, isSummon);
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
L2World.getInstance().forEachVisibleObjectInRange(npc, L2Npc.class, 1500, minion ->
{
if (minion.getId() == APHERUS_SUBORDINATE)
{
minion.deleteMe();
}
});
return super.onKill(npc, killer, isSummon);
}
@Override
public String onSpawn(L2Npc npc)
{
APHERUS_INVICIBILITY.getSkill().applyEffects(npc, npc);
_doorIsOpen = false;
for (int door : APHERUS_DOORS)
{
closeDoor(door, npc.getInstanceId());
}
return super.onSpawn(npc);
}
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if (character.isRaid())
{
character.stopSkillEffects(GARDEN_APHERUS_RECOVERY.getSkill());
}
else if (character.isPlayable() && !_doorIsOpen && !character.isGM())
{
character.teleToLocation(TeleportWhereType.TOWN);
}
return super.onEnterZone(character, zone);
}
@Override
public String onExitZone(L2Character character, L2ZoneType zone)
{
if (character.isRaid())
{
GARDEN_APHERUS_RECOVERY.getSkill().applyEffects(character, character);
}
return super.onExitZone(character, zone);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (!_doorIsOpen)
{
if (!player.destroyItemByItemId("Apherus", APERUS_KEY, 1, player, true))
{
return "apherusDoor-no.html";
}
if (getRandom(100) > 60)
{
startQuestTimer("buff", 500, npc, player);
for (int door : APHERUS_DOORS)
{
openDoor(door, npc.getInstanceId());
}
npc.broadcastPacket(new ExShowScreenMessage(NpcStringId.APHERUS_GARDEN_DOOR_WAS_OPENED, ExShowScreenMessage.TOP_CENTER, 3000, true));
}
else
{
for (int i = 0; i < 4; i++)
{
final L2MonsterInstance protector = (L2MonsterInstance) addSpawn(APHERUS_DOOR_GUARD[getRandom(APHERUS_DOOR_GUARD.length)], player.getX() + getRandom(10, 30), player.getY() + getRandom(10, 30), player.getZ(), 0, false, 600000, false);
protector.setIsRunning(true);
protector.setTarget(player);
addAttackPlayerDesire(protector, player);
}
showOnScreenMsg(player, NpcStringId.S1_THE_KEY_DOES_NOT_MATCH_SO_WE_RE_IN_TROUBLE, ExShowScreenMessage.TOP_CENTER, 6000, true, player.getName());
}
}
else
{
return "apherusDoor-no.html";
}
return null;
}
public static void main(String[] args)
{
new Apherus();
}
}

View File

@ -0,0 +1,3 @@
<html><body>Apherus Garden Door:<br>
There is no key for the Apherus Garden Door.
</body></html>

View File

@ -1700,6 +1700,9 @@
<spawn>
<npc id="3481" x="205923" y="113567" z="-1793" dbSave="true" dbName="Control-crazed Mew the Cat" respawnTime="36hour" respawnRandom="24hour" /> <!-- Control-crazed Mew the Cat -->
</spawn>
<spawn>
<npc id="25775" x="213715" y="115261" z="-856" dbSave="true" dbName="Apherus" respawnTime="24hour" respawnRandom="3hour" /> <!-- Apherus -->
</spawn>
<spawn>
<npc id="25886" x="48986" y="145825" z="-3592" dbSave="true" dbName="Houpon the Warden Overseer" respawnTime="36hour" respawnRandom="24hour" /> <!-- Houpon the Warden Overseer -->
</spawn>

View File

@ -4440,10 +4440,10 @@
</parameters>
<race>PLANT</race>
<sex>MALE</sex>
<equipment rhand="150" /> <!-- Elemental Sword -->
<acquire exp="198916032" sp="47747" />
<mpReward value="53" type="DIFF" ticks="10" affects="PARTY" />
<stats str="164" int="188" dex="55" wit="78" con="111" men="149">
<vitals hp="1726809" hpRegen="8.5" mp="22800" mpRegen="30" />
<vitals hp="4111533" hpRegen="8.5" mp="45646" mpRegen="30" />
<attack physical="37184.6066131423" magical="6590.82182407988" attackSpeed="253" range="40" type="SWORD" distance="80" width="120" random="10" critical="4" accuracy="5" />
<defence physical="3333.00100834426" magical="1885.60138963509" />
<attribute>
@ -4472,8 +4472,8 @@
<skill id="14723" level="1" /> <!-- Raid Boss (Lv. 94) -->
<skill id="5465" level="1" /> <!-- Earth Attack -->
<skill id="4416" level="5" /> <!-- Undead -->
<skill id="14087" level="1" /> <!-- Apherus' Binding -->
<skill id="14765" level="4" /> <!-- Blood Siphon Resistance -->
<skill id="14462" level="1" /> <!-- Apherus Curse -->
<skill id="14465" level="1" /> <!-- Apherus' Binding -->
</skill_list>
<ai clanHelpRange="300" aggroRange="800" />
<status undying="false" />

View File

@ -36,17 +36,17 @@
<!-- Invincible status. -->
<icon>icon.skill0442</icon>
<operateType>A2</operateType>
<mpConsume>1</mpConsume>
<effectPoint>673</effectPoint>
<effectPoint>100</effectPoint>
<isMagic>1</isMagic> <!-- Magic Skill -->
<abnormalType>INVINCIBILITY</abnormalType>
<basicProperty>NONE</basicProperty>
<rideState>NONE</rideState>
<magicCriticalRate>-5</magicCriticalRate>
<specialLevel>-1</specialLevel>
<specialLevel>1</specialLevel>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>10</abnormalTime>
<abnormalTime>-1</abnormalTime>
<abnormalVisualEffect>INVINCIBILITY</abnormalVisualEffect>
<hitTime>500</hitTime>
<hitCancelTime>1</hitCancelTime>
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<effects>

View File

@ -753,4 +753,10 @@
<node X="15130" Y="-115345" />
<node X="14972" Y="-114864" />
</zone>
<zone name="Apherus Zone" id="60060" type="ScriptZone" shape="NPoly" minZ="-877" maxZ="-857">
<node X="214323" Y="115889" />
<node X="214324" Y="114625" />
<node X="213068" Y="114628" />
<node X="213058" Y="115891" />
</zone>
</list>