|
|
@@ -10,41 +10,44 @@ public class Inventory {
|
|
10
|
10
|
public void updateQuality() {
|
|
11
|
11
|
|
|
12
|
12
|
for (Item item: items) {
|
|
13
|
|
-
|
|
|
13
|
+
|
|
14
|
14
|
//This loop runs at the end of each day
|
|
15
|
15
|
//SellIn is the value which denotes the number of days we have to sell the item
|
|
16
|
16
|
//Quality value denotes how values for every item
|
|
17
|
17
|
|
|
18
|
18
|
if (item.getName().equals("Aged Brie")) {
|
|
19
|
|
-
|
|
|
19
|
+
|
|
20
|
20
|
if (item.getQuality() < 50) {
|
|
21
|
21
|
item.setQuality(item.getQuality() + 1);
|
|
22
|
|
- }
|
|
23
|
|
-
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ if (item.getSellIn() < 0 && item.getQuality() < 50) {
|
|
|
25
|
+ item.setQuality(item.getQuality() + 1);
|
|
|
26
|
+ }
|
|
|
27
|
+
|
|
24
|
28
|
} else {
|
|
25
|
|
-
|
|
|
29
|
+
|
|
26
|
30
|
if (item.getQuality() > 0) {
|
|
27
|
31
|
if (!item.getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
28
|
32
|
item.setQuality(item.getQuality() - 1);
|
|
29
|
33
|
}
|
|
30
|
34
|
}
|
|
31
|
|
- }
|
|
32
|
|
-
|
|
33
|
35
|
|
|
34
|
|
- if (!item.getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
35
|
|
- item.setSellIn(item.getSellIn() - 1);
|
|
36
|
|
- }
|
|
37
|
|
-
|
|
38
|
|
- if (item.getSellIn() < 0) {
|
|
39
|
|
- if (!item.getName().equals("Aged Brie")) {
|
|
|
36
|
+ if (item.getSellIn() < 0) {
|
|
40
|
37
|
item.setQuality(item.getQuality() - 1);
|
|
41
|
|
- } else {
|
|
42
|
|
- if (item.getQuality() < 50) {
|
|
43
|
|
- item.setQuality(item.getQuality() + 1);
|
|
44
|
|
- }
|
|
45
|
38
|
}
|
|
|
39
|
+
|
|
46
|
40
|
}
|
|
47
|
41
|
|
|
|
42
|
+ if (!item.getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
|
43
|
+ item.setSellIn(item.getSellIn() - 1);
|
|
|
44
|
+ }
|
|
48
|
45
|
}
|
|
|
46
|
+
|
|
|
47
|
+ }
|
|
|
48
|
+
|
|
|
49
|
+ private boolean isNotLegenday(Item item){
|
|
|
50
|
+ return item.getName().equals("Sulfuras, Hand of Ragnaros") ? true : false;
|
|
49
|
51
|
}
|
|
|
52
|
+
|
|
50
|
53
|
}
|