public virtual bool IsRequirementMet(ITriggerStateVariables state, Requirement requirement) { if (requirement.RequirementType == RequirementTypes.TriggerRequirement) { var hasTrigger = state.ContainsKey(requirement.AssociatedId); var triggerState = (requirement.AssociatedValue == 1); if (requirement.AssociatedValue == 0 && !hasTrigger) { return(true); } return(state[requirement.AssociatedId] == triggerState); } return(true); }
public static bool AreRequirementsMet(this ICharacterRequirementChecker characterRequirementChecker, IQuestStateVariables questState, ITriggerStateVariables triggerState, ICharacter character, IHasRequirements hasRequirements) { return(AreRequirementsMet(characterRequirementChecker, character, hasRequirements) && AreRequirementsMet(characterRequirementChecker, questState, hasRequirements) && AreRequirementsMet(characterRequirementChecker, triggerState, hasRequirements)); }
public static bool AreRequirementsMet(this ICharacterRequirementChecker characterRequirementChecker, ITriggerStateVariables triggerState, IHasRequirements hasRequirements) { return(hasRequirements.Requirements.All(x => characterRequirementChecker.IsRequirementMet(triggerState, x))); }