Beispiel #1
0
        public int GetNuclearDamage(ANuclear nuclear)
        {
            var dist2 = GetDistanceTo2(nuclear);

            if (dist2 >= G.TacticalNuclearStrikeRadius * G.TacticalNuclearStrikeRadius)
            {
                return(0);
            }
            var damage = (int)((1 - Math.Sqrt(dist2) / G.TacticalNuclearStrikeRadius) * G.MaxTacticalNuclearStrikeDamage);

            return(Math.Min(damage, Durability));
        }
Beispiel #2
0
        private double _nuclearGetDamage(AVehicle veh, Sandbox env, double lowerBound, List <AVehicle> targets, out ANuclear nuclearResult)
        {
            var vr  = veh.ActualVisionRange * 0.9;
            var cen = Utility.Average(targets);

            cen = veh + (cen - veh).Normalized() * Math.Min(vr, veh.GetDistanceTo(cen));
            var nuclear = new ANuclear(cen.X, cen.Y, true, veh.Id, G.TacticalNuclearStrikeDelay);

            nuclearResult = nuclear;

            var totalOpponentDamage = targets.Sum(x => x.GetNuclearDamage(nuclear));

            if (totalOpponentDamage <= lowerBound)
            {
                return(totalOpponentDamage);
            }

            var totalDamage = totalOpponentDamage -
                              env.GetMyNeighbours(nuclear.X, nuclear.Y, nuclear.Radius)
                              .Sum(x => x.GetNuclearDamage(nuclear));

            return(totalDamage);
        }