Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 37 additions & 32 deletions app/gilded-rose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,52 @@ export class GildedRose {
}

updateQuality() {
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
if (this.items[i].quality > 0) {
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
this.items[i].quality = this.items[i].quality - 1
for (const item of this.items) {

if(item.quality < 0){
// Quality is never <= 0
item.quality = 0;
}
else if(item.quality > 50 && item.name != "Sulfuras, Hand of Ragnaros"){
// Quality always <= 50
item.quality = 50;
}

if (item.name != 'Aged Brie' && item.name != 'Backstage passes to a TAFKAL80ETC concert') {
if (item.quality > 0) {
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality--;
}
}
} else {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
if (this.items[i].sellIn < 11) {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
}
}
else {
if (item.quality < 50) {
item.quality++;
if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
if (item.sellIn < 11) {
item.quality++;
}
if (this.items[i].sellIn < 6) {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
}
if (item.sellIn < 6) {
item.quality++;
}
}
}
}
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
this.items[i].sellIn = this.items[i].sellIn - 1;
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.sellIn--;
}
if (this.items[i].sellIn < 0) {
if (this.items[i].name != 'Aged Brie') {
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
if (this.items[i].quality > 0) {
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
this.items[i].quality = this.items[i].quality - 1
}
}
} else {
this.items[i].quality = this.items[i].quality - this.items[i].quality
if (item.sellIn < 0) {
if (item.name != 'Aged Brie' && item.name != 'Backstage passes to a TAFKAL80ETC concert') {
if (item.quality > 0 && item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality--;
}
else {
item.quality = item.quality - item.quality;
}
} else {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
}
else {
if (item.quality < 50) {
item.quality++;
}
}
}
Expand Down
Loading