Check that all issues that this one is blocked by are resolved. You might want to put this on the Resolve Issue transition.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink

def linkType = ["Blocks"]

def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if (linkType.contains(link.issueLinkType.name)) {
        if (! link.sourceObject.resolutionId) {
            passesCondition = false
        }
    }

}