public override bool Eval([NotNull] PlayerInfo info) { if (info == null) { throw new ArgumentNullException("info"); } return(Conditions == null || Conditions.All(t => !t.Eval(info))); }
public bool CanApply(Kingdom kingdom, Kingdom otherKingdom, bool forcePlayerCosts = false, bool bypassCosts = false) { // FIXME: Simplified LINQ here, but it also had the effect of not executing ApplyCondition on some conditions if an early one failed. // So if there are conditions with side effects that should still execute even upon failure, this needs to be changed. return(Conditions.All(c => c.ApplyCondition(kingdom, otherKingdom, out _, forcePlayerCosts, bypassCosts))); }
/// <summary> /// Checks the status of all assigned AchievementConditions and determines if the Achievement unlocks /// </summary> /// <remarks>Is useful to evaluate if a newly added Achievement should be unlocked without having to make progress again</remarks> public void CheckUnlockStatus() { if (Unlocked) { return; } Unlocked = Conditions.All(condition => condition.Unlocked); if (Unlocked) { UnlockTimeStamp = DateTime.UtcNow; InvokeAchievementCompleted(); } }
public bool MeetsFilter(IRecord record) { var result = true; if (ConditionOperator == FilterOperator.Or) { result = (!Conditions.Any() && !SubFilters.Any()) || Conditions.Any(c => c.MeetsCondition(record)) || SubFilters.Any(f => f.MeetsFilter(record)); } else { result = Conditions.All(c => c.MeetsCondition(record)) && SubFilters.All(f => f.MeetsFilter(record)); } return(result); }
public bool IsActive(IStatisticsWriter writer, IToggleContext context) { var stats = new Statistic { ToggleID = ID, Timestamp = DateTime.Now, User = context.GetCurrentUser() }; var isActive = ConditionMode == ConditionModes.Any ? Conditions.Any(c => c.IsMatch(stats, context)) : Conditions.All(c => c.IsMatch(stats, context)); stats.Active = isActive; writer.Write(stats); return(isActive); }
public string GetStateDescription() { if (_conditions.All(x => x.Invoke())) { _wasComplite = true; return("Задача выполнена."); } var indexes = _conditions .Select((x, i) => new { Condition = x, Index = i }) .Where(x => !x.Condition.Invoke()) .Select(x => x.Index) .ToList(); StringBuilder builder = new StringBuilder("Задание не выполнено.\n"); for (int i = 0; i < indexes.Count - 1; i++) { builder.AppendLine(_descriptions[indexes[i]].Description); } builder.Append(_descriptions[indexes[indexes.Count - 1]].Description); return(builder.ToString()); }
/// <summary> /// GuardConditionsMet is true if all of the guard functions return true /// or if there are no guard functions /// </summary> public bool GuardConditionsMet(object[] args) { return(Conditions.All(c => c.Guard == null || c.Guard(args))); }
public bool Check(IQuestConditionContext context) { return(Conditions.All(c => c.Check(context))); }
private bool Validate() { return(Conditions.All(c => c.IsCurrentState)); }
/// <summary> /// Validates if all conditions match the passed entity tag and/or state tokens /// </summary> /// <param name="etag">The entity tag</param> /// <param name="stateTokens">The state tokens</param> /// <returns><see langword="true"/> when this condition matches</returns> public bool IsMatch(EntityTag?etag, IReadOnlyCollection <Uri> stateTokens) { return(Conditions.All(x => x.IsMatch(etag, stateTokens))); }
public bool Call(GameContext context) { return(Conditions.All(c => c.Call(context))); }
public override bool Match(FilterableObjectData obj) => Conditions.All(x => x.Match(obj));
public bool AreConditionsSatisfied(CraftingSim sim) { return(Conditions.All(x => IsConditionSatisfied(x, sim))); }
public override bool EvalCondition(IDmlfNamespace ns) { return(Conditions.All(x => x.EvalCondition(ns))); }
public override bool Eval(PlayerInfo info) { return(Conditions == null || Conditions.All(t => t.Eval(info))); }
public bool IsValid() { return Conditions.All(x => x.IsSatisfied()); }
public override bool IsMatch(UIApplication uiApp, CategorySet selectedCategories) { bool res = Conditions.All(c => c.IsMatch(uiApp, selectedCategories)); return(IsNot ? !res : res); }