Настроение: | contemplative |
List of Actions a Unit Can Do
Had to completely redesign the action system.
Originally each unit class had a list of actions, it can perform.
That was used by both AI and human players.
Such systems, while superficially easy, are defective by design.
Even in simpler action games.
But my case is exceedingly complex.
So since the beginning this typed action list created issues.
For example, I had to list `cast_spell` for every spellcaster.
And then also check the spellcaster is not silenced.
There was just no easy way to add cast_spell to a unit which initially had none.
I had some ad-hoc system to allow that, which basically simulated ECS.
Since the transition to ECS, I no longer have solid classes.
So actions dynamically attach onto entities which satisfy the requirements.
The cast_cast from the example will be available to any entity matching
spellcaster and -silenced
Even if that entity was dynamically constructed.
TLDR: just use ECS.