Eric Foster преди 6 години
родител
ревизия
de6b80a20b
променени са 1 файла, в които са добавени 19 реда и са изтрити 19 реда
  1. 19
    19
      Inventory.java

+ 19
- 19
Inventory.java Целия файл

@@ -45,8 +45,10 @@ public class Inventory {
45 45
 
46 46
             if(!items[i].getName().equals("Sulfuras, Hand of Ragnaros")){
47 47
                 updateSellInDays(items[i]);
48
+                if (items[i].getSellIn() < 0) {
49
+                    updateExpiredItems(items[i]);
50
+                }
48 51
             }
49
-            updateExpiredItems(items[i]);
50 52
         }
51 53
     }
52 54
 
@@ -67,25 +69,23 @@ public class Inventory {
67 69
     }
68 70
 
69 71
     public void updateExpiredItems(Item item){
70
-        if (item.getSellIn() < 0) {
71
-            //level 2 - item type
72
-            if (item.getName().equals("Aged Brie")) {
73
-                //level 3 - quality
74
-                if (item.getQuality() < 50) {
75
-                    increaseQualityBy1(item);
76
-                }
77
-                //level 2 - item type
78
-            } else if (item.getName().equals("Backstage passes to a TAFKAL80ETC concert")){
79
-                setQualityTo0(item);
72
+        //level 1 - item type
73
+        if (item.getName().equals("Aged Brie")) {
74
+            //level 2 - quality
75
+            if (item.getQuality() < 50) {
76
+                increaseQualityBy1(item);
77
+            }
78
+            //level 1 - item type
79
+        } else if (item.getName().equals("Backstage passes to a TAFKAL80ETC concert")){
80
+            setQualityTo0(item);
81
+            //level 1 - item type
82
+        } else {
83
+            //level 2 - quality
84
+            if (item.getQuality() > 0) {
80 85
                 //level 3 - item type
81
-            } else {
82
-                //level 4 - quality
83
-                if (item.getQuality() > 0) {
84
-                    //level 5 - item type
85
-                    if (!item.getName().equals("Sulfuras, Hand of Ragnaros")) {
86
-                        reduceQualityBy1(item);
87
-                    }
88
-                }
86
+
87
+                reduceQualityBy1(item);
88
+
89 89
             }
90 90
         }
91 91
     }