This commit is contained in:
romerojhonatan20 2018-02-21 13:03:32 +00:00 committed by GitHub
commit af03cc7b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,56 +7,52 @@ class GildedRose {
this.items = items; this.items = items;
} }
public void updateQuality() { {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
if (!items[i].name.equals("Aged Brie") Item item = items[i];
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].quality > 0) { if (item.name.equals("Sulfuras, Hand of Ragnaros"))continue;
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
items[i].quality = items[i].quality - 1; if (item.name.equals("Aged Brie") || item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (item.quality < 50) {
item.quality += 1;
if (item.sellIn < 11) {
if (item.quality < 50) {
item.quality += 1;
}
}
if (item.sellIn < 6) {
if (item.quality < 50) {
item.quality += 1;
}
} }
} }
} else { } else {
if (items[i].quality < 50) { if (item.quality > 0) {
items[i].quality = items[i].quality + 1; item.quality -= 1;
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].sellIn < 11) {
if (items[i].quality < 50) {
items[i].quality = items[i].quality + 1;
}
}
if (items[i].sellIn < 6) {
if (items[i].quality < 50) {
items[i].quality = items[i].quality + 1;
}
}
}
} }
} }
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { item.sellIn -= 1;
items[i].sellIn = items[i].sellIn - 1;
if (item.sellIn > 0) continue;
if (!item.name.equals("Aged Brie") || !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (item.quality < 0) continue;
item.quality += 1;
continue;
} }
if (items[i].sellIn < 0) { if (item.name.equals("Aged Brie")) {
if (!items[i].name.equals("Aged Brie")) { if (item.quality > 50) continue;
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].quality > 0) { item.quality += 1;
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { } else {
items[i].quality = items[i].quality - 1; item.quality = 0;
}
}
} else {
items[i].quality = items[i].quality - items[i].quality;
}
} else {
if (items[i].quality < 50) {
items[i].quality = items[i].quality + 1;
}
}
} }
} }
} }
} }