Package ai

Source Code of ai.ZakenDaytime83

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

import lineage2.commons.threading.RunnableImpl;
import lineage2.commons.util.Rnd;
import lineage2.gameserver.ThreadPoolManager;
import lineage2.gameserver.ai.Fighter;
import lineage2.gameserver.model.Creature;
import lineage2.gameserver.model.entity.Reflection;
import lineage2.gameserver.model.instances.NpcInstance;
import lineage2.gameserver.network.serverpackets.PlaySound;
import lineage2.gameserver.tables.SkillTable;
import lineage2.gameserver.utils.Location;

/**
* @author Mobius
* @version $Revision: 1.0 $
*/
public class ZakenDaytime83 extends Fighter
{
  /**
   * Field _locations.
   */
  static final Location[] _locations = new Location[]
  {
    new Location(55272, 219112, -3496),
    new Location(56296, 218072, -3496),
    new Location(54232, 218072, -3496),
    new Location(54248, 220136, -3496),
    new Location(56296, 220136, -3496),
    new Location(55272, 219112, -3224),
    new Location(56296, 218072, -3224),
    new Location(54232, 218072, -3224),
    new Location(54248, 220136, -3224),
    new Location(56296, 220136, -3224),
    new Location(55272, 219112, -2952),
    new Location(56296, 218072, -2952),
    new Location(54232, 218072, -2952),
    new Location(54248, 220136, -2952),
    new Location(56296, 220136, -2952)
  };
  /**
   * Field _teleportSelfTimer.
   */
  private long _teleportSelfTimer = 0L;
  /**
   * Field _teleportSelfReuse.
   */
  private static final long _teleportSelfReuse = 120000L;
  /**
   * Field actor.
   */
  final NpcInstance actor = getActor();
 
  /**
   * Constructor for ZakenDaytime83.
   * @param actor NpcInstance
   */
  public ZakenDaytime83(NpcInstance actor)
  {
    super(actor);
    MAX_PURSUE_RANGE = Integer.MAX_VALUE >> 1;
  }
 
  /**
   * Method thinkAttack.
   */
  @Override
  protected void thinkAttack()
  {
    if ((_teleportSelfTimer + _teleportSelfReuse) < System.currentTimeMillis())
    {
      _teleportSelfTimer = System.currentTimeMillis();
      if (Rnd.chance(20))
      {
        actor.doCast(SkillTable.getInstance().getInfo(4222, 1), actor, false);
        ThreadPoolManager.getInstance().schedule(new RunnableImpl()
        {
          @Override
          public void runImpl()
          {
            actor.teleToLocation(_locations[Rnd.get(_locations.length)]);
            actor.getAggroList().clear(true);
          }
        }, 500);
      }
    }
    super.thinkAttack();
  }
 
  /**
   * Method onEvtDead.
   * @param killer Creature
   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    final Reflection r = actor.getReflection();
    r.setReenterTime(System.currentTimeMillis());
    actor.broadcastPacket(new PlaySound(PlaySound.Type.MUSIC, "BS02_D", 1, actor.getObjectId(), actor.getLoc()));
    super.onEvtDead(killer);
  }
 
  /**
   * Method teleportHome.
   */
  @Override
  protected void teleportHome()
  {
    return;
  }
}
TOP

Related Classes of ai.ZakenDaytime83

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.