mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
em
This commit is contained in:
1 parent
c22e36e674
commit
15ac32868a
1 file changed
+10
-12
@@ -28,10 +28,8 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (items[i].quality > 0) {
|
if (!items[i].name.equals(SULFURAS)) {
|
||||||
if (!items[i].name.equals(SULFURAS)) {
|
decreaseQualityByOne(i);
|
||||||
decreaseQualityByOne(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,14 +41,12 @@ class GildedRose {
|
|||||||
if (items[i].name.equals(AGED_BRIE)) {
|
if (items[i].name.equals(AGED_BRIE)) {
|
||||||
incrementQualityByOne(i);
|
incrementQualityByOne(i);
|
||||||
} else {
|
} else {
|
||||||
if (!items[i].name.equals(BACKSTAGE_PASSES)) {
|
if (items[i].name.equals(BACKSTAGE_PASSES)) {
|
||||||
if (items[i].quality > 0) {
|
|
||||||
if (!items[i].name.equals(SULFURAS)) {
|
|
||||||
decreaseQualityByOne(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
items[i].quality = 0;
|
items[i].quality = 0;
|
||||||
|
} else {
|
||||||
|
if (!items[i].name.equals(SULFURAS)) {
|
||||||
|
decreaseQualityByOne(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +60,9 @@ class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void decreaseQualityByOne(int i) {
|
private void decreaseQualityByOne(int i) {
|
||||||
items[i].quality = items[i].quality - 1;
|
if (items[i].quality > 0) {
|
||||||
|
items[i].quality = items[i].quality - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user