|
@@ -11,53 +11,92 @@ public class Inventory {
|
11
|
11
|
|
12
|
12
|
|
13
|
13
|
public void updateQuality() {
|
|
14
|
+ // Giant for loop representing the "day" each day, the quality's of items change.
|
|
15
|
+
|
14
|
16
|
for (int i = 0; i < items.length; i++) {
|
|
17
|
+
|
|
18
|
+ // This if statement checks if it is NOT aged brie and NOT backstage passes
|
15
|
19
|
if (!items[i].getName().equals("Aged Brie")
|
16
|
20
|
&& !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
21
|
+ // if it's not brie and bspasses
|
17
|
22
|
if (items[i].getQuality() > 0) {
|
|
23
|
+ // checks if the quality is over 0
|
18
|
24
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
25
|
+ // as long as it's not surlfuras...
|
|
26
|
+ // quantity is decreased by 1
|
19
|
27
|
items[i].setQuality(items[i].getQuality() - 1);
|
20
|
28
|
}
|
21
|
29
|
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
22
|
33
|
} else {
|
|
34
|
+
|
|
35
|
+ // Next leg of IF statement quality < 50 then increase quality by 1
|
|
36
|
+
|
23
|
37
|
if (items[i].getQuality() < 50) {
|
|
38
|
+ // if the quality is below 50
|
24
|
39
|
items[i].setQuality(items[i].getQuality() + 1);
|
|
40
|
+ // the quality is increased by 1
|
25
|
41
|
|
|
42
|
+ // stuff about backstage passes
|
26
|
43
|
if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
|
|
44
|
+ // if the item is a backstagepass
|
|
45
|
+
|
27
|
46
|
if (items[i].getSellIn() < 11) {
|
|
47
|
+ // and if the backstage pass has to sell in 11 days
|
28
|
48
|
if (items[i].getQuality() < 50) {
|
|
49
|
+ // and the quality is below 50
|
29
|
50
|
items[i].setQuality(items[i].getQuality() + 1);
|
|
51
|
+ // then add 1 to the quality
|
30
|
52
|
}
|
31
|
53
|
}
|
32
|
54
|
|
33
|
55
|
if (items[i].getSellIn() < 6) {
|
|
56
|
+ // if the bspass has to sell in 6 days
|
34
|
57
|
if (items[i].getQuality() < 50) {
|
|
58
|
+ // and the quality is less than 50
|
35
|
59
|
items[i].setQuality(items[i].getQuality() + 1);
|
|
60
|
+ // then add 1 to the quality
|
36
|
61
|
}
|
37
|
62
|
}
|
38
|
63
|
}
|
39
|
64
|
}
|
40
|
65
|
}
|
41
|
66
|
|
|
67
|
+ // another if the item IS NOT SULFURAS
|
|
68
|
+
|
42
|
69
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
43
|
70
|
items[i].setSellIn(items[i].getSellIn() - 1);
|
44
|
71
|
}
|
|
72
|
+ // then decrease the sellin day by 1
|
45
|
73
|
|
|
74
|
+
|
|
75
|
+ // checks the items sell in
|
|
76
|
+ // if the items sell in is less than 0 (no sellin is negative)
|
46
|
77
|
if (items[i].getSellIn() < 0) {
|
|
78
|
+
|
47
|
79
|
if (!items[i].getName().equals("Aged Brie")) {
|
|
80
|
+ // and the item IS NOT Brie
|
48
|
81
|
if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
82
|
+ // and the item IS NOT BSPASSES
|
49
|
83
|
if (items[i].getQuality() > 0) {
|
|
84
|
+ // if the item quality is greater than 0,
|
|
85
|
+
|
50
|
86
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
87
|
+ // and the item is NOT SULFURAS,
|
51
|
88
|
items[i].setQuality(items[i].getQuality() - 1);
|
|
89
|
+ // the item quality -1
|
52
|
90
|
}
|
53
|
91
|
}
|
54
|
|
- } else {
|
55
|
|
- items[i].setQuality(items[i].getQuality()
|
56
|
|
- - items[i].getQuality());
|
|
92
|
+ } else { // if the item IS a backstage pass
|
|
93
|
+ items[i].setQuality(items[i].getQuality() - items[i].getQuality());
|
57
|
94
|
}
|
58
|
|
- } else {
|
|
95
|
+ } else { // if the item IS BRIE
|
59
|
96
|
if (items[i].getQuality() < 50) {
|
|
97
|
+ // BRIE QUALITY is LESS THAN 50
|
60
|
98
|
items[i].setQuality(items[i].getQuality() + 1);
|
|
99
|
+ // Increase Brie's quality by 1
|
61
|
100
|
}
|
62
|
101
|
}
|
63
|
102
|
}
|