|
@@ -11,52 +11,50 @@ public class Inventory {
|
11
|
11
|
|
12
|
12
|
|
13
|
13
|
public void updateQuality() {
|
|
14
|
+ /*
|
|
15
|
+ loop through items.
|
|
16
|
+
|
|
17
|
+ 1. if name DNE "Aged" && DNE "Backstage
|
|
18
|
+ a. if quality > 0
|
|
19
|
+ 1. if name is NOT "Sulfuras", subtract 1 quality | *
|
|
20
|
+ 2. If name is either "Aged" or "Backstage"
|
|
21
|
+ a. if quality < 50, add 1 quality | **
|
|
22
|
+ 1. if name is "Backstage"
|
|
23
|
+ a. if getSellIn < 11
|
|
24
|
+ 1. if quality < 50, then add 1 quality | *
|
|
25
|
+ b. if get sellIn < 6
|
|
26
|
+ 1. if quality < 50, then add 1 quality | *
|
|
27
|
+ 1. if name DNE "Sulfuras"
|
|
28
|
+ a. subtract one sellIn | **
|
|
29
|
+
|
|
30
|
+ 1. If getSellIn < 0
|
|
31
|
+ a. if name is NOT "Aged"
|
|
32
|
+ 1. if name is NOT "Backstage"
|
|
33
|
+ a. if quality > 0
|
|
34
|
+ 1. if name is NOT "Sulfuras, then subtract 1 quality (useless);
|
|
35
|
+ 2. else set quality to 0;
|
|
36
|
+ b. else if quality < 50, add 1 quality
|
|
37
|
+ */
|
14
|
38
|
for (int i = 0; i < items.length; i++) {
|
15
|
|
- if (!items[i].getName().equals("Aged Brie")
|
16
|
|
- && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
17
|
|
- if (items[i].getQuality() > 0) {
|
18
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
19
|
|
- items[i].setQuality(items[i].getQuality() - 1);
|
20
|
|
- }
|
21
|
|
- }
|
22
|
|
- } else {
|
|
39
|
+ if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
23
|
40
|
if (items[i].getQuality() < 50) {
|
24
|
41
|
items[i].setQuality(items[i].getQuality() + 1);
|
25
|
|
-
|
26
|
|
- if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
|
|
42
|
+ if (items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
27
|
43
|
if (items[i].getSellIn() < 11) {
|
28
|
|
- if (items[i].getQuality() < 50) {
|
29
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
30
|
|
- }
|
|
44
|
+ items[i].setQuality(items[i].getQuality() + 1);
|
31
|
45
|
}
|
32
|
|
-
|
33
|
46
|
if (items[i].getSellIn() < 6) {
|
34
|
|
- if (items[i].getQuality() < 50) {
|
35
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
36
|
|
- }
|
|
47
|
+ items[i].setQuality(items[i].getQuality() + 1);
|
37
|
48
|
}
|
38
|
49
|
}
|
39
|
50
|
}
|
40
|
|
- }
|
41
|
51
|
|
42
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
43
|
52
|
items[i].setSellIn(items[i].getSellIn() - 1);
|
44
|
|
- }
|
45
|
53
|
|
46
|
|
- if (items[i].getSellIn() < 0) {
|
47
|
|
- if (!items[i].getName().equals("Aged Brie")) {
|
48
|
|
- if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
49
|
|
- if (items[i].getQuality() > 0) {
|
50
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
51
|
|
- items[i].setQuality(items[i].getQuality() - 1);
|
52
|
|
- }
|
53
|
|
- }
|
54
|
|
- } else {
|
55
|
|
- items[i].setQuality(items[i].getQuality()
|
56
|
|
- - items[i].getQuality());
|
57
|
|
- }
|
58
|
|
- } else {
|
59
|
|
- if (items[i].getQuality() < 50) {
|
|
54
|
+ if (items[i].getSellIn() < 0) {
|
|
55
|
+ if (items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
|
56
|
+ items[i].setQuality(0);
|
|
57
|
+ } else if (items[i].getName().equals("Aged Brie") && items[i].getQuality() < 50) {
|
60
|
58
|
items[i].setQuality(items[i].getQuality() + 1);
|
61
|
59
|
}
|
62
|
60
|
}
|