Function MeleeGetAllyStructureCount
| 9135 | function MeleeGetAllyStructureCount takes player whichPlayer returns integer |
| 9136 | local integer playerIndex |
| 9137 | local integer buildingCount |
| 9138 | local player indexPlayer |
| 9139 | |
| 9140 | // Count the number of buildings controlled by all not-yet-defeated co-allies.
|
| 9141 | set buildingCount = 0 |
| 9142 | set playerIndex = 0 |
| 9143 | loop
|
| 9144 | set indexPlayer = Player(playerIndex) |
| 9145 | |
| 9146 | // uncomment to cause defeat even if you have control of ally structures, but yours have been nixed
|
| 9147 | //if (PlayersAreCoAllied(whichPlayer, indexPlayer) and not bj_meleeDefeated[playerIndex]) then
|
| 9148 | if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then |
| 9149 | set buildingCount = buildingCount + GetPlayerStructureCount(indexPlayer, true) |
| 9150 | endif
|
| 9151 | |
| 9152 | set playerIndex = playerIndex + 1 |
| 9153 | exitwhen playerIndex == bj_MAX_PLAYERS |
| 9154 | endloop
|
| 9155 | |
| 9156 | return buildingCount
|
| 9157 | endfunction
|