/*
 * 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.DoubleMobs;

import com.festina.gameserver.model.actor.instance.L2NpcInstance;
import com.festina.gameserver.model.actor.instance.L2PcInstance;
import com.festina.gameserver.SpawnTable;
import com.festina.gameserver.templates.L2NpcTemplate;
import com.festina.gameserver.model.L2Spawn;
import com.festina.gameserver.NpcTable;
import ai.L2AttackableAIScript;

/**
 * @author Zomb1eKiller
 * 
 * Double mobs :)
 *
 */
public class OrcShaman extends L2AttackableAIScript
{
	private static final int Orc = 1020;

	public OrcShaman (int questId, String name, String descr)
	{
        super(questId,name,descr);
        int[] mobs = {Orc};
        registerMobs(mobs);
	}

 
    public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
    {
        int npcId = npc.getNpcId();
        if (npcId == Orc)
        {
    		L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(1259);
    		try {
    		L2Spawn s = new L2Spawn(template1);
		s.setLocx(npc.getX());
    		s.setLocy(npc.getY());
    		s.setLocz(npc.getZ());
    		s.setRespawnDelay(0);
		s.setAmount(1);
    		s.setHeading(npc.getHeading());
		System.out.println("Here");
    		SpawnTable.getInstance().addNewSpawn(s, false);
    		s.init();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    		
        	npc.deleteMe();
        }
        return super.onAttack(npc, attacker, damage, isPet);
    }

    public static void main(String[] args)
    {
    	// now call the constructor (starts up the ai)
    	new OrcShaman(-1,"orc_shaman","ai");
    }
}