Explorar el Código

updated aged brie

Rachelle hace 8 años
padre
commit
61e2580194
Se han modificado 1 ficheros con 14 adiciones y 6 borrados
  1. 14
    6
      Inventory.java

+ 14
- 6
Inventory.java Ver fichero

@@ -12,12 +12,14 @@ public class Inventory {
12 12
             if(items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")){                
13 13
                 updateQualityForBackstagePasses(i);
14 14
             }else if(items[i].getName().equals("Aged Brie")){
15
-                increaseQualityByOne(i);
16
-            }else if((items[i].getQuality() > 0)&&(!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))){              
15
+                updateQualityForBrie(i);
16
+            }else if(items[i].getName().equals("Sulfuras, Hand of Ragnaros")){
17
+                updateQualityForSulfuras(i);
18
+            }else if((items[i].getQuality() > 0)){              
17 19
                 decreaseQualityByOne(i);                   
18 20
             }
19 21
 
20
-            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
22
+            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")&&(!items[i].getName().equals("Aged Brie"))) {
21 23
                 decreaseSellInByOne(i);
22 24
             }
23 25
 
@@ -28,9 +30,7 @@ public class Inventory {
28 30
                             decreaseQualityByOne(i);
29 31
                         }
30 32
                     }
31
-                } else {
32
-                    increaseQualityByOne(i);
33
-                }
33
+                } 
34 34
             }
35 35
 
36 36
         }
@@ -65,6 +65,14 @@ public class Inventory {
65 65
     }
66 66
 
67 67
     public void updateQualityForBrie(int i){
68
+        increaseQualityByOne(i);
69
+        decreaseSellInByOne(i);       
70
+        if (items[i].getSellIn() < 0){
71
+            increaseQualityByOne(i);
72
+        }
73
+    }
74
+
75
+    public void updateQualityForSulfuras(int i){
68 76
 
69 77
     }
70 78
 }