|
@@ -19,6 +19,14 @@ public class Inventory {
|
19
|
19
|
|
20
|
20
|
public void updateQuality() {
|
21
|
21
|
for (Item item : items) {
|
|
22
|
+
|
|
23
|
+ int minuend = 0;
|
|
24
|
+ int subtrahend;
|
|
25
|
+
|
|
26
|
+ if (item.getName().equals("Conjured")) {
|
|
27
|
+ minuend = item.getQuality();
|
|
28
|
+ }
|
|
29
|
+
|
22
|
30
|
if (item.getQuality() < 50) {
|
23
|
31
|
switch (item.getName()) {
|
24
|
32
|
case "Aged Brie":
|
|
@@ -44,72 +52,19 @@ public class Inventory {
|
44
|
52
|
break;
|
45
|
53
|
}
|
46
|
54
|
}
|
|
55
|
+
|
|
56
|
+ if (item.getName().equals("Conjured")) {
|
|
57
|
+ subtrahend = item.getQuality();
|
|
58
|
+ int qualityDifference = minuend - subtrahend;
|
|
59
|
+ if (qualityDifference > 0) {
|
|
60
|
+ item.setQuality(item.getQuality() - qualityDifference);
|
|
61
|
+ }
|
|
62
|
+ }
|
|
63
|
+
|
47
|
64
|
if (item.getQuality() < 0) {
|
48
|
65
|
item.setQuality(0);
|
49
|
66
|
}
|
50
|
|
-// default:
|
51
|
|
-// if (item.getQuality() > 0)
|
52
|
|
-// if (item.getSellIn() < 0 && item.getQuality() > 1))
|
53
|
|
-// changeQuality(item, -1);
|
54
|
|
-// if (item.getSellIn() < 0 && item.getQuality() > 1)
|
55
|
|
-// changeQuality(item, -2);
|
56
|
|
-// break;
|
57
|
|
-// }
|
58
|
|
-// }
|
59
|
67
|
updateSellIn(item);
|
60
|
68
|
}
|
61
|
|
-
|
62
|
|
-
|
63
|
|
-// for (int i = 0; i < items.length; i++) {
|
64
|
|
-// if (!items[i].getName().equals("Aged Brie") && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
65
|
|
-// if (items[i].getQuality() > 0) {
|
66
|
|
-// if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
67
|
|
-// items[i].setQuality(items[i].getQuality() - 1);
|
68
|
|
-// }
|
69
|
|
-// }
|
70
|
|
-// } else {
|
71
|
|
-// if (items[i].getQuality() < 50 && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
72
|
|
-// items[i].setQuality(items[i].getQuality() + 1);
|
73
|
|
-//
|
74
|
|
-//// if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
|
75
|
|
-//// if (items[i].getSellIn() < 11) {
|
76
|
|
-//// if (items[i].getQuality() < 50) {
|
77
|
|
-//// items[i].setQuality(items[i].getQuality() + 1);
|
78
|
|
-//// }
|
79
|
|
-//// }
|
80
|
|
-////
|
81
|
|
-//// if (items[i].getSellIn() < 6) {
|
82
|
|
-//// if (items[i].getQuality() < 50) {
|
83
|
|
-//// items[i].setQuality(items[i].getQuality() + 1);
|
84
|
|
-//// }
|
85
|
|
-//// }
|
86
|
|
-//// }
|
87
|
|
-// }
|
88
|
|
-// }
|
89
|
|
-//
|
90
|
|
-// if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros") && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
91
|
|
-// items[i].setSellIn(items[i].getSellIn() - 1);
|
92
|
|
-// }
|
93
|
|
-//
|
94
|
|
-// if (items[i].getSellIn() < 0 && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
95
|
|
-// if (!items[i].getName().equals("Aged Brie")) {
|
96
|
|
-// if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
|
97
|
|
-// if (items[i].getQuality() > 0) {
|
98
|
|
-// if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
99
|
|
-// items[i].setQuality(items[i].getQuality() - 1);
|
100
|
|
-// }
|
101
|
|
-// }
|
102
|
|
-// } else {
|
103
|
|
-// items[i].setQuality(items[i].getQuality()
|
104
|
|
-// - items[i].getQuality());
|
105
|
|
-// }
|
106
|
|
-// }
|
107
|
|
-////// else {
|
108
|
|
-//////// if (items[i].getQuality() < 50) {
|
109
|
|
-//////// items[i].setQuality(items[i].getQuality() + 1);
|
110
|
|
-////// }
|
111
|
|
-//// }
|
112
|
|
-// }
|
113
|
|
-// }
|
114
|
69
|
}
|
115
|
70
|
}
|