mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
extracted LegendaryItems processing from if statements in DailyItemUpdate
LegendayItems don't change and therefore, can return immediately
This commit is contained in:
parent
dd66f563e9
commit
03032c91c2
@ -32,14 +32,13 @@ public class GildedRose
|
|||||||
|
|
||||||
private void DailyItemUpdate(Item item)
|
private void DailyItemUpdate(Item item)
|
||||||
{
|
{
|
||||||
|
if (IsLegendaryItem(item)) return;
|
||||||
|
|
||||||
if (!IsBetterWithAgeItem(item) && !IsBackstagePassesItem(item))
|
if (!IsBetterWithAgeItem(item) && !IsBackstagePassesItem(item))
|
||||||
{
|
{
|
||||||
if (item.Quality > MinQuality)
|
if (item.Quality > MinQuality)
|
||||||
{
|
{
|
||||||
if (!IsLegendaryItem(item))
|
item.Quality = item.Quality - 1;
|
||||||
{
|
|
||||||
item.Quality = item.Quality - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -69,10 +68,7 @@ public class GildedRose
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsLegendaryItem(item))
|
item.SellIn = item.SellIn - 1;
|
||||||
{
|
|
||||||
item.SellIn = item.SellIn - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.SellIn < 0)
|
if (item.SellIn < 0)
|
||||||
{
|
{
|
||||||
@ -82,10 +78,7 @@ public class GildedRose
|
|||||||
{
|
{
|
||||||
if (item.Quality > MinQuality)
|
if (item.Quality > MinQuality)
|
||||||
{
|
{
|
||||||
if (!IsLegendaryItem(item))
|
item.Quality = item.Quality - 1;
|
||||||
{
|
|
||||||
item.Quality = item.Quality - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user