I currently have an entity component system with messaging. The messages are delivered to each subscriber, but each subscriber gets their own copy, basically meaning that altering a message doesn't affect any other subscriber. While this works fine for now, I was wondering how I would add an invulnerable state.
I have a combat system that solves combat. It takes a combat event (an intent to attack something) and emits a resolved combat event. This event contains information of who attacked whom and what kind of damage they took. It also has a bool which gives the status of whether or not the defending entity is alive after the attack. It also controls the the HP and deletes the entity if it was killed.
I do not have a problem breaking down this system. A system that calculates damage, a system that applies the damage, and a system that kills the entity. But where do I add my invulnerability? If I simply make it a component, then it has to be handled by the system that applies damage. What if I want to add something else later? I have to build up and up the damage system and it has to handle all the little edge cases and intricacies. What if I want to add an attack that goes through invulnerability?
Clearly this is an exponential nightmare, which is exactly what I hoped to avoid with an ECS. How should I handle invulnerability?