mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
Update extracted expired
This commit is contained in:
parent
617871422e
commit
00763585f8
@ -51,27 +51,35 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----- Block 3 ----- Item sell date is less than 0
|
// ----- Block 3 ----- Item sell date is less than 0
|
||||||
if (item.sellIn < 0) {
|
handleIfExpired(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reduce quality of items by - 1 if greater than 0 and not AB, BptaTc or SHoR
|
private void handleIfExpired(Item item) {
|
||||||
if (!item.name.equals("Aged Brie")) {
|
if (item.sellIn < 0) {
|
||||||
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
||||||
if (item.quality > 0) {
|
|
||||||
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
|
||||||
item.quality = item.quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Item quality goes to 0 of BptaTc as item sell date is less than 0
|
|
||||||
item.quality = item.quality - item.quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increase quality of item if AB
|
handleExpired(item);
|
||||||
} else {
|
}
|
||||||
if (item.quality < 50) {
|
}
|
||||||
item.quality = item.quality + 1;
|
|
||||||
|
private void handleExpired(Item item) {
|
||||||
|
// Reduce quality of items by - 1 if greater than 0 and not AB, BptaTc or SHoR
|
||||||
|
if (!item.name.equals("Aged Brie")) {
|
||||||
|
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
|
if (item.quality > 0) {
|
||||||
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
|
item.quality = item.quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Item quality goes to 0 of BptaTc as item sell date is less than 0
|
||||||
|
item.quality = item.quality - item.quality;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase quality of item if AB
|
||||||
|
} else {
|
||||||
|
if (item.quality < 50) {
|
||||||
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user