private Boolean hasToGetJewelForLeaflet(String color, Leaflet leaflet) { return(leaflet.getRequired(color) > leaflet.getCollected(color)); }
public void updateLeaflet(int n, Leaflet l) { switch (n) { case 0: leaflet1[0] = l.getRequired("Red") - l.getCollected("Red"); leaflet1[1] = l.getRequired("Green") - l.getCollected("Green"); leaflet1[2] = l.getRequired("Blue") - l.getCollected("Blue"); leaflet1[3] = l.getRequired("Yellow") - l.getCollected("Red"); leaflet1[4] = l.getRequired("Magenta") - l.getCollected("Magenta"); leaflet1[5] = l.getRequired("White") - l.getCollected("White"); break; case 1: leaflet2[0] = l.getRequired("Red") - l.getCollected("Red"); leaflet2[1] = l.getRequired("Green") - l.getCollected("Green"); leaflet2[2] = l.getRequired("Blue") - l.getCollected("Blue"); leaflet2[3] = l.getRequired("Yellow") - l.getCollected("Red"); leaflet2[4] = l.getRequired("Magenta") - l.getCollected("Magenta"); leaflet2[5] = l.getRequired("White") - l.getCollected("White"); break; case 2: leaflet3[0] = l.getRequired("Red") - l.getCollected("Red"); leaflet3[1] = l.getRequired("Green") - l.getCollected("Green"); leaflet3[2] = l.getRequired("Blue") - l.getCollected("Blue"); leaflet3[3] = l.getRequired("Yellow") - l.getCollected("Red"); leaflet3[4] = l.getRequired("Magenta") - l.getCollected("Magenta"); leaflet3[5] = l.getRequired("White") - l.getCollected("White"); break; default: break; } // FMT verifying negatives for (int i = 0; i < 5; i++) { if (leaflet1[i] < 0) { leaflet1[i] = 0; } if (leaflet2[i] < 0) { leaflet2[i] = 0; } if (leaflet3[i] < 0) { leaflet3[i] = 0; } } }