mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
22 lines
524 B
JavaScript
22 lines
524 B
JavaScript
const { ItemUpdater } = require("../gilded_rose");
|
|
|
|
class ConjuredUpdater extends ItemUpdater {
|
|
updateQuality() {
|
|
|
|
this.qualityChangeFactor = 2;
|
|
|
|
//The Quality of an item is never more than 50
|
|
if (this.item.quality > 50) {
|
|
this.item.quality = 50;
|
|
}
|
|
|
|
if (this.item.quality > 0 && this.item.quality < 50) {
|
|
this.item.quality = this.item.quality - this.qualityChangeFactor;
|
|
}
|
|
return this.item;
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
ConjuredUpdater
|
|
} |