mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
cleaned up updateSulfurasItem
asserted item name ItemNames.SULFURAS
This commit is contained in:
parent
7577596171
commit
ccf3cc6166
@ -55,47 +55,12 @@ export class GildedRose {
|
||||
}
|
||||
|
||||
private updateSulfurasItem(item: Item) {
|
||||
if (
|
||||
item.name != ItemNames.AGED_BRIE &&
|
||||
item.name != ItemNames.BACKSTAGE_PASSES
|
||||
) {
|
||||
if (item.quality > 0) {
|
||||
if (item.name != ItemNames.SULFURAS) {
|
||||
item.quality = item.quality - 1;
|
||||
}
|
||||
}
|
||||
} else if (item.quality < MAX_ITEM_QUALITY) {
|
||||
assert(item.name == ItemNames.SULFURAS);
|
||||
if (item.quality > 0 && item.name != ItemNames.SULFURAS) {
|
||||
item.quality = item.quality - 1;
|
||||
}
|
||||
if (item.sellIn < 0 && item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
if (item.name == ItemNames.BACKSTAGE_PASSES) {
|
||||
if (item.sellIn < 11) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
if (item.sellIn < 6) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.name != ItemNames.SULFURAS) {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
}
|
||||
if (item.sellIn < 0) {
|
||||
if (item.name != ItemNames.AGED_BRIE) {
|
||||
if (item.name != ItemNames.BACKSTAGE_PASSES) {
|
||||
if (item.quality > 0) {
|
||||
if (item.name != ItemNames.SULFURAS) {
|
||||
item.quality = item.quality - 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.quality = 0;
|
||||
}
|
||||
} else if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user