Esempio n. 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();
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 3
0
        public override void Action()
        {
            if (Projectile.LifeStats.IsDead())
            {
                if (Projectile.VisiblePlayers.Count == 0)
                {
                    CreatureLogic.ReleaseProjectile(Projectile);
                }
                return;
            }

            long now = Funcs.GetCurrentMilliseconds();

            if (now > DieUts)
            {
                Projectile.LifeStats.Kill();
                return;
            }

            if (MoveController != null)
            {
                long elapsed = now - LastCallUts;
                LastCallUts = now;

                MoveController.Action(elapsed);
            }

            var targets = Global.VisibleService.FindTargets((Creature)Projectile.Parent, Projectile.Position,
                                                            Projectile.AttackDistance + 40, TargetingAreaType.EnemyOrPvP);

            if (targets.Count > 0)
            {
                Global.SkillEngine.UseProjectileSkill(Projectile);
                Projectile.LifeStats.Kill();
            }
        }