charlesbaynham / wurwolves

2 stars 0 forks source link

Role resolution is a disaster #41

Open charlesbaynham opened 4 years ago

charlesbaynham commented 4 years ago

The mixin-based, action modifying resolver network is a real headache and quite counter-intuitive.

This all comes about because it relies on altering actions rather than altering players. It would be much easier to understand if the do_modifier() steps all just altered players instead of actions. I didn't do this at first because I don't like having attributes on objects which aren't declared, so I preferred to keep action modifiers as mixins. I could mitigate this by having new role classes declare their intentions by adding fields to the definition of GamePlayer. GamePlayer could become a pydantic model, and new fields would have defaults. That way all GamePlayers would have all fields defined, and you'd have a definitive list of the fields that exist.

Each role would still be responsible for implementing the results appropriately, but that's how it currently is. I'd keep the triggering do_modifiers() system but it would alter GamePlayers instead of actions. I'd lose the ability to set prevented and have it respected in the do_modifiers round, but again, that's how it already is.