mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-09 03:31:28 +00:00
refactor: improve readability
This commit is contained in:
parent
11af6fe574
commit
4698468083
@ -8,52 +8,52 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateQuality() {
|
public void updateQuality() {
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (Item item : items) {
|
||||||
if (!items[i].name.equals("Aged Brie")
|
if (!item.name.equals("Aged Brie")
|
||||||
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
&& !item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
if (items[i].quality > 0) {
|
if (item.quality > 0) {
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
items[i].quality = items[i].quality - 1;
|
item.quality = item.quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (items[i].quality < 50) {
|
if (item.quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1;
|
item.quality = item.quality + 1;
|
||||||
|
|
||||||
if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
if (items[i].sellIn < 11) {
|
if (item.sellIn < 11) {
|
||||||
if (items[i].quality < 50) {
|
if (item.quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items[i].sellIn < 6) {
|
if (item.sellIn < 6) {
|
||||||
if (items[i].quality < 50) {
|
if (item.quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
items[i].sellIn = items[i].sellIn - 1;
|
item.sellIn = item.sellIn - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items[i].sellIn < 0) {
|
if (item.sellIn < 0) {
|
||||||
if (!items[i].name.equals("Aged Brie")) {
|
if (!item.name.equals("Aged Brie")) {
|
||||||
if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
if (!item.name.equals("Backstage passes to a TAFKAL80ETC concert")) {
|
||||||
if (items[i].quality > 0) {
|
if (item.quality > 0) {
|
||||||
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
|
if (!item.name.equals("Sulfuras, Hand of Ragnaros")) {
|
||||||
items[i].quality = items[i].quality - 1;
|
item.quality = item.quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
items[i].quality = items[i].quality - items[i].quality;
|
item.quality = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (items[i].quality < 50) {
|
if (item.quality < 50) {
|
||||||
items[i].quality = items[i].quality + 1;
|
item.quality = item.quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user