public Interaction GetResponse(Character speaker, ParsedAction actionDoneToSpeaker, Character spokenTo)
        {
            var respondingVerbs = speaker.ResponseMapper.GetResponseVerbs(actionDoneToSpeaker.Verb);

            if (!respondingVerbs.Any())
            {
                return(null);
            }

            var possibleRespondingInteractions = respondingVerbs.SelectMany(GetRespondingInteractions).ToList();

            List <Interaction> validRespondingInteractions = GetInteractionsMatchingAllCriteria(speaker, spokenTo, possibleRespondingInteractions)
                                                             .ToList();

            validRespondingInteractions =
                GetInteractionsPossibleWithAction(speaker, validRespondingInteractions, actionDoneToSpeaker);

            Interaction result;

            if (validRespondingInteractions.Any())
            {
                result = GetRandomResponse(validRespondingInteractions);
                result.Action.Object = actionDoneToSpeaker.Object;
            }
            else
            {
                result = GetInvalidInteraction(speaker, spokenTo);
            }

            return(result.GetAFilledInInteraction(_stringTemplateReplacer, speaker, spokenTo));
        }
        private List <Interaction> GetInteractionsPossibleWithAction(Character speaker,
                                                                     List <Interaction> interactions,
                                                                     ParsedAction actionDoneToSpeaker)
        {
            if (actionDoneToSpeaker.Verb == ActionVerb.RequestItemType)
            {
                ItemType itemType;
                var      isSuccessful = Enum.TryParse(actionDoneToSpeaker.Object, true, out itemType);

                if (!isSuccessful)
                {
                    throw new ArgumentNullException(nameof(actionDoneToSpeaker.Object), "Cannot parse item type.");
                }

                if (speaker.GetPossessionsOfType(itemType).Any())
                {
                    return(interactions.Where(p => p.Action.Verb != ActionVerb.DontHaveItemType).ToList());
                }
                else
                {
                    return(interactions.Where(p => p.Action.Verb == ActionVerb.DontHaveItemType).ToList());
                }
            }

            return(interactions);
        }
        public Interaction GetInteraction(Character speaker, ParsedAction action, Character spokenTo)
        {
            var possibleInteractions = _interactions.Where(p => p.Action.Adverb == action.Adverb &&
                                                           p.Action.Verb == action.Verb).ToList();

            if (possibleInteractions.Any())
            {
                return(GetRandomResponse(possibleInteractions).GetAFilledInInteraction(_stringTemplateReplacer, speaker, spokenTo));
            }
            else
            {
                return(null);
            }
        }