Пример #1
0
        public override bool CanUseItem(Player player)
        {
            FoodBuffHandler mp = player.GetModPlayer <FoodBuffHandler>();

            if (player.HasBuff(BuffType <Full>()))
            {
                return(false);
            }

            if (Ingredients.Count > 0)
            {
                foreach (Item item in Ingredients)
                {
                    mp.Consumed.Add(item.DeepClone());
                }
                player.AddBuff(BuffType <FoodBuff>(), Fullness);
                player.AddBuff(BuffType <Full>(), (int)(Fullness * 1.5f));
            }
            else
            {
                Main.NewText("Bad food! Please report me to the mod devs.", Color.Red);
            }

            item.stack--;
            return(true);
        }
Пример #2
0
        public override bool CanUseItem(Player player)
        {
            int             totalfill = 0;
            FoodBuffHandler mp        = player.GetModPlayer <FoodBuffHandler>();

            if (mp.Full)
            {
                return(false);
            }

            player.AddBuff(ModContent.BuffType <FoodBuff>(), (seasoning != null) ? 18000 + seasoning.Modifier : 18000);

            mp.Buffs[0] = mains.Buff; mp.Powers[0] = (int)(mains.Strength * ((seasoning != null) ? seasoning.StrengthMod : 1));  totalfill += mains.Fill;
            if (side1 != null)
            {
                mp.Buffs[1] = side1.Buff; mp.Powers[1] = (int)(side1.Strength * ((seasoning != null) ? seasoning.StrengthMod : 1)); totalfill += side1.Fill;
            }
            else
            {
                mp.Buffs[1] = 0; mp.Powers[1] = 0;
            }
            if (side2 != null)
            {
                mp.Buffs[2] = side2.Buff; mp.Powers[2] = (int)(side2.Strength * ((seasoning != null) ? seasoning.StrengthMod : 1)); totalfill += side2.Fill;
            }
            else
            {
                mp.Buffs[2] = 0; mp.Powers[2] = 0;
            }
            if (seasoning != null)
            {
                totalfill += seasoning.Fill;
            }

            player.AddBuff(ModContent.BuffType <Full>(), totalfill);

            item.stack--;
            return(true);
        }