コード例 #1
0
        public static decimal GetMagnitude(IAlchemyEffect effect, decimal powerFactor)
        {
            var magnitudeFactor = effect.PowerAffectsMagnitude()
                ? powerFactor
                : 1;

            return(Math.Round(effect.Magnitude * magnitudeFactor, MidpointRounding.AwayFromZero));
        }
コード例 #2
0
        public static decimal GetDuration(IAlchemyEffect effect, decimal powerFactor)
        {
            var durationFactor = effect.PowerAffectsDuration()
                ? powerFactor
                : 1;

            return(Math.Round(Math.Max(effect.Duration, 0) * durationFactor, MidpointRounding.AwayFromZero));
        }
コード例 #3
0
ファイル: PerksFormulae.cs プロジェクト: cheng93/skyrim-tool
        private static decimal GetPoisonerPerkFactor(IAlchemyEffect effect, IEnumerable <IPerk <AlchemySkill> > perks)
        {
            var hasPoisonerPerk = perks.OfType <PoisonerPerk>().Any();

            return(hasPoisonerPerk && !effect.IsPositiveEffect
                ? 25
                : 0);
        }
コード例 #4
0
        public void SameEffect(IAlchemyEffect effect)
        {
            var result = Subject.Create(effect, 1, 1, 1);

            result.Should().BeOfType(AllAlchemyEffects.CureDisease.GetType());
            result.Cost.Should().Be(1);
            result.Duration.Should().Be(1);
            result.Magnitude.Should().Be(1);
        }
コード例 #5
0
ファイル: PerksFormulae.cs プロジェクト: cheng93/skyrim-tool
        public static decimal GetPerks(IAlchemyEffect effect, IEnumerable <IPerk <AlchemySkill> > perks)
        {
            var alchemistPerkFactor  = GetAlchemistPerkFactor(perks);
            var physicianPerkFactor  = GetPhysicianPerkFactor(effect, perks);
            var benefactorPerkFactor = GetBenefactorPerkFactor(effect, perks);
            var poisonerPerkFactor   = GetPoisonerPerkFactor(effect, perks);

            return((1 + alchemistPerkFactor / 100)
                   * (1 + physicianPerkFactor / 100)
                   * (1 + benefactorPerkFactor / 100 + poisonerPerkFactor / 100));
        }
コード例 #6
0
ファイル: CostFormulae.cs プロジェクト: cheng93/skyrim-tool
        public static decimal GetCost(IAlchemyEffect effect, decimal magnitude, decimal duration)
        {
            var magnitudeFactor = magnitude > 0
                ? magnitude
                : 1;

            var durationFactor = duration > 0
                ? duration / 10
                : 1;

            return(Math.Floor(effect.Cost * (decimal)Math.Pow((double)(magnitudeFactor * durationFactor), 1.1)));
        }
コード例 #7
0
 private static IAlchemyEffect Create(
     this IAlchemyEffect effect,
     decimal costFactor      = 1,
     decimal durationFactor  = 1,
     decimal magnitudeFactor = 1)
 {
     return(new AlchemyEffectFactory()
            .Create(
                effect,
                effect.Cost * costFactor,
                effect.Duration * durationFactor,
                effect.Magnitude * magnitudeFactor));
 }
コード例 #8
0
ファイル: PerksFormulae.cs プロジェクト: cheng93/skyrim-tool
        private static decimal GetPhysicianPerkFactor(IAlchemyEffect effect, IEnumerable <IPerk <AlchemySkill> > perks)
        {
            var hasPhysicianPerk         = perks.OfType <PhysicianPerk>().Any();
            var isRestoreAttributeEffect = new []
            {
                AllAlchemyEffects.RestoreHealth,
                AllAlchemyEffects.RestoreMagicka,
                AllAlchemyEffects.RestoreStamina
            }.Contains(effect, new IHasIdEqualityComparer());

            return(hasPhysicianPerk && isRestoreAttributeEffect
                ? 25
                : 0);
        }
コード例 #9
0
        protected void TestAndAssert(
            IAlchemyEffect effect,
            decimal baseCost,
            decimal cost,
            decimal duration,
            decimal magnitude)
        {
            var results = Subject.GetResults(effect, Options.Object);

            results.BaseCost.Should().Be(baseCost);
            results.Cost.Should().Be(cost);
            results.Duration.Should().Be(duration);
            results.Magnitude.Should().Be(magnitude);
        }
コード例 #10
0
        public AlchemyFormulaeResults GetResults(IAlchemyEffect effect, IAlchemyOptions options)
        {
            var baseFactor = BaseFormulae.GetBase(effect, options);
            var perkFactor = PerksFormulae.GetPerks(effect, options.Perks);

            var baseMagnitude = MagnitudeFormulae.GetMagnitude(effect, baseFactor);
            var magnitude     = MagnitudeFormulae.GetMagnitude(effect, baseFactor * perkFactor);

            var baseDuration = DurationFormulae.GetDuration(effect, baseFactor);
            var duration     = DurationFormulae.GetDuration(effect, baseFactor * perkFactor);

            var baseCost = CostFormulae.GetCost(effect, baseMagnitude, baseDuration);
            var cost     = CostFormulae.GetCost(effect, magnitude, duration);

            return(new AlchemyFormulaeResults(
                       baseCost,
                       cost,
                       duration,
                       magnitude));
        }
コード例 #11
0
        public void Test(
            IAlchemyEffect effect,
            decimal baseCost,
            decimal cost,
            decimal duration,
            decimal magnitude)
        {
            Options
            .Setup(x => x.Perks)
            .Returns(new [] { Perk });

            Options
            .Setup(x => x.AlchemyLevel)
            .Returns(SkillConstants.MaxLevel);

            Options
            .Setup(x => x.FortifyAlchemyPercent)
            .Returns(0);

            TestAndAssert(effect, baseCost, cost, duration, magnitude);
        }
コード例 #12
0
        public void Test(
            IAlchemyEffect effect,
            decimal baseCost,
            decimal cost,
            decimal duration,
            decimal magnitude)
        {
            Options
            .Setup(x => x.Perks)
            .Returns(Enumerable.Empty <IPerk <AlchemySkill> >());

            Options
            .Setup(x => x.AlchemyLevel)
            .Returns(SkillConstants.MaxLevel);

            Options
            .Setup(x => x.FortifyAlchemyPercent)
            .Returns(50);

            TestAndAssert(effect, baseCost, cost, duration, magnitude);
        }
コード例 #13
0
 public static bool PowerAffectsDuration(this IAlchemyEffect e) => durationAffects.Contains(e);
コード例 #14
0
 public IAlchemyEffect Create(IAlchemyEffect e, decimal cost, decimal duration, decimal magnitude) => map[e](cost, duration, magnitude);
コード例 #15
0
ファイル: ScaleTest.cs プロジェクト: cheng93/skyrim-tool
        public void Magnitude(IAlchemyEffect effect, decimal expected)
        {
            var actual = effect.ScaleMagnitude(2);

            actual.Magnitude.Should().Be(expected);
        }
コード例 #16
0
ファイル: ScaleTest.cs プロジェクト: cheng93/skyrim-tool
        public void Duration(IAlchemyEffect effect, decimal expected)
        {
            var actual = effect.ScaleDuration(2);

            actual.Duration.Should().Be(expected);
        }
コード例 #17
0
ファイル: ScaleTest.cs プロジェクト: cheng93/skyrim-tool
        public void Cost(IAlchemyEffect effect, decimal expected)
        {
            var actual = effect.ScaleCost(2);

            actual.Cost.Should().Be(expected);
        }
コード例 #18
0
 public IEffectIngredientPriority Create(IAlchemyEffect effect) => effectMap[effect];
コード例 #19
0
 public static decimal GetBase(IAlchemyEffect effect, IAlchemyOptions options)
 {
     return(AlchemyConstants.IngredientMultiplier
            * (1 + (AlchemyConstants.AlchemySkillFactor - 1) * (decimal)options.AlchemyLevel / 100)
            * (1 + options.FortifyAlchemyPercent / 100));
 }
コード例 #20
0
 internal static IAlchemyEffect ScaleCost(this IAlchemyEffect effect, decimal factor)
 {
     return(Create(effect, costFactor: factor));
 }
コード例 #21
0
 internal static IAlchemyEffect ScaleDuration(this IAlchemyEffect effect, decimal factor)
 {
     return(Create(effect, durationFactor: factor));
 }
コード例 #22
0
 public static bool PowerAffectsMagnitude(this IAlchemyEffect e) => !durationAffects.Contains(e);
コード例 #23
0
 internal static IAlchemyEffect ScaleMagnitude(this IAlchemyEffect effect, decimal factor)
 {
     return(Create(effect, magnitudeFactor: factor));
 }
コード例 #24
0
        public void SameEffect(IAlchemyEffect effect)
        {
            var result = Subject.Create(effect);

            result.Should().BeOfType(typeof(DamageHealthIngredientPriority));
        }