From a95501bfb0e54bb616c2dece894399aa6b9543f1 Mon Sep 17 00:00:00 2001 From: wengYuting Date: Thu, 7 Apr 2022 17:07:00 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=87=8D=E6=A7=8B]=20=E5=88=A4=E6=96=B7?= =?UTF-8?q?=E8=8B=A5=E7=82=BA=20Sulfuras=20=E5=89=87=E4=B8=8D=E4=BD=9C?= =?UTF-8?q?=E7=82=BA=E8=B7=B3=E8=87=B3=E4=B8=8B=E4=B8=80=E8=BC=AA=E8=BF=B4?= =?UTF-8?q?=E5=9C=88=EF=BC=8C=E7=B0=A1=E5=8C=96=E7=9B=B8=E9=97=9C=E5=88=A4?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js-jest/src/gilded_rose.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/js-jest/src/gilded_rose.js b/js-jest/src/gilded_rose.js index 3d968858..36821b1a 100644 --- a/js-jest/src/gilded_rose.js +++ b/js-jest/src/gilded_rose.js @@ -20,6 +20,8 @@ class Shop { updateQuality() { for (let i = 0; i < this.items.length; i++) { + if (this.items[i].name === "Sulfuras, Hand of Ragnaros") continue; + if ( this.items[i].name === "Aged Brie" || this.items[i].name === "Backstage passes to a TAFKAL80ETC concert" @@ -37,26 +39,18 @@ class Shop { } } } - } else if ( - this.items[i].quality > 0 && - this.items[i].name != "Sulfuras, Hand of Ragnaros" - ) { + } else if (this.items[i].quality > 0) { this.items[i].quality = this.items[i].quality - 1; } - if (this.items[i].name != "Sulfuras, Hand of Ragnaros") { - this.items[i].sellIn = this.items[i].sellIn - 1; - } + 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 && - this.items[i].name != "Sulfuras, Hand of Ragnaros" - ) { + if (this.items[i].quality > 0) { this.items[i].quality = this.items[i].quality - 1; } } else {