1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
-
- public class Inventory {
- private Item[] items;
-
- public Inventory(Item[] items) {
- super();
- this.items = items;
- }
-
-
- public void updateQuality() {
- for (int i = 0; i < items.length; i++) {
- if (!items[i].getName().equals("Aged Brie")
- && !items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
- if (items[i].getQuality() > 0) {
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
- items[i].setQuality(items[i].getQuality() - 1);
- }
- }
- } else {
- if (items[i].getQuality() < 50) {
- items[i].setQuality(items[i].getQuality() + 1);
-
- if (items[i].getName() == "Backstage passes to a TAFKAL80ETC concert") {
- if (items[i].getSellIn() < 11) {
- if (items[i].getQuality() < 50) {
- items[i].setQuality(items[i].getQuality() + 1);
- }
- }
-
- if (items[i].getSellIn() < 6) {
- if (items[i].getQuality() < 50) {
- items[i].setQuality(items[i].getQuality() + 1);
- }
- }
- }
- }
- }
-
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
- items[i].setSellIn(items[i].getSellIn() - 1);
- }
-
- if (items[i].getSellIn() < 0) {
- if (!items[i].getName().equals("Aged Brie")) {
- if (!items[i].getName().equals("Backstage passes to a TAFKAL80ETC concert")) {
- if (items[i].getQuality() > 0) {
- if (!items[i].getName().equals("Sulfuras, Hand of Ragnaros")) {
- items[i].setQuality(items[i].getQuality() - 1);
- }
- }
- } else {
- items[i].setQuality(items[i].getQuality()
- - items[i].getQuality());
- }
- } else {
- if (items[i].getQuality() < 50) {
- items[i].setQuality(items[i].getQuality() + 1);
- }
- }
- }
- }
- }
- }
|