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