VCAI is the module responsible for player actions on adventure map.
AI starts with "WIN" ultimate goal and tries to accomplish it, based on win condition for certain scenario. Additionally, it performs typical actions (like building in town) each turn. THis should be replaced with actual reasoning.
Additional goals can be saved to be completed in the future. There is a list of locked heroes who are tied to particular important goals.
AI Chooses first sub-goal that may lead to completion of current goal (function striveToGoal). Decomposition is performed until there is possibility to complete the goal directly (goal is elementar). Typical elemntar action is moving hero to certain tile. Currently the first matching goal is chosen and set as target. Then AI tries to accomplish it. End of action is indicated by exception. After making an action, AI continues to decompose the main goal until all possibilities are exhaused (infinite while loop). Some goals can be abstract. When abstract goal is chosen, it becomes main goal itself. This way abstract goal can result in multiple actions from AI, until all possible actions are exhausted.
If returned goal is related to hero, this goal is then assigned to specific hero. Heroes continue their goals in subsequent turns, until it's complete. Every action that may result in completing teh goal must inform AI about such opportunity so that hero goal is erased.