mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-14 22:21:20 +00:00
moves lowest quality value
This commit is contained in:
parent
bdb783786c
commit
7b0e2daa3d
@ -7,7 +7,6 @@ import com.gildedrose.item.QualityValues;
|
||||
|
||||
class GildedRose {
|
||||
|
||||
private static final int LOWEST_QUALITY_VALUE_POSSIBLE = 0;
|
||||
Item[] items;
|
||||
|
||||
public GildedRose(Item[] items) {
|
||||
@ -18,7 +17,7 @@ class GildedRose {
|
||||
for (Item item : items) {
|
||||
customisedItem(item).updateState();
|
||||
if (hasReachedLowestQualityValue(item)) {
|
||||
item.quality = LOWEST_QUALITY_VALUE_POSSIBLE;
|
||||
item.quality = QualityValues.lowestValuePossible();
|
||||
} else if (hasReachedHighestQualityValue(item)) {
|
||||
item.quality = QualityValues.highestValuePossible(item);
|
||||
}
|
||||
@ -30,7 +29,7 @@ class GildedRose {
|
||||
}
|
||||
|
||||
private boolean hasReachedLowestQualityValue(Item item) {
|
||||
return item.quality < LOWEST_QUALITY_VALUE_POSSIBLE;
|
||||
return item.quality < QualityValues.lowestValuePossible();
|
||||
}
|
||||
|
||||
private boolean hasReachedHighestQualityValue(Item item) {
|
||||
|
||||
@ -2,6 +2,10 @@ package com.gildedrose.item;
|
||||
|
||||
public final class QualityValues {
|
||||
|
||||
public static int lowestValuePossible() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int highestValuePossible(Item item) {
|
||||
if (item.name.equals(CustomisedItemFactory.SULFURAS)) {
|
||||
return 80;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user