Calculating the action mask