static List <EffectException> GetExceptions(string filename, bool ignoreFirstLine = true)
        {
            List <EffectException> exceptions = new List <EffectException>();

            using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(filename))
            {
                parser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited;
                parser.SetDelimiters(",");
                if (ignoreFirstLine)
                {
                    parser.ReadFields();
                }
                while (!parser.EndOfData)
                {
                    string[] fields = parser.ReadFields();
                    if (fields.Length == 5)
                    {
                        EffectException e = new EffectException(fields[0],
                                                                fields[1],
                                                                fields[2],
                                                                fields[3],
                                                                fields[4]);
                        exceptions.Add(e);
                    }
                }
            }
            return(exceptions);
        }
        float GetEffectValue(Effect effect)
        {
            float magnitudeFactor = 1.0f,
                  durationFactor  = 1.0f,
                  magnitude       = GetEffectMagnitude(effect),
                  duration        = GetEffectDuration(effect);

            if (magnitude > 0)
            {
                magnitudeFactor = magnitude;
            }
            if (duration > 0)
            {
                durationFactor = duration / 10.0f;
            }
            float value = (float)((float)effect.baseCost * (float)Math.Pow(magnitudeFactor * durationFactor, 1.1f));

            //apply exception
            EffectException exception = GetException(effect);

            if (exception != null)
            {
                value *= exception.value;
            }

            return(value);
        }
        float GetEffectMagnitude(Effect effect)
        {
            float mag = effect.baseMag;

            if (effect.powerAffectsMagnitude)
            {
                mag  = effect.baseMag;
                mag *= fAlchemyIngredientInitMult;
                mag *= (1.0f + (fAlchemySkillFactor - 1.0f) * (alchemySkill / 100.0f)); //* (1.0f + (alchemySkill / 200.0f))
                mag *= (1.0f + fortifyAlchemy / 100.0f);
                mag *= (1.0f + alchemistPerk / 100.0f);
                mag *= (1.0f + GetPhysicianPerk(effect) / 100.0f);
                mag *= (1.0f + GetBenefactorPerk(effect) / 100.0f + GetPoisonerPerk(effect) / 100.0f);
                mag *= (1.0f + (seekerOfShadows ? 10.0f : 0) / 100.0f);
            }

            //apply exception
            EffectException exception = GetException(effect);

            if (exception != null)
            {
                mag *= exception.magnitude;
            }

            return(mag);
        }
 EffectException GetException(Effect effect)
 {
     if (applyExceptions)
     {
         Ingredient highestValueIngredient = GetHighestValueIngredient(effect);
         var        exception = EffectException.GetException(highestValueIngredient, effect);
         return(exception);
     }
     else
     {
         return(null);
     }
 }
        List <EffectException> GetAllExceptions()
        {
            List <EffectException> exceptions = new List <EffectException>();

            foreach (Effect effect in effects)
            {
                EffectException exception = GetException(effect);
                if (exception != null)
                {
                    exceptions.Add(exception);
                }
            }
            return(exceptions);
        }
        public static List <EffectException> GetExceptions(List <Ingredient> ingredients, List <Effect> effects)
        {
            List <EffectException> exceptions = new List <EffectException>();

            foreach (Ingredient ingredient in ingredients)
            {
                foreach (Effect effect in effects)
                {
                    EffectException exception = GetException(ingredient.name, effect.name);
                    if (exception != null && !exceptions.Contains(exception))
                    {
                        exceptions.Add(exception);
                    }
                }
            }
            return(exceptions);
        }
        float GetEffectDuration(Effect effect)
        {
            float durationFactor = 1.0f;

            if (effect.baseDur == 0 || effect.baseDur < 0)
            {
                durationFactor = 1.0f;
            }
            if (effect.powerAffectsDuration)
            {
                durationFactor = GetPowerFactor(effect);
            }
            float finalDuration = effect.baseDur * durationFactor;

            //apply exception
            EffectException exception = GetException(effect);

            if (exception != null)
            {
                finalDuration *= exception.duration;
            }

            return((int)Math.Round(finalDuration));
        }