mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-15 18:43:53 +00:00
Removed all the code except for the GildedRose kata from this repo
This commit is contained in:
1 parent
b31a5436cc
commit
567c27854a
112 files changed
+35
-4801
No files matched your search
@@ -0,0 +1,62 @@
|
||||
function Item(name, sell_in, quality) {
|
||||
this.name = name;
|
||||
this.sell_in = sell_in;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
var items = []
|
||||
|
||||
items.push(new Item('+5 Dexterity Vest', 10, 20));
|
||||
items.push(new Item('Aged Brie', 2, 0));
|
||||
items.push(new Item('Elixir of the Mongoose', 5, 7));
|
||||
items.push(new Item('Sulfuras, Hand of Ragnaros', 0, 80));
|
||||
items.push(new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20));
|
||||
items.push(new Item('Conjured Mana Cake', 3, 6));
|
||||
|
||||
function update_quality() {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].name != 'Aged Brie' && items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (items[i].quality > 0) {
|
||||
if (items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
if (items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (items[i].sell_in < 11) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
if (items[i].sell_in < 6) {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
items[i].sell_in = items[i].sell_in - 1;
|
||||
}
|
||||
if (items[i].sell_in < 0) {
|
||||
if (items[i].name != 'Aged Brie') {
|
||||
if (items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (items[i].quality > 0) {
|
||||
if (items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
items[i].quality = items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
items[i].quality = items[i].quality - items[i].quality
|
||||
}
|
||||
} else {
|
||||
if (items[i].quality < 50) {
|
||||
items[i].quality = items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user