예제 #1
0
        /// <summary>
        /// "Conjured" items degrade in Quality twice as fast as normal items
        /// </summary>
        public override void UpdateQuality()
        {
            SellIn -= 1;

            Quality -= SellIn >= 0 ? 2 : 4;

            Quality = ItemQualityHelper.SetToMinQuality(this, MinQuality);
        }
예제 #2
0
        /// <summary>
        /// "Aged Brie" actually increases in Quality the older it gets
        /// The Quality of an item is never more than 50
        /// </summary>
        public override void UpdateQuality()
        {
            SellIn -= 1;

            Quality += SellIn >= 0 ? 1 : 2;

            Quality = ItemQualityHelper.SetToMaxQuality(this, MaxQuality);
        }
        public void Update(Item item)
        {
            if (item.Quality > 0)
            {
                item.Quality -= QualityChangeValue;
            }

            item.SellIn -= SellInChangeValue;

            if (item.SellIn < 0)
            {
                if (item.Quality > 0)
                {
                    item.Quality -= QualityChangeValue;
                }
            }

            ItemQualityHelper.EnsureQualityIsNotNegative(item);
        }
        /// <summary>
        /// "Backstage passes", like aged brie, increases in Quality as its SellIn value approaches
        /// Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but
        /// Quality drops to 0 after the concert
        /// </summary>
        public override void UpdateQuality()
        {
            SellIn -= 1;

            if (SellIn >= 0)
            {
                if (SellIn >= 5)
                {
                    Quality += SellIn >= 10 ? 1 : 2;
                }
                else
                {
                    Quality += 3;
                }
            }
            else
            {
                Quality = MinQuality;
            }

            Quality = ItemQualityHelper.SetToMaxQuality(this, MaxQuality);
        }
예제 #5
0
        public void Update(Item item)
        {
            // Taken from requirements.
            // - At the end of each day our system lowers both (edit: Quality and SellIn) values for every item.
            // - The Quality of an item is never negative.
            if (item.Quality > 0)
            {
                item.Quality -= ReductionValue;
            }

            item.SellIn -= ReductionValue;

            // - Once the sell by date has passed, Quality degrades twice as fast.
            if (item.SellIn < 0)
            {
                // Just reduce the quality once more.
                if (item.Quality > 0)
                {
                    item.Quality -= ReductionValue;
                }
            }

            ItemQualityHelper.EnsureQualityIsNotNegative(item);
        }