예제 #1
0
        //Actions:

        public override void Action()
        {
            if (Npc.NpcTemplate.IsVillager || Npc.NpcTemplate.IsObject)
            {
                return;
            }

            long now = RandomUtilities.GetCurrentMilliseconds();

            if (Npc.LifeStats.IsDead())
            {
                if (RespawnUts == 0)
                {
                    CreatureLogic.NpcDied(Npc);
                    RespawnUts = now + 20000;
                    return;
                }

                if (now < RespawnUts || Global.MapService.IsDungeon(Npc.Position.MapId))
                {
                    return;
                }

                RespawnUts = 0;
                Npc.BindPoint.CopyTo(Npc.Position);

                MoveController.Reset();
                BattleController.Reset();

                Npc.LifeStats.Rebirth();
            }

            long elapsed = now - LastCallUts;

            LastCallUts = now;

            MoveController.Action(elapsed);
            BattleController.Action();

            //if (Npc.VisiblePlayers.Count < 1) return;

            EnemiesListenAction();

            if (NextChangeDirectionUts < now)
            {
                RandomWalkAction();
            }
        }
예제 #2
0
        public override void Action()
        {
            long now = Funcs.GetCurrentMilliseconds();

            if (Npc.LifeStats.IsDead())
            {
                if (RespawnUts == 0)
                {
                    CreatureLogic.NpcDied(Npc);
                    new DelayedAction(SendDiedAction, 1000);
                    RespawnUts = now + 20000;
                    return;
                }

                if (now < RespawnUts)
                {
                    return;
                }

                RespawnUts = 0;
                Npc.BindPoint.CopyTo(Npc.Position);

                MoveController.Reset();
                BattleController.Reset();

                Npc.LifeStats.Rebirth();

                return;
            }

            long elapsed = now - LastCallUts;

            LastCallUts = now;

            MoveController.Action(elapsed);
            BattleController.Action();

            if (Npc.NpcTemplate.Auto == 1)
            {
                EnemiesListenAction();
            }

            if (NextChangeDirectionUts < now && Npc.NpcTemplate.Npc != 1)
            {
                RandomWalkAction();
            }
        }