Had to rethink how movement points work. Originally I had just `AP` stat associated with each unit. It got replenished with `full_AP` each turn. Then I have dropped the random to hit chance completely. That required introducing additionally `atk` state for each unit capable of attack. Atk basically mean how many AP unit can invest into defeating targets defense. Now some units are immobile, some or all the time. With simple units like destructive castle gates I can just set AP to 0, since gates are passive. But what about the stationary ballista turret, castle defender gets? It needs to have AP to invest into attack. Any any AP means the turret will be moving. That sucks, since I dont want player to move the turret.
Now I can add immobile, and some special kludge to prevent such immobile units from moving, but that wont solve the case with a turret mounted on top of a giant turtle. Giant turtle moves slowly, but the turret should still have a few shots per turn. That can be solved with mounting the turret as a separate unit from the turtle carrying it, but what about the gates with some active security system shooting intruders?
Given these shortcomings I have to introduce a hierarchical AP system. At the start of the turn units gets basic AP (based of stamina), which are then allocated in various sub-systems, like movement and attack. Alternatively one can use a disjoint system system, where all parts get their own AP meter, but living organisms usually have single energy source and single brain, while the time spent on movement or equipping some item is the time not spent to defeating opponents defense. So hierarchical dependency seems like a natural choice. In a real-time strategy you can probably incorporate it with your entity component system, but I have just hardcoded everything for now.