示例#1
0
        public Meal(string mealName)
        {
            Console.WriteLine($"\t=> Loading Meal {mealName}");

            var meal = Program.Meals[Program.MealNameMapper[mealName]];

            nameEn  = meal.NameEn;
            nameKo  = string.IsNullOrEmpty(meal.NameKo) ? null : meal.NameKo;
            iconSrc = Utility.GetImage(meal);

            mealAttribute = new MealAttribute();

            foreach (var paramKey in meal.Parameters.Keys)
            {
                var foodValue = meal.Parameters[paramKey];
                var mealValue = new MealValue(foodValue);

                switch (paramKey)
                {
                case "Critical Hit":
                    mealAttribute.ch = mealValue;
                    break;

                case "Direct Hit Rate":
                    mealAttribute.dh = mealValue;
                    break;

                case "Determination":
                    mealAttribute.det = mealValue;
                    break;

                case "Skill Speed":
                    mealAttribute.sks = mealValue;
                    break;

                case "Spell Speed":
                    mealAttribute.sps = mealValue;
                    break;

                case "Tenacity":
                    mealAttribute.ten = mealValue;
                    break;

                case "Piety":
                    mealAttribute.pie = mealValue;
                    break;
                }
            }
        }
        public void ApplyFood(MealAttribute mealAttribute)
        {
            if (mealAttribute.ch != null)
            {
                ch += Math.Min((int)Math.Floor((double)ch * mealAttribute.ch.value / 100.0d), mealAttribute.ch.max);
            }

            if (mealAttribute.dh != null)
            {
                dh += Math.Min((int)Math.Floor((double)dh * mealAttribute.dh.value / 100.0d), mealAttribute.dh.max);
            }

            if (mealAttribute.det != null)
            {
                det += Math.Min((int)Math.Floor((double)det * mealAttribute.det.value / 100.0d),
                                mealAttribute.det.max);
            }

            if (mealAttribute.sks != null)
            {
                sks += Math.Min((int)Math.Floor((double)sks * mealAttribute.sks.value / 100.0d),
                                mealAttribute.sks.max);
            }

            if (mealAttribute.sps != null)
            {
                sps += Math.Min((int)Math.Floor((double)sps * mealAttribute.sps.value / 100.0d),
                                mealAttribute.sps.max);
            }

            if (mealAttribute.ten != null)
            {
                ten += Math.Min((int)Math.Floor((double)ten * mealAttribute.ten.value / 100.0d),
                                mealAttribute.ten.max);
            }
            if (mealAttribute.pie != null)
            {
                pie += Math.Min((int)Math.Floor((double)pie * mealAttribute.pie.value / 100.0d),
                                mealAttribute.pie.max);
            }
        }