Пример #1
0
        public override float GetRemainingTime(Hero hero = null)
        {
            if (hero == null)
            {
                hero = Hero;
            }

            var position = ProjectileTarget?.NetworkPosition ?? hero.NetworkPosition;

            if (position.Distance2D(AbilityOwner) <= GetRadius())
            {
                return(StartCast + CastPoint - Game.RawGameTime);
            }

            if (AbilityOwner.AghanimState())
            {
                return(StartCast + CastPoint
                       + (position.Distance2D(StartPosition) - GetProjectileRadius(position) - 60)
                       / GetProjectileSpeed() - Game.RawGameTime);
            }

            return(StartCast + (FowCast ? -0.1f : CastPoint)
                   + Math.Max(position.Distance2D(GetProjectilePosition(FowCast)) - 100 - GetRadius(), 0)
                   / GetProjectileSpeed() - Game.RawGameTime);
        }
Пример #2
0
        protected override Vector3 GetProjectilePosition(bool ignoreCastPoint = false)
        {
            if (AbilityOwner.AghanimState())
            {
                return(IsInPhase
                           ? StartPosition
                           : StartPosition.Extend(
                           EndPosition,
                           (Game.RawGameTime - StartCast - (ignoreCastPoint ? 0 : CastPoint)) * GetProjectileSpeed()));
            }

            return(ProjectileAdded ? ProjectilePostion : StartPosition);
        }
Пример #3
0
        public override void Draw()
        {
            if (Obstacle == null)
            {
                return;
            }

            AbilityDrawer.DrawTime(GetRemainingTime(), AbilityOwner.Position);

            if (AbilityOwner.AghanimState())
            {
                AbilityDrawer.DrawCircle(StartPosition, GetRadius());
            }
            else
            {
                AbilityDrawer.DrawRectangle(StartPosition, EndPosition, GetRadius());
            }
        }
Пример #4
0
 public override void Check()
 {
     if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
     {
         StartCast = Game.RawGameTime;
         EndCast   = StartCast + CastPoint + AdditionalDelay;
     }
     else if (StartCast > 0 && Obstacle == null && CanBeStopped() && !AbilityOwner.IsTurning())
     {
         StartPosition = AbilityOwner.NetworkPosition;
         EndPosition   = AbilityOwner.InFront(GetCastRange() + 150);
         Obstacle      = AbilityOwner.AghanimState()
                        ? Pathfinder.AddObstacle(StartPosition, GetRadius(), Obstacle)
                        : Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
     }
     else if (StartCast > 0 && Game.RawGameTime > EndCast)
     {
         End();
     }
 }
Пример #5
0
        public override void Check()
        {
            if (AbilityOwner.AghanimState())
            {
                if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
                {
                    StartCast = Game.RawGameTime;
                    EndCast   = StartCast + CastPoint + AdditionalDelay + GetCastRange() / GetProjectileSpeed();
                }
                else if (StartCast > 0 && Obstacle == null && CanBeStopped() && !AbilityOwner.IsTurning())
                {
                    StartPosition = AbilityOwner.NetworkPosition;
                    EndPosition   = AbilityOwner.InFront(GetCastRange() + GetRadius() / 2);
                    Obstacle      = Pathfinder.AddObstacle(
                        StartPosition,
                        EndPosition,
                        GetRadius(),
                        GetEndRadius(),
                        Obstacle);
                }
                else if (StartCast > 0 && Game.RawGameTime > EndCast)
                {
                    End();
                }
                else if (Obstacle != null && !CanBeStopped())
                {
                    Pathfinder.UpdateObstacle(Obstacle.Value, GetProjectilePosition(), GetRadius(), GetEndRadius());
                }
            }
            else
            {
                if (StartCast <= 0 && IsInPhase && AbilityOwner.IsVisible)
                {
                    StartCast     = Game.RawGameTime;
                    EndCast       = StartCast + CastPoint + GetCastRange() / GetProjectileSpeed();
                    StartPosition = AbilityOwner.NetworkPosition;
                    EndPosition   = AbilityOwner.InFront(GetCastRange());
                    Obstacle      = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
                }
                else if (ProjectileTarget != null && Obstacle == null && !FowCast)
                {
                    FowCast       = true;
                    StartCast     = Game.RawGameTime;
                    EndCast       = StartCast + GetCastRange() / GetProjectileSpeed();
                    StartPosition = AbilityOwner.NetworkPosition;
                    EndPosition   = StartPosition.Extend(ProjectileTarget.Position, GetCastRange());
                    Obstacle      = Pathfinder.AddObstacle(StartPosition, EndPosition, GetRadius(), Obstacle);
                }
                else if (StartCast > 0 && Game.RawGameTime > EndCast)
                {
                    End();
                }
                else if (Obstacle != null)
                {
                    if (!ProjectileLaunched())
                    {
                        EndPosition = AbilityOwner.InFront(GetCastRange());
                        Pathfinder.UpdateObstacle(Obstacle.Value, StartPosition, EndPosition);
                        AbilityDrawer.UpdateRectanglePosition(StartPosition, EndPosition, GetRadius());
                    }
                    else if (ProjectileTarget != null)
                    {
                        var projectilePosition = GetProjectilePosition(FowCast);

                        if (projectilePosition == LastProjectilePosition)
                        {
                            End();
                            return;
                        }

                        LastProjectilePosition = projectilePosition;

                        AbilityDrawer.Dispose(AbilityDrawer.Type.Rectangle);
                        //    EndCast = Game.RawGameTime + GetProjectilePosition(fowCast).Distance2D(projectileTarget) / GetProjectileSpeed();
                        EndPosition = StartPosition.Extend(
                            ProjectileTarget.Position,
                            ProjectileTarget.Distance2D(StartPosition) + GetRadius());
                        Pathfinder.UpdateObstacle(
                            Obstacle.Value,
                            ProjectileTarget.NetworkPosition.Extend(StartPosition, GetRadius()),
                            ProjectileTarget.NetworkPosition.Extend(EndPosition, GetRadius()));
                    }
                }
            }
        }
Пример #6
0
 protected override float GetRadius()
 {
     return(AbilityOwner.AghanimState() ? aghanimProjectileRadius : base.GetRadius());
 }
Пример #7
0
 public override bool IgnoreRemainingTime(UsableAbility ability, float remainingTime = 0)
 {
     return(!AbilityOwner.AghanimState() && base.IgnoreRemainingTime(ability, remainingTime));
 }
Пример #8
0
 public override float GetProjectileSpeed()
 {
     return(AbilityOwner.AghanimState() ? aghanimProjectileSpeed : base.GetProjectileSpeed());
 }
Пример #9
0
 private float GetDuration()
 {
     return(AbilityOwner.AghanimState() ? aghanimDuration : duration);
 }
Пример #10
0
 protected override float GetRadius()
 {
     return(AbilityOwner.AghanimState() ? 400 : base.GetRadius());
 }
Пример #11
0
 protected override float GetCastRange()
 {
     return(base.GetCastRange() + (AbilityOwner.AghanimState() ? GetRadius() : 0));
 }
Пример #12
0
        private float GetEclipseDuration()
        {
            var level = Ability.Level - 1;

            return(AbilityOwner.AghanimState() ? durationAghanim[level] : duration[level]);
        }