Package ai

Source Code of ai.FangOfSplendor

package ai;

import l2p.gameserver.ai.CtrlEvent;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.L2Spawn;
import l2p.gameserver.model.instances.L2MonsterInstance;
import l2p.gameserver.model.instances.L2NpcInstance;
import l2p.gameserver.tables.NpcTable;
import l2p.util.Rnd;

public class FangOfSplendor extends Fighter
{
  public FangOfSplendor(L2Character actor)
  {
    super(actor);
  }

  @Override
  protected void onEvtAttacked(L2Character attacker, int damage)
  {
    L2NpcInstance actor = getActor();
    if(actor == null)
    {
      return;
    }
    try
    {
      if(!(((L2MonsterInstance) actor).getChampion() > 0) && actor.getCurrentHpPercents() > 50 && Rnd.chance(5))
      {
        L2Spawn spawn = new L2Spawn(NpcTable.getTemplate(21538));
        spawn.setLoc(actor.getLoc());
        L2NpcInstance npc = spawn.doSpawn(true);
        npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, 100);
        actor.decayMe();
        actor.doDie(actor);
        return;
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    super.onEvtAttacked(attacker, damage);
  }
}
TOP

Related Classes of ai.FangOfSplendor

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.