Auto-translated
How can I implement the following using scripts?
1) Restructuring cities at the start of the game.
Purpose: Heroes of Might and Magic generates unattractive maps, and the standard map generator creates all cities at level 2 with a tavern built.
Needed:
- The first player's starting city should be level 4 (e.g., fort, tavern, and dwelling-1).
- All subsequent players' starting cities should be level 4 plus, possibly, an additional building (dwelling-2) - up to level 5; the chance depends on the player number and is 100% for the last player.
- All neutral cities should be level 6 (e.g., fort-citadel, dwelling-1, 2, 3).
Problem:
- How to iterate through the cities that exist on the map if their names are unknown in advance?
- Will I have to iterate through all existing city names listed in the game's resources to check for their presence on the map?
2) Taking turns away from heroes upon encounter or after battle.
Purpose: to prevent chaining, limit battles.
Needed:
- Take 50% of the hero's total remaining turns after a battle (like in Disciples 2); if the hero's remaining turns are less than that, take all remaining turns. Ideally, only take turns if the neutrals were not released without a fight.
- When friendly heroes meet, equalize their remaining turns to the minimum (i.e., set the remaining turns of both heroes to the lowest remaining turn value among them). When a hero visits mine garrisons, reset their turn to zero (ideally, only reset the turn for garrisons, so the turn is not lost when capturing a mine) - to prevent mine chaining.
Problems:
- How to track the fact that a battle has taken place (something like a trigger)?
- How to track the fact that heroes have met or visited a garrison?