Replaced redundant variables for the time spent each state with one variable with he time spent in current state.

Also fixed a bug where check always returned false if duration was larger than DURATION_TO_EVADE,
The old version failed if the closest reachable point was behind a closer unreachable one.