Example #1
0
        private void CheckUnconsciousness()
        {
            if (!IsUnconscious || Environment.InAir)
            {
                return;
            }

            var cat     = AniCatalog.Unconscious;
            var dropJob = _Uncon == Unconsciousness.Front ? cat.DropFront : cat.DropBack;

            if (dropJob == null)
            {
                return;
            }

            var aa = ModelInst.GetActiveAniFromLayer(1);

            if (aa != null)
            {
                var job = (ScriptAniJob)aa.AniJob.ScriptObject;
                if (job == dropJob || job == dropJob.NextAni)
                {
                    return;
                }

                var standJob = _Uncon == Unconsciousness.Front ? cat.StandUpFront : cat.StandUpBack;
                if (standJob != null && standJob == job)
                {
                    return;
                }
            }

            ModelInst.StartAniJob(dropJob);
        }
Example #2
0
        public bool IsAiming()
        {
            var drawnWeapon = GetDrawnWeapon();

            if (drawnWeapon != null && drawnWeapon.IsWepRanged)
            {
                var aa = ModelInst.GetActiveAniFromLayer(1);
                if (aa != null)
                {
                    var scriptJob = aa.AniJob.ScriptObject;
                    return(scriptJob == AniCatalog.FightBow.Aiming || scriptJob == AniCatalog.FightXBow.Aiming);
                }
            }
            return(false);
        }
Example #3
0
        private void ChangePosDir(Vec3f oldPos, Angles oldAng, NPCMovement oldMovement)
        {
            Vec3f pos = GetPosition();

            var env = Environment;

            if (env.InAir)
            {
                if (pos.Y > highestY)
                {
                    highestY = pos.Y;
                }
            }
            else if (highestY != 0)
            {
                float dmg = 0.14f * (highestY - pos.Y) - 135;
                if (dmg > 0)
                {
                    Logger.Log("Damage: " + dmg);
                    //this.SetHealth(this.HP - (int)dmg);
                    highestY = 0;
                }
            }


            if (lastRegPos.GetDistance(pos) > 30.0f)
            {
                LastHitMove = GameTime.Ticks;
                lastRegPos  = pos;
            }

            if (FightAnimation != null && CanCombo && Movement != NPCMovement.Stand)
            {
                // so the npc can instantly stop the attack and run into a direction
                ModelInst.StopAnimation(FightAnimation, false);
            }


            if (env.WaterLevel > 0.7f)
            {
                if (IsPlayer)
                {
                    //var client = ((Arena.ArenaClient)this.Client);
                    //client.KillCharacter();
                    //if (Arena.GameModes.Horde.HordeMode.IsActive && this.TeamID >= 0)
                    //{
                    //    Arena.GameModes.Horde.HordeMode.ActiveMode.RespawnClient(client);
                    //}
                }
                else
                {
                    SetHealth(0);
                }
            }

            if (env.InAir && !IsClimbing)
            {
                var aa = ModelInst.GetActiveAniFromLayer(1);
                if (aa != null)
                {
                    ModelInst.StopAnimation(aa, false);
                }
            }


            CheckUnconsciousness();
        }