|
@@ -1,39 +0,0 @@
|
1
|
|
-
|
2
|
|
-public class Inventory {
|
3
|
|
- private Item[] items;
|
4
|
|
-
|
5
|
|
- public Inventory(Item[] items) {
|
6
|
|
- super();
|
7
|
|
- this.items = items;
|
8
|
|
- }
|
9
|
|
-
|
10
|
|
- public void updateQuality() {
|
11
|
|
- for (int i = 0; i < items.length; i++) {
|
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
|
|
- }
|
22
|
|
- }
|
23
|
|
-
|
24
|
|
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
|
25
|
|
- items[i].setSellIn(items[i].getSellIn() - 1);
|
26
|
|
- }
|
27
|
|
-
|
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
|
|
- }
|
37
|
|
- }
|
38
|
|
-}
|
39
|
|
-}
|