/*
 * Copyright (C) 2005-2008 L2J_JP / 2008-2013 L2J-SFJP
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server 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 Server 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 com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
import com.l2jserver.util.Rnd;

/**
 * デルー リザードマン コマンド
 * Delu Lizardman Special Agent
 */
public class DeluLizardmanSpecialAgent extends Quest
{
	private static final int DELU_LIZARDMAN_SPECIAL_AGENT = 21105;
	
	private static int[] SAY1 =
	{
		1000288,	//$s1! How dare you interrupt our fight! Hey guys, help!	$s1！邪魔をするとはけしからん！おぉい、手を貸してくれ！
		1000388,	//$s1! Hey! We're having a duel here!						$s1！よくも対決を妨害してくれたな！愚か者め！
	};
	
	private static int[] SAY2 =
	{
		1000389,	//The duel is over! Attack!		一対一の対決は終わりだ！皆の者、やってしまえ！
		1000390,	//Foul! Kill the coward!		反則だ！皆の者、卑怯者を始末しろ！
		1000391,	//How dare you interrupt a sacred duel! You must be taught a lesson!	神聖な決闘を妨害するとは！ただではおかないぞ！
		1000392,	//Die, you coward!				卑怯者！消えろ！
		1000393,	//What are you looking at?		邪魔者は消えろ！
		1000394,	//Kill the coward!				卑怯者に死を！
	};
	
	private DeluLizardmanSpecialAgent(int questId, String name, String descr)
	{
		super(questId, name, descr);
		addAttackId(DELU_LIZARDMAN_SPECIAL_AGENT);
//		addSpellFinishedId(DELU_LIZARDMAN_SPECIAL_AGENT);
	}
	
	@Override
	public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
	{
		if (npc.getCurrentHp() == npc.getMaxHp())
			npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), SAY1[Rnd.get(SAY1.length)]).addPcName(attacker));
		else if (Rnd.get(20) == 0)
			npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), SAY2[Rnd.get(SAY2.length)]));
		return null;
	}
	
//	@Override
//	public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
//	{
//		if (Rnd.get(100) > npc.getSkillChance())
//			npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), SAY2[Rnd.get(SAY2.length)]));
//		return null;
//	}
	
	public static void main(String[] args)
	{
		new DeluLizardmanSpecialAgent(-1, "DeluLizardmanSpecialAgent", "ai");
	}
}
