mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-10 04:01:19 +00:00
lift-up conditional - isSulfuras
This commit is contained in:
parent
ba9330aab7
commit
29fc686933
@ -27,6 +27,7 @@ class GildedRose {
|
|||||||
// processing quality
|
// processing quality
|
||||||
boolean isAgedBrie = item.name.equals(AGED_BRIE);
|
boolean isAgedBrie = item.name.equals(AGED_BRIE);
|
||||||
boolean isBackstagePasses = item.name.equals(BACKSTAGE_PASSES);
|
boolean isBackstagePasses = item.name.equals(BACKSTAGE_PASSES);
|
||||||
|
boolean isSulfuras = item.name.equals(SULFURAS);
|
||||||
|
|
||||||
if (isAgedBrie) {
|
if (isAgedBrie) {
|
||||||
// processing quality
|
// processing quality
|
||||||
@ -69,25 +70,23 @@ class GildedRose {
|
|||||||
if (item.sellIn < SELL_IN_DAY0) {
|
if (item.sellIn < SELL_IN_DAY0) {
|
||||||
item.quality = QUALITY_LEVEL_0;
|
item.quality = QUALITY_LEVEL_0;
|
||||||
}
|
}
|
||||||
|
} else if (isSulfuras) {
|
||||||
|
//sulfuras is doing nothing
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
//standard item
|
||||||
if (item.quality > QUALITY_LEVEL_0) {
|
if (item.quality > QUALITY_LEVEL_0) {
|
||||||
if (!item.name.equals(SULFURAS)) {
|
item.quality = item.quality - 1;
|
||||||
item.quality = item.quality - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// processing sell date
|
// processing sell date
|
||||||
if (!item.name.equals(SULFURAS)) {
|
item.sellIn = item.sellIn - 1;
|
||||||
item.sellIn = item.sellIn - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// processing sell date
|
// processing sell date
|
||||||
if (item.sellIn < SELL_IN_DAY0) {
|
if (item.sellIn < SELL_IN_DAY0) {
|
||||||
// processing quality
|
// processing quality
|
||||||
if (item.quality > QUALITY_LEVEL_0) {
|
if (item.quality > QUALITY_LEVEL_0) {
|
||||||
if (!item.name.equals(SULFURAS)) {
|
item.quality = item.quality - 1;
|
||||||
item.quality = item.quality - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user