Hints and tricks request -- calculated counters in a zone

This topic has been thoroughly discussed and thanks to Rindis we may enjoy a working, viable and elegant solution (viewtopic.php?f=6&t=7279).

In game of Unhappy King Charles a leader can lead a number of brigades – those are kept on a separate board, called Player Card. A player would keep the counters in a named box – a box corresponds to a leader who, in turn, is moved on the board itself. This concept helps to keep away the clutter and also provides a fog of war – while players are allowed to examine the number of brigades under each leader, the opponent should not know upfront what is the exact combat strength of the leaders army.

In the module I want to add a function of displaying number of brigades a leader has under his command. Rindis’ method will work but there is BUT.

According to the rules, a leader can subordinate another leader – this is represented by placing the counter of the latter in a command box of the former. Brigades lead by the latter are kept in his box, they are not mixed in one command box. I augmented Rindis’ method by adding a calculated property ‘brigades’ to the leader in which I store number of lead brigades. When a leader is moved to a command box of another leader, trigger increases the other leader number of lead brigades. This works fine.

The problem is when someone – probably due to combat losses or attrition – removes a brigade from the first command box i.e. the one belonging to the SUBORDINATED leader. The value of ‘brigade’ trait is updated – but Rindis’ method fails in that it does not update the value of the number of the brigades lead by the SUBORDINATING general.

I found no simply solution for that and the question is twofold:

  1. Is there a simple fix for the problem I described above? Maybe Rindis’ method can be somehow enhanced to support also the concept of subordination?
  2. If I were to write a dedicated Java code (my programming skills are pretty limited, I know perl to some extent, Pascal and redcode, but the latter does not count in this context), where do I need to look? What I would like to achieve, is to have a single property on each leader which would represent number of lead brigades. The number is a sum of brigades he leads directly and number of brigades lead by general he has subordinated. The chain command has just one level of subordination i.e. a general cannot be subordinated to a general who already is subordinated to someone else. How complicated, you envision, a Java code which would support that, would be?

Cheers!

It was Joel, not Rindis, who implemented that. Sorry for confusing you two, guys.

Basically, it boils down to counting counters in a Zone. Or summing values of traits of the counters in a Zone.