Browse Source

cleaned up code

Jacob Andersen 6 years ago
parent
commit
fad4c7ba17
1 changed files with 41 additions and 24 deletions
  1. 41
    24
      src/main/java/com/zipcodewilmington/gildedrose/Inventory.java

+ 41
- 24
src/main/java/com/zipcodewilmington/gildedrose/Inventory.java View File

@@ -12,26 +12,35 @@ public class Inventory {
12 12
 
13 13
     public void updateQuality() {
14 14
         for (int i = 0; i < items.length; i++) {
15
-            if (!items[i].getName().equals("Aged Brie")
16
-                    && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
17
-                if (items[i].getQuality() > 0) {
18
-                    if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
15
+            if (!items[i].getName().equals("Aged Brie") && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert"))
16
+            {
17
+                if (items[i].getQuality() > 0)
18
+                {
19
+                    if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
20
+                    {
19 21
                         items[i].setQuality(items[i].getQuality() - 1);
20 22
                     }
21 23
                 }
22
-            } else {
23
-                if (items[i].getQuality() < 50) {
24
+            } else
25
+                {
26
+                if (items[i].getQuality() < 50)
27
+                {
24 28
                     items[i].setQuality(items[i].getQuality() + 1);
25 29
 
26
-                    if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
27
-                        if (items[i].getSellIn() < 11) {
28
-                            if (items[i].getQuality() < 50) {
30
+                    if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert")
31
+                    {
32
+                        if (items[i].getSellIn() < 11)
33
+                        {
34
+                            if (items[i].getQuality() < 50)
35
+                            {
29 36
                                 items[i].setQuality(items[i].getQuality() + 1);
30 37
                             }
31 38
                         }
32 39
 
33
-                        if (items[i].getSellIn() < 6) {
34
-                            if (items[i].getQuality() < 50) {
40
+                        if (items[i].getSellIn() < 6)
41
+                        {
42
+                            if (items[i].getQuality() < 50)
43
+                            {
35 44
                                 items[i].setQuality(items[i].getQuality() + 1);
36 45
                             }
37 46
                         }
@@ -39,27 +48,35 @@ public class Inventory {
39 48
                 }
40 49
             }
41 50
 
42
-            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
51
+            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
52
+            {
43 53
                 items[i].setSellIn(items[i].getSellIn() - 1);
44 54
             }
45 55
 
46
-            if (items[i].getSellIn() < 0) {
47
-                if (!items[i].getName().equals("Aged Brie")) {
48
-                    if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
49
-                        if (items[i].getQuality() > 0) {
50
-                            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
56
+            if (items[i].getSellIn() < 0)
57
+            {
58
+                if (!items[i].getName().equals("Aged Brie"))
59
+                {
60
+                    if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert"))
61
+                    {
62
+                        if (items[i].getQuality() > 0)
63
+                        {
64
+                            if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros"))
65
+                            {
51 66
                                 items[i].setQuality(items[i].getQuality() - 1);
52 67
                             }
53 68
                         }
54
-                    } else {
55
-                        items[i].setQuality(items[i].getQuality()
56
-                                - items[i].getQuality());
57
-                    }
58
-                } else {
59
-                    if (items[i].getQuality() < 50) {
69
+                    } else
70
+                        {
71
+                            items[i].setQuality(items[i].getQuality() - items[i].getQuality());
72
+                        }
73
+                } else
74
+                    {
75
+                    if (items[i].getQuality() < 50)
76
+                    {
60 77
                         items[i].setQuality(items[i].getQuality() + 1);
61 78
                     }
62
-                }
79
+                    }
63 80
             }
64 81
         }
65 82
     }