Package ai

Source Code of ai.RankuScapegoat

package ai;

import l2p.gameserver.ai.CtrlEvent;
import l2p.gameserver.ai.DefaultAI;
import l2p.gameserver.idfactory.IdFactory;
import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.instances.L2MinionInstance;
import l2p.gameserver.model.instances.L2MonsterInstance;
import l2p.gameserver.model.instances.L2NpcInstance;
import l2p.gameserver.tables.NpcTable;
import l2p.util.Location;
import l2p.util.MinionList;

/**
* AI Миньона боса Ranku.<br>
* При смерти превращается в злого миньона Eidolon
*
* @author SYS
*/
public class RankuScapegoat extends DefaultAI
{
  private static final int Eidolon_ID = 25543;

  public RankuScapegoat(L2Character actor)
  {
    super(actor);
  }

  @Override
  protected void onEvtDead(L2Character killer)
  {
    L2NpcInstance actor = getActor();
    if(actor == null)
    {
      return;
    }
    L2MonsterInstance boss = ((L2MinionInstance) actor).getLeader();
    if(boss != null && !boss.isDead())
    {
      Location loc = actor.getLoc();
      L2MinionInstance newMinion = new L2MinionInstance(IdFactory.getInstance().getNextId(), NpcTable.getTemplate(Eidolon_ID), boss);
      newMinion.setSpawnedLoc(loc);
      newMinion.onSpawn();
      newMinion.spawnMe(loc);
      newMinion.getAI().setGlobalAggro(0);
      newMinion.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, boss.getRandomHated(), 1);
      MinionList ml = boss.getMinionList();
      if(ml != null)
      {
        ml.addSpawnedMinion(newMinion);
      }
    }
    super.onEvtDead(killer);
  }
}
TOP

Related Classes of ai.RankuScapegoat

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.