Example #1
0
        public static double GetFireballDamage(AProjectile proj, ACombatUnit unit) // без учета сколько жизней осталось
        {
            var    dist   = proj.GetDistanceTo(unit) - unit.Radius;
            double damage = 0;

            if (dist <= MyStrategy.Game.FireballExplosionMaxDamageRange)
            {
                damage += proj.Damage;
            }
            else if (dist <= MyStrategy.Game.FireballExplosionMinDamageRange)
            {
                var ratio = 1 - (dist - MyStrategy.Game.FireballExplosionMaxDamageRange) / (MyStrategy.Game.FireballExplosionMinDamageRange - MyStrategy.Game.FireballExplosionMaxDamageRange);
                damage += ratio * (proj.Damage - proj.MinDamage) + proj.MinDamage;
            }
            return(damage);
        }