Could we automatically sync all replays in the player's replay folder to replay Pallas? This allows us to have access to every single game that has ever happened
Ah, I was confused. This has nothing to do with "losing health" or "health bars". You mean capture points.
Now that I think, maybe that should be called loyalty or allegiance, to pair it with "health", since saying "losing capture" wouldn't make much sense.
@Atrik adding detail here about why your approach (and what I tried first myself) still has problems. (reference PR comment)
I added your code, built and ran the game twice as player1 (blue) and player2 (red). In the attached first screenshot player1 has built a barracks close to player2 CC. The new code stops the CC from decaying BUT notice that buildings created by player2 have auto reverted to being owned by player1 AND while they are in the process of decaying the territory line of player2 starts flashing and it is not possible for player2 to add any other building within his own territory (see building highlighted red).
It is for this reason that I approached the problem from another angle i.e. allowing the host to impose a CC distance in the Game Setup. The alternative of messing with the weights of buildings, owning tiles, decay rates felt like a more dangerous change.