private void Degrade(Item item)
        {
            UpdateQuality(item);

            DecreaseSellIn(item);

            if (OutOfDate(item))
                UpdateQualityWhenOutOfDate(item);
        }
Exemple #2
0
 public static void UpdateItem(Item item)
 {
     IUpdater updater = UpdaterFactory.CreateUpdater(item);
     updater.UpdateItem(item);
     return;
 }
 private void DecrementNonLegendaryItem(Item item)
 {
     if (item.Name != legendaryItem)
     {
     item.Quality--;
     }
 }
        private void UpdateConcertTicketQuality(Item item)
        {
            if (item.Quality < MAXQUALITY)
                {
                    item.Quality++;

              if (item.Name == concertTickets)
                    {
                        if (item.SellIn < 11)
                        {
              Increment(item);
                        }

                        if (item.SellIn < 6)
                        {
              Increment(item);
                        }
                    }
                }
        }
 private void Increment(Item item)
 {
     if (item.Quality < MAXQUALITY)
     {
         item.Quality++;
     }
 }
        private void increaseQuality(Item item)
        {
            incrementQuality(item);

            if (item.Name == "Backstage passes to a TAFKAL80ETC concert")
            {
                if (item.SellIn < 11)
                {
                    incrementQuality(item);
                }

                if (item.SellIn < 6)
                {
                    incrementQuality(item);
                }
            }
        }
 private void decreaseQuality(Item item)
 {
     if (item.Quality > 0)
         item.Quality = item.Quality - 1;
 }
 private static bool IsMutable(Item item)
 {
     return item.Name != "Sulfuras, Hand of Ragnaros";
 }
 private static bool OutOfDate(Item item)
 {
     return item.SellIn < 0;
 }
 private static void DecreaseSellIn(Item item)
 {
     item.SellIn = item.SellIn - 1;
 }
 private void UpdateQualityWhenOutOfDate(Item item)
 {
     if (item.Name == "Aged Brie")
     {
         increaseQuality(item);
     } else if (item.Name == "Backstage passes to a TAFKAL80ETC concert")
     {
         item.Quality = 0;
     }
     else
     {
         decreaseQuality(item);
     }
 }
 private void UpdateQuality(Item item)
 {
     if (isPerishable(item))
     {
         decreaseQuality(item);
     }
     else
     {
         increaseQuality(item);
     }
 }
 private bool isPerishable(Item item)
 {
     return (item.Name != "Aged Brie" && item.Name != "Backstage passes to a TAFKAL80ETC concert");
 }
 private void incrementQuality(Item item)
 {
     if (item.Quality < 50)
         item.Quality = item.Quality + 1;
 }