@Override
public boolean isInvalid(EcBuildOrder s) {
ArrayList<Buildable> requirements = buildable.getRequirement();
for (int i = 0; i < requirements.size(); i++) {
Buildable requirement = requirements.get(i);
if (requirement instanceof Building && !s.isBuilding((Building)requirement)) {
return true;
}else if(requirement instanceof Unit && s.getUnitCount((Unit)requirement) == 0){
return true;
}else if(requirement instanceof Upgrade && !s.isUpgrade((Upgrade)requirement)){
return true;
}
}
Buildable consumes = buildable.getConsumes();
if(consumes instanceof Building && s.getBuildingCount((Building)consumes) == 0){
return true;
}else if(consumes instanceof Unit && s.getUnitCount((Unit)consumes) ==0){
return true;
}