From 30c4d62ea7ad713b067ea51ff24e266440b8adfc Mon Sep 17 00:00:00 2001 From: thiwanka-aux <47382911+thiwanka-aux@users.noreply.github.com> Date: Mon, 20 Sep 2021 18:06:29 +0530 Subject: [PATCH] system update with "Conjured" items --- TypeScript/app/gilded-rose.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TypeScript/app/gilded-rose.ts b/TypeScript/app/gilded-rose.ts index 928aa579..d3f9377a 100644 --- a/TypeScript/app/gilded-rose.ts +++ b/TypeScript/app/gilded-rose.ts @@ -21,7 +21,10 @@ export class GildedRose { 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') { + if (this.items[i].name === 'Conjured') { + const updatedQuality = this.items[i].quality - 2 + this.items[i].quality = updatedQuality < 0 ? 0 : updatedQuality + } else if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { this.items[i].quality = this.items[i].quality - 1 } } @@ -49,7 +52,10 @@ export class GildedRose { 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') { + if (this.items[i].name === 'Conjured') { + const updatedQuality = this.items[i].quality - 2 + this.items[i].quality = updatedQuality < 0 ? 0 : updatedQuality + } else if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') { this.items[i].quality = this.items[i].quality - 1 } }