예제 #1
0
 public override bool Apply(Project p, Worker w)
 {
     if (Event.random.NextDouble() <= chance)
     {
         Triggered(p, w);
         return true;
     }
     return false;
 }
예제 #2
0
 /// <summary>
 /// This method decides whether to apply the event to this worker,
 /// based on worker, environment, and external factors.
 /// </summary>
 /// <param name="w"></param>
 /// <returns></returns>
 public virtual bool Apply(Project p, Worker w)
 {
     return false;
 }
예제 #3
0
 public abstract void Triggered(Project p, Worker w);
예제 #4
0
 public override void Triggered(Project p, Worker w)
 {
     w.currentCapability *= effect;
     p.log.Add("Worker " + w.name + " was " + logline + " on day " + p.stepsTaken + ".");
 }
예제 #5
0
 public override void Triggered(Project p, Worker w)
 {
     w.currentCapability *= effect;
     int left = 0;
     if (affected.ContainsKey(w))
         left = affected[w].daysLeft;
     left = length - left;
     p.log.Add("Worker " + w.name + " was " + logline + " (" + left + "/" + length + ") on day " + p.stepsTaken + ".");
 }
예제 #6
0
 public override bool Apply(Project p, Worker w)
 {
     // we check first whether this worker is already affected
     if (affected.ContainsKey(w))
     {
         Memo memo = affected[w];
         memo.daysLeft--;
         if (memo.daysLeft <= 0)
             affected.Remove(w);
         Triggered(p, w);
     }
     else if (Event.random.NextDouble() <= chance)
     {
         int leave = length - 1;
         affected.Add(w, new Memo(leave));
         Triggered(p, w);
         return true;
     }
     return false;
 }