Esempio n. 1
0
        internal PotionEffect GetPotionEffect(IngredientEffect ingredientEffect, PerkConfiguration perks)
        {
            var powerFactor = GetPowerFactor(ingredientEffect, perks);

            float magnitude       = ingredientEffect.magicEffect.noMagnitude ? 0 : ingredientEffect.magnitude;
            var   magnitudeFactor = ingredientEffect.magicEffect.powerAffectsMag ? powerFactor : 1.0f;

            magnitude *= magnitudeFactor;

            float duration       = ingredientEffect.magicEffect.noDuration ? 0 : ingredientEffect.duration;
            var   durationFactor = ingredientEffect.magicEffect.powerAffectsDur ? powerFactor : 1.0f;

            duration *= durationFactor;

            //magnitudeFactor = 1; //Used in the wiki calculations
            //if (magnitude < 0) magnitudeFactor = magnitude;
            //durationFactor = 1; //Used in the wiki calculations
            //if (duration < 0) durationFactor = duration / 10.0f;

            var durationCost  = Math.Pow(durationFactor, 1.1);
            var magnitudeCost = Math.Pow(Math.Round(magnitudeFactor), 1.1);
            var value         = ingredientEffect.value * magnitudeCost * durationCost;

            return(new PotionEffect(ingredientEffect: ingredientEffect,
                                    magnitude: ingredientEffect.magicEffect.noMagnitude ? 0 : (int)Math.Floor(magnitude),
                                    duration: ingredientEffect.magicEffect.noDuration ? 0 : (int)Math.Floor(duration)));
        }
Esempio n. 2
0
        public Potion(IEnumerable <Ingredient> ingredients, PerkConfiguration perks)
        {
            this.ingredients   = ingredients.Distinct().ToArray();
            this.perks         = perks;
            ingredientEffects  = ProcessIngredients(this.ingredients);
            highestValueEffect = ingredientEffects.OrderByDescending(effect => effect.value).FirstOrDefault();

            foreach (IngredientEffect effect in ingredientEffects)
            {
                GetPotionEffect(effect, perks);
            }
        }
Esempio n. 3
0
        internal float GetPowerFactor(IngredientEffect ingredientEffect, PerkConfiguration perks)
        {
            float physicianPerkMultiplier = perks.PhysicianPerk &&
                                            (ingredientEffect.name == "Restore Health" ||
                                             ingredientEffect.name == "Restore Magicka" ||
                                             ingredientEffect.name == "Restore Stamina") ? 1.25f : 1.0f;

            float benefactorPerkMultiplier = perks.BenefactorPerk &&
                                             IsPotion &&
                                             ingredientEffect.magicEffect.beneficial ? 1.25f : 1.0f;

            float poisonerPerkMultiplier = perks.PoisonerPerk &&
                                           IsPoison &&
                                           ingredientEffect.magicEffect.HasKeyword("MagicAlchHarmful") ? 1.25f : 1.0f;

            float powerFactor = ingredientMult
                                * (1.0f + (skillFactor - 1.0f) * perks.AlchemySkill / 100.0f)
                                * (1.0f + perks.FortifyAlchemy / 100.0f)
                                * (1.0f + perks.AlchemistPerk / 100.0f)
                                * physicianPerkMultiplier * benefactorPerkMultiplier * poisonerPerkMultiplier;

            return(powerFactor);
        }