Package ai

Source Code of ai.Shade

package ai;

import l2p.gameserver.ai.Fighter;
import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.instances.L2NpcInstance;

/**
* AI мобов Shade на Isle of Prayer, спавнятся из АИ DarkWaterDragon.<br>
* - Деспавнятся при простое более 5(?) минут<br>
* - Не используют функцию Random Walk<br>
* ID: 22268, 22269
*
* @author SYS
*/
public class Shade extends Fighter
{
  private long _wait_timeout = 0;
  private boolean _wait = false;
  private static final int DESPAWN_TIME = 5 * 60 * 1000; // 5 min

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

  @Override
  protected boolean thinkActive()
  {
    L2NpcInstance actor = getActor();
    if(actor == null || actor.isDead())
    {
      return true;
    }
    if(_def_think)
    {
      doTask();
      _wait = false;
      return true;
    }
    if(!_wait)
    {
      _wait = true;
      _wait_timeout = System.currentTimeMillis() + DESPAWN_TIME;
    }
    if(_wait_timeout != 0 && _wait && _wait_timeout < System.currentTimeMillis())
    {
      actor.deleteMe();
      return true;
    }
    return super.thinkActive();
  }

  @Override
  protected boolean randomWalk()
  {
    return false;
  }
}
TOP

Related Classes of ai.Shade

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.