Rachelle 8 лет назад
Родитель
Сommit
e6f0463267
1 измененных файлов: 20 добавлений и 20 удалений
  1. 20
    20
      Inventory.java

+ 20
- 20
Inventory.java Просмотреть файл

@@ -9,16 +9,12 @@ public class Inventory {
9 9
 
10 10
     public void updateQuality() {
11 11
         for (int i = 0; i < items.length; i++) {
12
-            if(items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")){
13
-                increaseQualityByOne(i);
14
-                increaseQualityForBackstagePasses(i);
12
+            if(items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")){                
13
+                updateQualityForBackstagePasses(i);
15 14
             }else if(items[i].getName().equals("Aged Brie")){
16 15
                 increaseQualityByOne(i);
17
-            }else{
18
-                if ((items[i].getQuality() > 0)&&(!items[i].getName().equals("Sulfuras, Hand of Ragnaros")))
19
-                {              
20
-                    decreaseQualityByOne(i);                   
21
-                }
16
+            }else if((items[i].getQuality() > 0)&&(!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))){              
17
+                decreaseQualityByOne(i);                   
22 18
             }
23 19
 
24 20
             if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
@@ -27,14 +23,10 @@ public class Inventory {
27 23
 
28 24
             if (items[i].getSellIn() < 0) {
29 25
                 if (!items[i].getName().equals("Aged Brie")) {
30
-                    if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
31
-                        if (items[i].getQuality() > 0) {
32
-                            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
33
-                                decreaseQualityByOne(i);
34
-                            }
26
+                    if (items[i].getQuality() > 0) {
27
+                        if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
28
+                            decreaseQualityByOne(i);
35 29
                         }
36
-                    } else {
37
-                        items[i].setQuality(0);
38 30
                     }
39 31
                 } else {
40 32
                     increaseQualityByOne(i);
@@ -58,13 +50,21 @@ public class Inventory {
58 50
         items[i].setSellIn(items[i].getSellIn() - 1);
59 51
     }
60 52
 
61
-    public void increaseQualityForBackstagePasses(int i){
62
-        if(items[i].getSellIn() < 11) {
63
-            increaseQualityByOne(i);
64
-        } 
65
-        if(items[i].getSellIn() < 6){
53
+    public void updateQualityForBackstagePasses(int i){
54
+        if (items[i].getSellIn() < 0){
55
+            items[i].setQuality(0);
56
+        }else{
66 57
             increaseQualityByOne(i);
58
+            if(items[i].getSellIn() < 11) {
59
+                increaseQualityByOne(i);
60
+            } 
61
+            if(items[i].getSellIn() < 6){
62
+                increaseQualityByOne(i);
63
+            }
67 64
         }
68 65
     }
69 66
 
67
+    public void updateQualityForBrie(int i){
68
+
69
+    }
70 70
 }