|
@@ -10,30 +10,54 @@ public class Inventory {
|
10
|
10
|
public void updateQuality() {
|
11
|
11
|
for (int i = 0; i < items.length; i++) {
|
12
|
12
|
if (!items[i].getName().equals("Aged Brie")) {
|
13
|
|
- if (items[i].getQuality() > 0) {
|
14
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
15
|
|
- items[i].setQuality(items[i].getQuality() - 1);
|
16
|
|
- }
|
17
|
|
- }
|
18
|
|
- } else {
|
19
|
|
- if (items[i].getQuality() < 50) {
|
20
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
21
|
|
- }
|
|
13
|
+ regItemUpdate();
|
|
14
|
+ // if (items[i].getQuality() > 0) {
|
|
15
|
+ // if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
16
|
+ // items[i].setQuality(items[i].getQuality() - 1);
|
|
17
|
+ // }
|
|
18
|
+ // }
|
|
19
|
+ } else {agedBrieUpdate();
|
|
20
|
+ // if (items[i].getQuality() < 50) {
|
|
21
|
+ // items[i].setQuality(items[i].getQuality() + 1);
|
|
22
|
+ // }
|
22
|
23
|
}
|
|
24
|
+
|
23
|
25
|
|
24
|
26
|
if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
25
|
|
- items[i].setSellIn(items[i].getSellIn() - 1);
|
|
27
|
+ // items[i].setSellIn(items[i].getSellIn() - 1);
|
|
28
|
+ continue;
|
26
|
29
|
}
|
27
|
30
|
|
28
|
|
- if (items[i].getSellIn() < 0) {
|
29
|
|
- if (!items[i].getName().equals("Aged Brie")) {
|
30
|
|
- items[i].setQuality(items[i].getQuality() - 1);
|
31
|
|
- } else {
|
32
|
|
- if (items[i].getQuality() < 50) {
|
33
|
|
- items[i].setQuality(items[i].getQuality() + 1);
|
34
|
|
- }
|
35
|
|
- }
|
36
|
|
- }
|
|
31
|
+ // if (items[i].getSellIn() < 0) {
|
|
32
|
+ // if (!items[i].getName().equals("Aged Brie")) {
|
|
33
|
+ // items[i].setQuality(items[i].getQuality() - 1);
|
|
34
|
+ // } else {
|
|
35
|
+ // if (items[i].getQuality() < 50) {
|
|
36
|
+ // items[i].setQuality(items[i].getQuality() + 1);
|
|
37
|
+ // }
|
|
38
|
+ // }
|
|
39
|
+ // }
|
37
|
40
|
}
|
38
|
|
-}
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ public void agedBrieUpdate() {
|
|
44
|
+ int i = 0;
|
|
45
|
+ if (items[i].getSellIn() > 0 && items[i].getQuality() <=49) {
|
|
46
|
+ items[i].setQuality(items[i].getQuality() + 1);
|
|
47
|
+ } else if (items[i].getSellIn() < 0 && items[i].getQuality() <= 48){
|
|
48
|
+ items[i].setQuality(items[i].getQuality() + 2);
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ public void regItemUpdate() {
|
|
54
|
+ int i = 0;
|
|
55
|
+ if (items[i].getSellIn() > 0) {
|
|
56
|
+ items[i].setQuality(items[i].getQuality() - 1);
|
|
57
|
+ } else if (items[i].getSellIn() < 0){
|
|
58
|
+ items[i].setQuality(items[i].getQuality() - 2);
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ }
|
|
62
|
+
|
39
|
63
|
}
|