Exemplo n.º 1
0
        public override DamageData.Target CalculateDamage()
        {
            DamageData.Target finalState = this.CurrentTarget;
            DamageData.HEData he         = _heData;
            he.Power = CalculatedPowerDropoff(he.Power, he.EffectiveRadius, _distanceToCentre);

            // Does not consider ERA
            if (CurrentTarget.Armor >= ARMOR_CUTOFF)
            {
                // The HE round has no effect on such a heavily armored target
                return(finalState);
            }
            else
            {
                // Lookup multiplier from the table
                float armorMultiplier;
                bool  lookupSuccessful = ArmorToHEMultiplier.TryGetValue((int)CurrentTarget.Armor, out armorMultiplier);
                if (lookupSuccessful)
                {
                    he.Power           = he.Power * armorMultiplier;
                    finalState.Health -= he.Power * he.HealthDamageFactor;
                    return(finalState);
                }
                else
                {
                    throw new Exception("target armor value not in lookup table");
                }
            }
        }
Exemplo n.º 2
0
        public override DamageData.Target CalculateDamage()
        {
            DamageData.Target      finalState = this.CurrentTarget;
            DamageData.KineticData ke         = _keData;

            Logger.LogDamage($"Initial KE dmg is {ke.Power}");

            // Calculate attenuation of air friction
            ke.Power = CalculateKEAttenuationSimple(
                ke.Power,
                _distance,
                ke.Friction
                );

            Logger.LogDamage($"Attenuated KE dmg is {ke.Power}");

            // Hack because the formulas below do not work, remove when fixed:
            finalState.Health -= ke.Power;
            return(finalState);

            //if (finalState.EraData.Value > 0.0f) {
            //    // Calculate effects of ERA
            //    float finalEra = Math.Max(
            //        0.0f,
            //        finalState.EraData.Value - ke.Power * finalState.EraData.KEFractionMultiplier
            //    );
            //    finalState.EraData.Value = finalEra;

            //    ke.Power = CalculatePostEraPower(
            //        ke.Power,
            //        finalState.EraData.KEFractionMultiplier
            //    );
            //    Logger.LogDamage($"Post ERA KE dmg is {ke.Power}");
            //}

            //// Armor degradation
            //float finalArmor = Math.Max(
            //    0.0f,
            //    finalState.Armor - (ke.Power / finalState.Armor) * ke.Degradation
            //);
            //finalState.Armor = finalArmor;

            //// Calculate final damage
            //float finalDamage = Math.Max(
            //    0.0f,
            //    (ke.Power - finalState.Armor) * ke.HealthDamageFactor
            //);
            //Logger.LogDamage($"Final KE dmg is {finalDamage}");
            //float finalHealth = Math.Max(
            //    0.0f,
            //    finalState.Health - finalDamage
            //);
            //finalState.Health = finalHealth;

            //return finalState;
        }
Exemplo n.º 3
0
 public override DamageData.Target CalculateDamage()
 {
     DamageData.Target finalState = CurrentTarget;
     if (finalState.Armor == 0)
     {
         // Deal full damage to light targets / infantry targets
         finalState.Health -= _smallArmsData.Power * _smallArmsData.HealthDamageFactor;
         return(finalState);
     }
     else
     {
         // No damage dealt
         return(finalState);
     }
 }
Exemplo n.º 4
0
        public override DamageData.Target CalculateDamage()
        {
            DamageData.Target   finalState = this.CurrentTarget;
            DamageData.HeatData heat       = _heatData;

            // No air friction attenuation as HEAT round detonates on surface of the armor

            if (finalState.EraData.Value > 0.0f)
            {
                // Calculate effects of ERA
                float finalEra = Math.Max(
                    0.0f,
                    finalState.EraData.Value - heat.Power * finalState.EraData.HeatFractionMultiplier
                    );
                finalState.EraData.Value = finalEra;

                heat.Power = CalculatePostEraPower(
                    heat.Power,
                    finalState.EraData.HeatFractionMultiplier
                    );
            }

            // Armor degradation
            float finalArmor = Math.Max(
                0.0f,
                finalState.Armor - (heat.Power / finalState.Armor) * heat.Degradation
                );

            finalState.Armor = finalArmor;

            // Calculate final damage
            float finalDamage = Math.Max(
                0.0f,
                (heat.Power - finalState.Armor) * heat.HealthDamageFactor
                );
            float finalHealth = Math.Max(
                0.0f,
                finalState.Health - finalDamage
                );

            finalState.Health = finalHealth;

            return(finalState);
        }
Exemplo n.º 5
0
        public override DamageData.Target CalculateDamage()
        {
            DamageData.Target finalState = this.CurrentTarget;

            // Armor degradation
            float finalArmor = Math.Max(
                0.0f,
                finalState.Armor - (_fireData.Power / finalState.Armor) * _fireData.Degradation
                );

            // Calculate damage
            // If the power is less than the armor, deal a minimum amount of damage
            // This represents the damage dealt to the crew due to high temperature and suffocation
            float finalDamage = Math.Max(
                0.0f,
                (_fireData.Power - finalState.Armor) * _fireData.HealthDamageFactor
                );

            finalDamage += _fireData.SuffocationDamage;

            finalState.Health -= finalDamage;
            return(finalState);
        }
Exemplo n.º 6
0
 public HEDamage(DamageData.HEData data, DamageData.Target target, float distanceToCentre) : base(DamageType.HE, target)
 {
     _heData           = data;
     _distanceToCentre = distanceToCentre;
 }
Exemplo n.º 7
0
 public FireDamage(DamageData.FireData data, DamageData.Target target) : base(DamageType.FIRE, target)
 {
     _fireData = data;
 }
Exemplo n.º 8
0
 public KEDamage(DamageData.KineticData data, DamageData.Target target, float distance)
     : base(DamageType.KE, target)
 {
     _keData   = data;
     _distance = distance;
 }
Exemplo n.º 9
0
 public SmallArmsDamage(DamageData.SmallArmsData data, DamageData.Target target) : base(DamageType.SMALLARMS, target)
 {
     _smallArmsData = data;
 }
Exemplo n.º 10
0
 public HeatDamage(DamageData.HeatData data, DamageData.Target target)
     : base(DamageType.HEAT, target)
 {
     _heatData = data;
 }