Handle the gain in the setTaskGoal method.