gameLoop: refactor

`goIfOk` now actually does 1 thing: move the player, if it is OK.

We also sanitize the input command (see `cmd` variable) before
processing it.

The new functions `battleTrigger` and `mixRng` reduce some of the
complexity of `gameLoop`.