|
@@ -32,7 +32,7 @@ public class Inventory {
|
32
|
32
|
}
|
33
|
33
|
}
|
34
|
34
|
}
|
35
|
|
- //level 1 - item type
|
|
35
|
+ //level 1 - item type
|
36
|
36
|
} else {
|
37
|
37
|
//level 2 - quality
|
38
|
38
|
if (items[i].getQuality() > 0) {
|
|
@@ -42,46 +42,43 @@ public class Inventory {
|
42
|
42
|
}
|
43
|
43
|
}
|
44
|
44
|
}
|
45
|
|
-
|
46
|
|
-
|
|
45
|
+
|
47
|
46
|
//level 1 - item type
|
48
|
47
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
49
|
48
|
updateSellIn(items[i]);
|
50
|
49
|
}
|
51
|
|
-
|
52
|
|
-
|
|
50
|
+
|
53
|
51
|
//level 1 - sell in date
|
54
|
52
|
if (items[i].getSellIn() < 0) {
|
55
|
53
|
//level 2 - item type
|
56
|
|
- if (!items[i].getName().equals("Aged Brie")) {
|
57
|
|
- //level 3 - item type
|
58
|
|
- if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
59
|
|
- //level 4 - quality
|
60
|
|
- if (items[i].getQuality() > 0) {
|
61
|
|
- //level 5 - item type
|
62
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
63
|
|
- updateQuality(items[i], -1);
|
64
|
|
- }
|
65
|
|
- }
|
66
|
|
- //level 3 - item type
|
67
|
|
- } else {
|
68
|
|
- updateQuality(items[i], -items[i].getQuality());
|
69
|
|
- }
|
70
|
|
- //level 2 - item type
|
71
|
|
- } else {
|
|
54
|
+ if (items[i].getName().equals("Aged Brie")) {
|
72
|
55
|
//level 3 - quality
|
73
|
56
|
if (items[i].getQuality() < 50) {
|
74
|
57
|
updateQuality(items[i], 1);
|
75
|
58
|
}
|
|
59
|
+ //level 2 - item type
|
|
60
|
+ } else if (items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")){
|
|
61
|
+ //level 3 - item type
|
|
62
|
+
|
|
63
|
+ updateQuality(items[i], -items[i].getQuality());
|
|
64
|
+ //level 3 - item type
|
|
65
|
+ } else {
|
|
66
|
+ //level 4 - quality
|
|
67
|
+ if (items[i].getQuality() > 0) {
|
|
68
|
+ //level 5 - item type
|
|
69
|
+ if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
70
|
+ updateQuality(items[i], -1);
|
|
71
|
+ }
|
|
72
|
+ }
|
76
|
73
|
}
|
77
|
74
|
}
|
78
|
75
|
}
|
79
|
76
|
}
|
80
|
|
-
|
|
77
|
+
|
81
|
78
|
public void updateQuality(Item item, int amount){
|
82
|
79
|
item.setQuality(item.getQuality() + amount);
|
83
|
80
|
}
|
84
|
|
-
|
|
81
|
+
|
85
|
82
|
public void updateSellIn(Item item){
|
86
|
83
|
item.setSellIn(item.getSellIn() - 1);
|
87
|
84
|
}
|