mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Modified files
- Deleted UpdateQuality and UpdateSellin in GildedRose - Modified BackStagePasses
This commit is contained in:
parent
6ab52bfc46
commit
a15e48a03e
@ -9,81 +9,5 @@ namespace GildedRoseKata
|
|||||||
{
|
{
|
||||||
this.Items = Items;
|
this.Items = Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateQuality()
|
|
||||||
{
|
|
||||||
for (var i = 0; i < Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
|
||||||
{
|
|
||||||
if (Items[i].Quality > 0)
|
|
||||||
{
|
|
||||||
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Items[i].Quality < 50)
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality + 1;
|
|
||||||
|
|
||||||
if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert")
|
|
||||||
{
|
|
||||||
if (Items[i].SellIn < 11)
|
|
||||||
{
|
|
||||||
if (Items[i].Quality < 50)
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Items[i].SellIn < 6)
|
|
||||||
{
|
|
||||||
if (Items[i].Quality < 50)
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
|
||||||
{
|
|
||||||
Items[i].SellIn = Items[i].SellIn - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Items[i].SellIn < 0)
|
|
||||||
{
|
|
||||||
if (Items[i].Name != "Aged Brie")
|
|
||||||
{
|
|
||||||
if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
|
||||||
{
|
|
||||||
if (Items[i].Quality > 0)
|
|
||||||
{
|
|
||||||
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality - Items[i].Quality;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Items[i].Quality < 50)
|
|
||||||
{
|
|
||||||
Items[i].Quality = Items[i].Quality + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,18 +12,21 @@ namespace GildedRose.Models
|
|||||||
if (this.SellDaysGone > this.SellIn)
|
if (this.SellDaysGone > this.SellIn)
|
||||||
{
|
{
|
||||||
this.Quality = 0;
|
this.Quality = 0;
|
||||||
}
|
return;
|
||||||
|
|
||||||
if ((this.SellIn - this.SellDaysGone) <= 5)
|
|
||||||
{
|
|
||||||
if (this.Quality < 51)
|
|
||||||
this.Quality += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.SellIn - this.SellDaysGone) <= 10)
|
if ((this.SellIn - this.SellDaysGone) <= 10)
|
||||||
{
|
{
|
||||||
if (this.Quality < 51)
|
if (this.Quality < 51)
|
||||||
this.Quality += 2;
|
this.Quality += 2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((this.SellIn - this.SellDaysGone) <= 5)
|
||||||
|
{
|
||||||
|
if (this.Quality < 51)
|
||||||
|
this.Quality += 3;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user