Extract sellInBelow0

This commit is contained in:
Jesper 2022-04-13 16:27:20 +02:00
parent ab6be24de4
commit e734b35f3a

View File

@ -46,24 +46,28 @@ export class GildedRose {
item.sellIn = item.sellIn - 1;
}
if (item.sellIn < 0) {
if (item.name != 'Aged Brie') {
if (item.name != 'Backstage passes to a TAFKAL80ETC concert') {
if (item.quality > 0) {
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality = item.quality - 1
}
}
} else {
item.quality = item.quality - item.quality
}
} else {
if (item.quality < 50) {
item.quality = item.quality + 1
}
}
this.sellInBelow0(item);
}
})
return this.items;
}
private sellInBelow0(item: Item) {
if (item.name != 'Aged Brie') {
if (item.name != 'Backstage passes to a TAFKAL80ETC concert') {
if (item.quality > 0) {
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality = item.quality - 1;
}
}
} else {
item.quality = item.quality - item.quality;
}
} else {
if (item.quality < 50) {
item.quality = item.quality + 1;
}
}
}
}