Skip to content

Instantly share code, notes, and snippets.

@stevenpetryk
Last active August 29, 2015 14:09
Show Gist options
  • Save stevenpetryk/230ff9f8c4269eeb73b0 to your computer and use it in GitHub Desktop.
Save stevenpetryk/230ff9f8c4269eeb73b0 to your computer and use it in GitHub Desktop.
int earliestHitInChain(Attack * attacks[]) {
int i;
for(i = MAX_ATTACKS-1; i > 0; i--) {
if(attacks[i] != NULL && attacks[i]->result == HIT && attacks[i-1]->result == MISS)
return i;
}
return -1; // didn't find anything
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment