示例#1
0
        public static void StatsFromTurret()
        {
            Building_TurretGun turret = (Building_TurretGun)UnittestUtils.GetThingByName("Turret_MiniTurret");
            RangedWeaponStats  stats  = new RangedWeaponStats(turret);

            // Base stats
            Assert(stats.shotDamage).To.Be.EqualTo(11);
            Assert(stats.warmup).To.Be.Approximately(0f);
            Assert(stats.cooldown).To.Be.Approximately(4.80f);

            Assert(stats.BurstShotCount).To.Be.EqualTo(2);
            Assert(stats.BurstDelayTicks).To.Be.EqualTo(8);

            Assert(stats.MinRange).To.Be.Approximately(0f);
            Assert(stats.MaxRange).To.Be.Approximately(28.9f);

            Assert(stats.AccuracyTouch).To.Be.Approximately(0.70f);
            Assert(stats.AccuracyShort).To.Be.Approximately(0.64f);
            Assert(stats.AccuracyMedium).To.Be.Approximately(0.41f);
            Assert(stats.AccuracyLong).To.Be.Approximately(0.22f);

            // Derived stats
            Assert(stats.GetFullCycleTime()).To.Be.Approximately(4.933333f);
            Assert(stats.GetRawDPS()).To.Be.Approximately(4.4595f);
            Assert(stats.FindOptimalRange()).To.Be.Approximately(1f);

            Assert(stats.GetAdjustedHitChanceFactor(1f)).To.Be.Approximately(0.70f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(3f)).To.Be.Approximately(0.70f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(12f)).To.Be.Approximately(0.64f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(25f)).To.Be.Approximately(0.41f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(28.9f)).To.Be.Approximately(0.361f, DERIVED_DELTA);

            Assert(stats.GetAdjustedDPS(1f)).To.Be.Approximately(0.70f * 4.4595f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(3f)).To.Be.Approximately(0.70f * 4.4595f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(12f)).To.Be.Approximately(0.64f * 4.4595f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(25f)).To.Be.Approximately(0.41f * 4.4595f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(28.9f)).To.Be.Approximately(0.361f * 4.4595f, DERIVED_DELTA);
        }
示例#2
0
        public static void StatsFromSingleShotGun()
        {
            Thing             gun   = UnittestUtils.GetThingByName("Gun_BoltActionRifle");
            RangedWeaponStats stats = new RangedWeaponStats(gun);

            // Base stats
            Assert(stats.shotDamage).To.Be.EqualTo(18);
            Assert(stats.warmup).To.Be.Approximately(1.7f);
            Assert(stats.cooldown).To.Be.Approximately(1.5f);

            Assert(stats.BurstShotCount).To.Be.EqualTo(1);

            Assert(stats.MinRange).To.Be.Approximately(0f);
            Assert(stats.MaxRange).To.Be.Approximately(36.9f);

            Assert(stats.AccuracyTouch).To.Be.Approximately(0.65f);
            Assert(stats.AccuracyShort).To.Be.Approximately(0.80f);
            Assert(stats.AccuracyMedium).To.Be.Approximately(0.90f);
            Assert(stats.AccuracyLong).To.Be.Approximately(0.80f);

            // Derived stats
            Assert(stats.GetFullCycleTime()).To.Be.Approximately(3.2f);
            Assert(stats.GetRawDPS()).To.Be.Approximately(5.625f);
            Assert(stats.FindOptimalRange()).To.Be.Approximately(25f);

            Assert(stats.GetAdjustedHitChanceFactor(1f)).To.Be.Approximately(0.65f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(3f)).To.Be.Approximately(0.65f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(12f)).To.Be.Approximately(0.80f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(25f)).To.Be.Approximately(0.90f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(36.9f)).To.Be.Approximately(0.821f, DERIVED_DELTA);

            Assert(stats.GetAdjustedDPS(1f)).To.Be.Approximately(0.65f * 5.625f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(3f)).To.Be.Approximately(0.65f * 5.625f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(12f)).To.Be.Approximately(0.80f * 5.625f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(25f)).To.Be.Approximately(0.90f * 5.625f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(36.9f)).To.Be.Approximately(0.821f * 5.625f, DERIVED_DELTA);
        }
示例#3
0
        public static void StatsFromBurstFireGun()
        {
            Thing             gun   = UnittestUtils.GetThingByName("Gun_HeavySMG");
            RangedWeaponStats stats = new RangedWeaponStats(gun);

            // Base stats
            Assert(stats.shotDamage).To.Be.EqualTo(12);
            Assert(stats.warmup).To.Be.Approximately(0.9f);
            Assert(stats.cooldown).To.Be.Approximately(1.65f);

            Assert(stats.BurstShotCount).To.Be.EqualTo(3);
            Assert(stats.BurstDelayTicks).To.Be.EqualTo(11);

            Assert(stats.MinRange).To.Be.Approximately(0f);
            Assert(stats.MaxRange).To.Be.Approximately(22.9f);

            Assert(stats.AccuracyTouch).To.Be.Approximately(0.85f);
            Assert(stats.AccuracyShort).To.Be.Approximately(0.65f);
            Assert(stats.AccuracyMedium).To.Be.Approximately(0.35f);
            Assert(stats.AccuracyLong).To.Be.Approximately(0.20f);

            // Derived stats
            Assert(stats.GetFullCycleTime()).To.Be.Approximately(2.916667f);
            Assert(stats.GetRawDPS()).To.Be.Approximately(12.3429f);
            Assert(stats.FindOptimalRange()).To.Be.Approximately(1f);

            Assert(stats.GetAdjustedHitChanceFactor(1f)).To.Be.Approximately(0.85f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(3f)).To.Be.Approximately(0.85f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(12f)).To.Be.Approximately(0.65f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(22.9f)).To.Be.Approximately(0.398f, DERIVED_DELTA);

            Assert(stats.GetAdjustedDPS(1f)).To.Be.Approximately(0.85f * 12.3429f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(3f)).To.Be.Approximately(0.85f * 12.3429f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(12f)).To.Be.Approximately(0.65f * 12.3429f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(22.9f)).To.Be.Approximately(0.398f * 12.3429f, DERIVED_DELTA);
        }
示例#4
0
        public static void WeaponQualityAffectsStats()
        {
            Thing             gun   = UnittestUtils.GetThingByName("Gun_HeavySMG", quality: QualityCategory.Legendary);
            RangedWeaponStats stats = new RangedWeaponStats(gun);

            // Base stats
            Assert(stats.shotDamage).To.Be.EqualTo(18);
            Assert(stats.warmup).To.Be.Approximately(0.9f);
            Assert(stats.cooldown).To.Be.Approximately(1.65f);

            Assert(stats.BurstShotCount).To.Be.EqualTo(3);
            Assert(stats.BurstDelayTicks).To.Be.EqualTo(11);

            Assert(stats.MinRange).To.Be.Approximately(0f);
            Assert(stats.MaxRange).To.Be.Approximately(22.9f);

            Assert(stats.AccuracyTouch).To.Be.Approximately(1.00f);
            Assert(stats.AccuracyShort).To.Be.Approximately(0.975f);
            Assert(stats.AccuracyMedium).To.Be.Approximately(0.525f);
            Assert(stats.AccuracyLong).To.Be.Approximately(0.30f);

            // Derived stats
            Assert(stats.GetFullCycleTime()).To.Be.Approximately(2.916667f);
            Assert(stats.GetRawDPS()).To.Be.Approximately(18.5143f);
            Assert(stats.FindOptimalRange()).To.Be.Approximately(1f);

            Assert(stats.GetAdjustedHitChanceFactor(1f)).To.Be.Approximately(1.00f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(3f)).To.Be.Approximately(1.00f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(12f)).To.Be.Approximately(0.975f, DERIVED_DELTA);
            Assert(stats.GetAdjustedHitChanceFactor(22.9f)).To.Be.Approximately(0.598f, DERIVED_DELTA);

            Assert(stats.GetAdjustedDPS(1f)).To.Be.Approximately(1.00f * 18.5143f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(3f)).To.Be.Approximately(1.00f * 18.5143f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(12f)).To.Be.Approximately(0.975f * 18.5143f, DERIVED_DELTA);
            Assert(stats.GetAdjustedDPS(22.9f)).To.Be.Approximately(0.598f * 18.5143f, DERIVED_DELTA);
        }