Skip to content
Snippets Groups Projects
Commit 180c135a authored by Zoey76's avatar Zoey76
Browse files

BETA: Datapack part for [L6366]:

	* Implemented `SummonPc` AI.
	* Removed custom skill handler `GetPlayer`.
	* Implemented skill Summon PC (4161) retail like.
		* It's just visual skill, used by multiple AIs.
parent 80c866d4
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,7 @@ ai/group_template/Slaves.java
ai/group_template/StakatoNest.java
ai/group_template/StarStones.java
ai/group_template/SummonMinions.java
ai/group_template/SummonPc.java
ai/group_template/TurekOrcs.java
ai/group_template/VarkaKetra.java
ai/group_template/WarriorFishingBlock.java
......
/*
* 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.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.skills.L2Skill;
/**
* Summon Pc AI.<br>
* Summon the player to the NPC on attack.
* @author Zoey76
*/
public final class SummonPc extends AbstractNpcAI
{
// NPCs
private static final int PORTA = 20213;
private static final int PERUM = 20221;
// Skill
private static final SkillHolder SUMMON_PC = new SkillHolder(4161, 1);
private SummonPc()
{
super(SummonPc.class.getSimpleName(), "ai/group_template");
addAttackId(PORTA, PERUM);
addSpellFinishedId(PORTA, PERUM);
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
final int chance = getRandom(100);
final boolean attacked = npc.getVariables().getBoolean("attacked", false);
if ((npc.calculateDistance(attacker, true, false) > 300) && !attacked)
{
if (chance < 50)
{
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
}
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
}
else if ((npc.calculateDistance(attacker, true, false) > 100) && !attacked)
{
final L2Attackable monster = (L2Attackable) npc;
if (monster.getMostHated() != null)
{
if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10))
{
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
}
}
return super.onAttack(npc, attacker, damage, isSummon);
}
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
{
if ((skill.getId() == SUMMON_PC.getSkillId()) && !npc.isDead() && npc.getVariables().getBoolean("attacked", false))
{
player.teleToLocation(npc);
npc.getVariables().set("attacked", false);
}
return super.onSpellFinished(npc, player, skill);
}
public static void main(String[] args)
{
new SummonPc();
}
}
......@@ -115,8 +115,8 @@ public final class Venom extends AbstractNpcAI
_massymore = SpawnTable.getInstance().getFirstSpawn(DUNGEON_KEEPER).getLastSpawn();
_venom = SpawnTable.getInstance().getFirstSpawn(VENOM).getLastSpawn();
_loc = _venom.getLocation();
_venom.disableSkill(VENOM_TELEPORT.getSkill(), 0);
_venom.disableSkill(RANGE_TELEPORT.getSkill(), 0);
_venom.disableSkill(VENOM_TELEPORT.getSkill(), -1);
_venom.disableSkill(RANGE_TELEPORT.getSkill(), -1);
_venom.doRevive();
((L2Attackable) _venom).setCanReturnToSpawnPoint(false);
if (checkStatus() == DEAD)
......@@ -234,8 +234,8 @@ public final class Venom extends AbstractNpcAI
if ((_venom != null) && !_venom.isDead())
{
changeLocation(MoveTo.PRISON);
_venom.disableSkill(VENOM_TELEPORT.getSkill(), 0);
_venom.disableSkill(RANGE_TELEPORT.getSkill(), 0);
_venom.disableSkill(VENOM_TELEPORT.getSkill(), -1);
_venom.disableSkill(RANGE_TELEPORT.getSkill(), -1);
}
updateStatus(ALIVE);
cancelQuestTimer("tower_check", _venom, null);
......
......@@ -210,7 +210,6 @@ import handlers.skillhandlers.Detection;
import handlers.skillhandlers.Dummy;
import handlers.skillhandlers.Fishing;
import handlers.skillhandlers.FishingSkill;
import handlers.skillhandlers.GetPlayer;
import handlers.skillhandlers.NornilsPower;
import handlers.skillhandlers.Sow;
import handlers.skillhandlers.TakeFort;
......@@ -503,7 +502,6 @@ public class MasterHandler
Dummy.class,
Fishing.class,
FishingSkill.class,
GetPlayer.class,
NornilsPower.class,
Sow.class,
TakeFort.class,
......
......@@ -191,8 +191,8 @@ public class AdminBuffs implements IAdminCommandHandler
try
{
player.getSkillReuseTimeStamps().clear();
player.getDisabledSkills().clear();
player.resetTimeStamps();
player.resetDisabledSkills();
player.sendPacket(new SkillCoolTime(player));
activeChar.sendMessage("Skill reuse was removed from " + player.getName() + ".");
return true;
......
/*
* 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 handlers.skillhandlers;
import com.l2jserver.gameserver.handler.ISkillHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.skills.L2SkillType;
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
import com.l2jserver.util.Rnd;
/**
* Mobs can teleport players to them
*/
public class GetPlayer implements ISkillHandler
{
private static final L2SkillType[] SKILL_IDS =
{
L2SkillType.GET_PLAYER
};
@Override
public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
{
if (activeChar.isAlikeDead())
{
return;
}
for (L2Object target : targets)
{
if (target.isPlayer())
{
L2PcInstance trg = target.getActingPlayer();
if (trg.isAlikeDead())
{
continue;
}
// trg.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), true);
trg.setXYZ(activeChar.getX() + Rnd.get(-10, 10), activeChar.getY() + Rnd.get(-10, 10), activeChar.getZ());
trg.sendPacket(new ValidateLocation(trg));
}
}
}
@Override
public L2SkillType[] getSkillIds()
{
return SKILL_IDS;
}
}
......@@ -1284,7 +1284,7 @@
</for>
</skill>
<skill id="4161" levels="1" name="Summon PC">
<!-- Freya retail confirmed -->
<!-- Confirmed CT2.5 -->
<!-- Teleports player to mob (Porta/Perum skill) -->
<set name="castRange" val="600" />
<set name="effectPoint" val="-100" />
......@@ -1292,7 +1292,6 @@
<set name="hitTime" val="2000" />
<set name="magicLvl" val="1" />
<set name="operateType" val="A1" />
<set name="skillType" val="GET_PLAYER" />
<set name="targetType" val="ONE" />
</skill>
<skill id="4162" levels="3" name="Decrease P. Atk.">
......
......@@ -30351,7 +30351,6 @@ INSERT INTO `npcskills` VALUES
-- Porta
(20213, 4071, 1), -- Resist Archery
(20213, 4073, 4), -- Shock
(20213, 4161, 1), -- Summon PC
(20213, 4274, 1), -- Blunt Attack Weak Point
(20213, 4408, 11), -- HP Modifiers
(20213, 4409, 1), -- MP Modifiers
......@@ -30466,7 +30465,6 @@ INSERT INTO `npcskills` VALUES
-- Perum
(20221, 4071, 1), -- Resist Archery
(20221, 4073, 4), -- Shock
(20221, 4161, 1), -- Summon PC
(20221, 4274, 1), -- Blunt Attack Weak Point
(20221, 4408, 11), -- HP Modifiers
(20221, 4409, 1), -- MP Modifiers
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment