Example #1
0
 public void ApplyDecision(DecisionTree.Decision decision, bool fromDecide)
 {
     foreach (var change in decision.Changes)
     {
         Inc(change.Trait, change.Value);
     }
     _decisionLogic.Apply(decision.Id);
     UpdateTime(TimeSpan.FromDays(decision.Days), decision.Scaled, fromDecide);
     Debug.LogFormat("Applied decision: '{0}', {1}\n{2}", decision.Name, decision.Id, this);
 }
Example #2
0
 public bool IsDecisionActive(DecisionTree.Decision decision)
 {
     foreach (var ch in decision.Changes)
     {
         if ((ch.Trait == Trait.Money) && ((Money + ch.Value) < 0))
         {
             return(false);
         }
     }
     return(true);
 }
Example #3
0
 public bool IsDecisionAvailable(DecisionTree.Decision decision)
 {
     if (_delayedNotices.Find(n => n.Id == decision.Id) != null)
     {
         return(false);
     }
     foreach (var ch in decision.Min)
     {
         if (Get(ch.Trait) < ch.Value)
         {
             return(false);
         }
     }
     foreach (var ch in decision.Max)
     {
         if (Get(ch.Trait) >= ch.Value)
         {
             return(false);
         }
     }
     return(_decisionLogic.IsDecisionAvailable(decision.Id));
 }
Example #4
0
 void ApplyDecision(DecisionTree.Decision decision)
 {
     TryResetDecideWindow();
     _state.ApplyDecision(decision, true);
 }