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