/// <summary> /// A method that determines of agents' initiative. The higher the score, the lower the agent will be in the list. /// </summary> public void DistributionOfInitiative() { // Create a list of random values (in the range from 0 to 99), equal to the number of agents. List <int> valuesOfInitiative = NumberGenerator(currentStoryState.GetNumberOfAgents()); // We go through the list of agents in the current state. foreach (var agent in currentStoryState.GetAgents()) { // Assign a random number to the agent from the list. agent.Value.SetInitiative(RandomSelectionFromTheList(ref valuesOfInitiative)); // If the agent has the role of a player, then it is guaranteed to have an initiative of 100. if (agent.Key.GetRole() == AgentRole.PLAYER) { agent.Value.SetInitiative(100); } } }