示例#1
0
        public void ShouldGetExpectedShieldAdvantage_Normal()
        {
            var data = new ShieldAdvantageProblemData
            {
                FirstActionableFrame = 22,
                HitFrame = 20,
                Hitlag = 11,
                ShieldStun = 13,
                ShieldAdvantageModifier = ShieldAdvantageModifier.Regular,
                HitlagData = new HitlagProblemData
                {
                    CrouchingModifier = CrouchingModifier.NotCrouching,
                    Damage = 20,
                    ElectricModifier = ElectricModifier.NormalAttack,
                    HitlagMultiplier = 1
                }
            };

            var result = _calculator.ShieldAdvantage(data);
            Assert.That(result, Is.EqualTo(12));
        }
示例#2
0
        public void ShouldGetExpectedShieldAdvantage_Normal_Projectile_NotHitlag()
        {
            var data = new ShieldAdvantageProblemData
            {
                FirstActionableFrame = 22,
                HitFrame = 20,
                Hitlag = 11,
                ShieldStun = 13,
                ShieldAdvantageModifier = ShieldAdvantageModifier.ProjectileNotHitlag,
                HitlagData = new HitlagProblemData
                {
                    CrouchingModifier = CrouchingModifier.NotCrouching,
                    Damage = 20,
                    ElectricModifier = ElectricModifier.NormalAttack,
                    HitlagMultiplier = 1
                }
            };

            var result = _calculator.ShieldAdvantage(data);
            Assert.That(result, Is.EqualTo(24), "Fail expected.  Bug in official calc up where it doesn't Floor when proj shield adv mod.");
        }
示例#3
0
        /// <summary>
        /// Returns the calculated shield advantage.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int ShieldAdvantage(ShieldAdvantageProblemData data)
        {
            var shieldAdvantage = data.HitFrame - (data.FirstActionableFrame - 1) + data.ShieldStun;

            if (data.HitlagData == null)
            { throw new Exception($"{nameof(data.HitlagData)} cannot be null."); }

            switch (data.ShieldAdvantageModifier)
            {
                case ShieldAdvantageModifier.ProjectileNotHitlag:
                    {
                        var hitlag = Hitlag(data.HitlagData);
                        shieldAdvantage = shieldAdvantage + hitlag;//(int)(Convert.ToDouble(shieldAdvantage) + Math.Round(hitlag));
                        break;
                    }
                case ShieldAdvantageModifier.Regular:
                    {
                        //shieldAdvantage = shieldAdvantage - hitlag;
                        break;
                    }
                default:
                    {
                        break;
                    }
            }

            return shieldAdvantage;
        }