Setting up mafia to smartly automate everything has a fairly steep learning curve. There are normal scripts such as this one, recoveryScripts, betweenBattleScripts, consult scripts, macros, CCSs, counterScripts, and post- and preAscension scripts, using a total of four different command structures (CLI, ASH, BALLS, and CCS commands), and that's just for an average player. Each is used differently, and each handles a different aspect of play. It can be rather confusing at first.
In this case OCW is adventuring despite being beaten up because you haven't configured mafia in your restore options or recoveryScript to remove beaten up, or abort if you can't. It's unable to beat the monsters because you haven't configured mafia in your CCS or consult script to use combat skills which could effectively kill the monster. These issues are outside the scope of OCW. They belong in a recoveryScript (or mafia restore options) and a CCS (which can include macros and consult scripts such as SmartStasis), respectively.
OCW doesn't include checking for whether or not you will die before adventuring somewhere. This is because a character could have any number of different skills, and any number of different automations for handling the combat. If you have a noodle-butting CCS, you can survive much more difficult monsters than if you simply have an "attack" CCS. OCW has no way of knowing your CCS, so it just assumes you have configured it correctly to handle the monsters. The CCS listed was a good starting point, but you need to develop it beyond that, depending on your skills and play style. You can't win every combat simply by attacking.