What's a good way to manage what players and enemies can do based on their state?
Context - In my platformer, the 'player' character does many standard platformer actions - shoots, runs, jumps, crouches, aims, reloads, kicks, etc. I've been using a "state" instance variable to determine what the player can do (and what can be done to the player) based on their current state. E.g., when state = "good", the player can move, jump, and aim. If state=aiming, the player can fire. If state=good, or aiming, or reloading, or throwing, or kicking, the player can be hit by an enemy. I set the state variable when something happens - ie., the player fires, or an enemy is hit.
At first this was manageable, but as I add capability to the player/enemies (and features to the game) my logic is starting to get unruly. My conditions are getting complicated, with lots of or's and inverted conditions, and whenever I want to make a change or add a new state in the code, something almost always breaks. It's brittle spaghetti code.
This article https://gameprogrammingpatterns.com/state.html does a great job explaining the problem, and offers a fairly sophisticated set of solutions. Unfortunately a) it's beyond my ability, and b) I don’t see how this can be implemented with C3.
Can anyone recommend an approach that works well with C3?