|
@@ -1,62 +1,81 @@
|
1
|
1
|
package com.zipcodewilmington.gildedrose;
|
2
|
2
|
|
3
|
3
|
|
4
|
|
-public class Inventory {
|
|
4
|
+public class Inventory
|
|
5
|
+{
|
5
|
6
|
private Item[] items;
|
6
|
|
-
|
7
|
|
- public Inventory(Item[] items) {
|
|
7
|
+ public Inventory(Item[] items)
|
|
8
|
+ {
|
8
|
9
|
super();
|
9
|
10
|
this.items = items;
|
10
|
11
|
}
|
11
|
|
-
|
12
|
|
-
|
13
|
|
- public void updateQuality() {
|
14
|
|
- 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")) {
|
|
12
|
+ public void updateQuality()
|
|
13
|
+ {
|
|
14
|
+ for (int i = 0; i < items.length; i++)
|
|
15
|
+ {
|
|
16
|
+ /*if (!items[i].getName().equals("Aged Brie")
|
|
17
|
+ && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert"))
|
|
18
|
+ {
|
|
19
|
+ if (items[i].getQuality() > 0)
|
|
20
|
+ {
|
|
21
|
+ if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
|
|
22
|
+ {
|
19
|
23
|
items[i].setQuality(items[i].getQuality() - 1);
|
20
|
24
|
}
|
21
|
25
|
}
|
22
|
|
- } else {
|
23
|
|
- if (items[i].getQuality() < 50) {
|
|
26
|
+ } else
|
|
27
|
+ {
|
|
28
|
+ if (items[i].getQuality() < 50)
|
|
29
|
+ {
|
24
|
30
|
items[i].setQuality(items[i].getQuality() + 1);
|
25
|
31
|
|
26
|
|
- if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
|
27
|
|
- if (items[i].getSellIn() < 11) {
|
28
|
|
- if (items[i].getQuality() < 50) {
|
|
32
|
+ if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert")
|
|
33
|
+ {
|
|
34
|
+ if (items[i].getSellIn() < 11)
|
|
35
|
+ {
|
|
36
|
+ if (items[i].getQuality() < 50)
|
|
37
|
+ {
|
29
|
38
|
items[i].setQuality(items[i].getQuality() + 1);
|
30
|
39
|
}
|
31
|
40
|
}
|
32
|
41
|
|
33
|
|
- if (items[i].getSellIn() < 6) {
|
34
|
|
- if (items[i].getQuality() < 50) {
|
|
42
|
+ if (items[i].getSellIn() < 6)
|
|
43
|
+ {
|
|
44
|
+ if (items[i].getQuality() < 50)
|
|
45
|
+ {
|
35
|
46
|
items[i].setQuality(items[i].getQuality() + 1);
|
36
|
47
|
}
|
37
|
48
|
}
|
38
|
49
|
}
|
39
|
50
|
}
|
40
|
|
- }
|
|
51
|
+ }*/
|
41
|
52
|
|
42
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
|
53
|
+ if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
|
|
54
|
+ {
|
43
|
55
|
items[i].setSellIn(items[i].getSellIn() - 1);
|
44
|
56
|
}
|
45
|
57
|
|
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")) {
|
|
58
|
+ if (items[i].getSellIn() < 0)
|
|
59
|
+ {
|
|
60
|
+ if (!items[i].getName().equals("Aged Brie"))
|
|
61
|
+ {
|
|
62
|
+ if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert"))
|
|
63
|
+ {
|
|
64
|
+ if (items[i].getQuality() > 0)
|
|
65
|
+ {
|
|
66
|
+ if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
|
|
67
|
+ {
|
51
|
68
|
items[i].setQuality(items[i].getQuality() - 1);
|
52
|
69
|
}
|
53
|
70
|
}
|
54
|
|
- } else {
|
55
|
|
- items[i].setQuality(items[i].getQuality()
|
56
|
|
- - items[i].getQuality());
|
|
71
|
+ } else
|
|
72
|
+ {
|
|
73
|
+ items[i].setQuality(items[i].getQuality() - items[i].getQuality());
|
57
|
74
|
}
|
58
|
|
- } else {
|
59
|
|
- if (items[i].getQuality() < 50) {
|
|
75
|
+ } else
|
|
76
|
+ {
|
|
77
|
+ if (items[i].getQuality() < 50)
|
|
78
|
+ {
|
60
|
79
|
items[i].setQuality(items[i].getQuality() + 1);
|
61
|
80
|
}
|
62
|
81
|
}
|