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
49 changes: 34 additions & 15 deletions app/gilded-rose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,47 @@ export class GildedRose {
}
}
}

if (this.items[i].name == 'Conjured Mana Cake') {

this.items[i].sellIn -= 1;
this.items[i].quality -= 1;

continue;

}

if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
this.items[i].sellIn = this.items[i].sellIn - 1;
}
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
}
} else {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
}

switch(this.items[i].name) {

case "Aged Brie": {

this.items[i].quality = this.items[i].quality < 50? this.items[i].quality : this.items[i].quality + 1;
break;
}

case "Backstage passes to a TAFKAL80ETC concert": {
this.items[i].quality = 0;
break;
}

case "Sulfuras, Hand of Ragnaros": {
break;
}

default: {
this.items[i].quality = this.items[i].quality < 0? this.items[i].quality : this.items[i].quality - 1;
break;
}
}

}
}

return this.items;
}
}
}
Loading