public void GiveJob(Job job) { jobs.Add(job.Identifier, job); }
public void FireFromJob(Job job) { jobs.Remove(job.Identifier); }
public void GiveJobTo(Job job, Character newHolder) { jobManager.GiveJobTo(job, newHolder, this); }
public double MeasureJob(Character currentCharacter, Job job) { if (Perspective == currentCharacter) return 1000.0; //Jobs are great. Really we should measure prestige modifiers since jobs can give you one. else return 0.0; }
public void GiveJobTo(Job job, Character newHolder, Game game) { if(job.Unique) { Character oldHolder = uniqueJobs[job]; if(oldHolder != null) { if (job.Permanent) throw new InvalidOperationException("You tried to fire the king!! He chops your head off instead."); oldHolder.FireFromJob(job); Event fireEvent = game.GetEventById(job.OnFire); if (fireEvent != null) { EventContext context = new EventContext(oldHolder); fireEvent.Execute(new EventResults(), game, context); //We need to commit any changes. context.Commit(); } } if(newHolder != null) { newHolder.GiveJob(job); Event hireEvent = game.GetEventById(job.OnHire); if (hireEvent != null) { EventContext context = new EventContext(newHolder); hireEvent.Execute(new EventResults(), game, context); //We need to commit any changes. context.Commit(); } } uniqueJobs[job] = newHolder; } else { if(newHolder != null) { newHolder.GiveJob(job); Event hireEvent = game.GetEventById(job.OnHire); if (hireEvent != null) { EventContext context = new EventContext(newHolder); hireEvent.Execute(new EventResults(), game, context); //We need to commit any changes. context.Commit(); } } } }