mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
system update with "Conjured" items
This commit is contained in:
parent
5416470dbe
commit
30c4d62ea7
@ -21,7 +21,10 @@ export class GildedRose {
|
|||||||
for (let i = 0; i < this.items.length; i++) {
|
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].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if (this.items[i].quality > 0) {
|
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
|
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 != 'Aged Brie') {
|
||||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if (this.items[i].quality > 0) {
|
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
|
this.items[i].quality = this.items[i].quality - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user