Пример #1
0
        /// <summary>
        /// Reduces hunger by amount and handles weight gain/loss
        /// and stat bonuses.
        /// </summary>
        /// <remarks>
        /// Body and stat changes are applied inside Creature,
        /// on MabiTick (every 5 minutes).
        /// </remarks>
        protected void Feed(Creature creature, double hunger, double weight = 0, double upper = 0, double lower = 0, double str = 0, double int_ = 0, double dex = 0, double will = 0, double luck = 0, double life = 0, double mana = 0, double stm = 0)
        {
            // Saturday: Food effects are increased. (2x weight, hunger; effects are long term)
            // +100%? Seems a lot, but that's what the Wiki says.
            if (ErinnTime.Now.Month == ErinnMonth.Samhain)
            {
                hunger *= 2;
                weight *= 2;
                upper  *= 2;
                lower  *= 2;
            }

            // Hunger
            var diff = creature.Hunger;

            creature.Hunger -= (float)hunger;
            diff            -= creature.Hunger;

            // Weight (multiplicators guessed, based on packets)
            // Only increase weight if you eat above 0% Hunger?
            if (diff < hunger)
            {
                creature.Temp.WeightFoodChange += (float)weight * (weight >= 0 ? WeightChangePlus : WeightChangeMinus);
                creature.Temp.UpperFoodChange  += (float)upper * (upper >= 0 ? WeightChangePlus : WeightChangeMinus);
                creature.Temp.LowerFoodChange  += (float)lower * (lower >= 0 ? WeightChangePlus : WeightChangeMinus);
            }

            // Stats
            creature.Temp.StrFoodChange  += MabiMath.FoodStatBonus(str, hunger, diff, creature.Age);
            creature.Temp.IntFoodChange  += MabiMath.FoodStatBonus(int_, hunger, diff, creature.Age);
            creature.Temp.DexFoodChange  += MabiMath.FoodStatBonus(dex, hunger, diff, creature.Age);
            creature.Temp.WillFoodChange += MabiMath.FoodStatBonus(will, hunger, diff, creature.Age);
            creature.Temp.LuckFoodChange += MabiMath.FoodStatBonus(luck, hunger, diff, creature.Age);
        }
Пример #2
0
        /// <summary>
        /// Reduces hunger by amount and handles weight gain/loss
        /// and stat bonuses.
        /// </summary>
        /// <remarks>
        /// Body and stat changes are applied inside Creature,
        /// on MabiTick (every 5 minutes).
        /// </remarks>
        protected void Feed(Creature creature, double hunger, double weight = 0, double upper = 0, double lower = 0, double str = 0, double int_ = 0, double dex = 0, double will = 0, double luck = 0, double life = 0, double mana = 0, double stm = 0)
        {
            // Hunger
            var diff = creature.Hunger;

            creature.Hunger -= (float)hunger;
            diff            -= creature.Hunger;

            // Weight (multiplicators guessed, based on packets)
            // Only increase weight if you eat above 0% Hunger?
            if (diff < hunger)
            {
                creature.Temp.WeightFoodChange += (float)weight * (weight >= 0 ? WeightChangePlus : WeightChangeMinus);
                creature.Temp.UpperFoodChange  += (float)upper * (upper >= 0 ? WeightChangePlus : WeightChangeMinus);
                creature.Temp.LowerFoodChange  += (float)lower * (lower >= 0 ? WeightChangePlus : WeightChangeMinus);
            }

            // Stats
            creature.Temp.StrFoodChange  += MabiMath.FoodStatBonus(str, hunger, diff, creature.Age);
            creature.Temp.IntFoodChange  += MabiMath.FoodStatBonus(int_, hunger, diff, creature.Age);
            creature.Temp.DexFoodChange  += MabiMath.FoodStatBonus(dex, hunger, diff, creature.Age);
            creature.Temp.WillFoodChange += MabiMath.FoodStatBonus(will, hunger, diff, creature.Age);
            creature.Temp.LuckFoodChange += MabiMath.FoodStatBonus(luck, hunger, diff, creature.Age);
        }