public override bool IsSatisfied(WorldDynamic state)
        {
            if (temporaryInvulnerability && !permanentInvulnerability && targetAgent.Key != null && targetAgent.Value != null && termOfProtection != 0)
            {
                return((targetAgent.Value.GetStatus() && state.GetStaticWorldPart().GetTurnNumber() <= termOfProtection) || state.GetStaticWorldPart().GetTurnNumber() > termOfProtection);
            }
            else if (permanentInvulnerability && !temporaryInvulnerability && targetAgent.Key != null && targetAgent.Value != null)
            {
                return(targetAgent.Value.GetStatus());
            }

            return(false);
        }
        /// <summary>
        /// A method that adds locations to the current state of the world.
        /// </summary>
        public void CreateEnviroment(Dictionary <LocationStatic, LocationDynamic> locations)
        {
            // Add locations to the dynamic component of the current state of the world.
            currentStoryState.AddLocations(locations);

            // Create an empty list of static components of locations.
            List <LocationStatic> locationsList = new List <LocationStatic>();

            // We go through the list of locations, adding their static components to an empty list.
            foreach (var location in locations)
            {
                locationsList.Add(location.Key);
            }

            // Assign the list of static components of locations to the static component to the current state of the world.
            currentStoryState.GetStaticWorldPart().AddLocations(locationsList);
        }
        /// <summary>
        /// Convergence in turn asks agents for actions, checks them, applies them, counteracts them, or does not.
        /// </summary>
        public void Step(StoryNode currentNode, int agentIndex, bool root, ref int globalNodeNumber, ref Queue <StoryNode> queue)
        {
            // Convergence assigns who is on the turn to the node and then applies the changes to the state of the world.
            currentStoryState = currentNode.GetWorldState();
            currentStoryState.GetStaticWorldPart().IncreaseTurnNumber();

            while (!currentStoryState.GetAgentByIndex(agentIndex).Value.GetStatus())
            {
                agentIndex = GetActualAgentNumber(agentIndex, ref currentNode);
            }

            // We check if the agent from whom we are going to request an action is alive (i.e. capable of doing it).
            if (currentStoryState.GetAgentByIndex(agentIndex).Value.GetStatus())
            {
                // We create a request for action of the specified agent from the specified state.
                storyworldConvergence.ActionRequest(currentStoryState.GetAgentByIndex(agentIndex), ref newStoryGraph, ref currentStoryState,
                                                    currentNode, root, ref globalNodeNumber, ref queue);
            }
        }
        public override bool IsSatisfied(WorldDynamic state)
        {
            foreach (var targetAgent in targetAgents)
            {
                if (temporaryRestricting && !permanentRestricting && targetAgent.Key != null && targetAgent.Value != null && termOfRestricting != 0)
                {
                    if (targetAgent.Value.GetPlan().GetAction(0) is Talk && state.GetStaticWorldPart().GetTurnNumber() <= termOfRestricting)
                    {
                        return(false);
                    }
                }
                else if (permanentRestricting && !temporaryRestricting && targetAgent.Key != null && targetAgent.Value != null)
                {
                    if (targetAgent.Value.GetPlan().GetAction(0) is Talk)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        public override bool IsSatisfied(WorldDynamic state)
        {
            foreach (var targetAgent in targetAgents)
            {
                if (temporaryRestricting && !permanentRestricting && targetAgent.Key != null && targetAgent.Value != null && termOfRestricting != 0)
                {
                    if (!targetAgent.Value.GetObjectOfAngry().AngryCheck() && state.GetStaticWorldPart().GetTurnNumber() <= termOfRestricting)
                    {
                        return(false);
                    }
                }
                else if (permanentRestricting && !temporaryRestricting && targetAgent.Key != null && targetAgent.Value != null)
                {
                    if (!targetAgent.Value.GetObjectOfAngry().AngryCheck())
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }