Commit 2f6ab9a7 by 李楚霏

step3 --- clean up

parent fbc6f18b
......@@ -8,55 +8,55 @@ export class GildedRose {
update_quality() {
for (let i = 0; i < this.items.length; i++) {
for (const item of this.items) {
if (
this.items[i].name != 'Aged Brie' &&
this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert'
item.name != 'Aged Brie' &&
item.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
if (item.quality > 0) {
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality = item.quality - 1
}
}
} else {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
if (item.quality < 50) {
item.quality = item.quality + 1
if (
this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert'
item.name == 'Backstage passes to a TAFKAL80ETC concert'
) {
if (this.items[i].sell_in < 11) {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
if (item.sell_in < 11) {
if (item.quality < 50) {
item.quality = item.quality + 1
}
}
if (this.items[i].sell_in < 6) {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
if (item.sell_in < 6) {
if (item.quality < 50) {
item.quality = item.quality + 1
}
}
}
}
}
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
this.items[i].sell_in = this.items[i].sell_in - 1
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.sell_in = item.sell_in - 1
}
if (this.items[i].sell_in < 0) {
if (this.items[i].name != 'Aged Brie') {
if (item.sell_in < 0) {
if (item.name != 'Aged Brie') {
if (
this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert'
item.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
if (item.quality > 0) {
if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.quality = item.quality - 1
}
}
} else {
this.items[i].quality =
this.items[i].quality - this.items[i].quality
item.quality =
item.quality - item.quality
}
} else {
if (this.items[i].quality < 50) {
this.items[i].quality = this.items[i].quality + 1
if (item.quality < 50) {
item.quality = item.quality + 1
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment