public static Bonus <float> GetOpinionAboutOffer(HumanFF worker, ExpiringJobOffer newOffer) { bool willNeedToLeaveCompany = worker.WorkerComponent.companyId != newOffer.CompanyId; var bonus = new Bonus <float>("Opinion about offer"); // scenarios // 1 - unemployed // 2 - employed, same company // 3 - employed, recruiting // 4 - !founder if (!Humans.IsEmployed(worker)) { return(bonus.Append("Salary", newOffer.JobOffer.Salary > GetSalaryPerRating(worker) ? 1 : -1)); } int loyaltyBonus = (worker.HumanCompanyRelationshipComponent.Morale - 50) / 10; int desireToLeaveCompany = 0; if (willNeedToLeaveCompany) { // it's not easy to recruit worker from other company desireToLeaveCompany -= 5; // and if your worker loves stability... if (Humans.HasTrait(worker, Trait.Loyal)) { desireToLeaveCompany -= 5; } // but if your worker loves new challenges... if (Humans.HasTrait(worker, Trait.NewChallenges)) { desireToLeaveCompany += 10; } if (desireToLeaveCompany > 0) { bonus.AppendAndHideIfZero("Wants to leave company", desireToLeaveCompany); } else { bonus.AppendAndHideIfZero("Wants to stay in company", desireToLeaveCompany); } bonus.Append("Loyalty to company", -loyaltyBonus); } else { // prolongation of contract bonus.Append("Loyalty to company", loyaltyBonus); } long newSalary = newOffer.JobOffer.Salary; long salary; salary = (long)Mathf.Max(Humans.GetCurrentOffer(worker).JobOffer.Salary, 1); float salaryRatio; salaryRatio = (newSalary - salary) * 1f / salary; salaryRatio = Mathf.Clamp(salaryRatio, -5, 5); bonus.Append("Salary", salaryRatio); return(bonus); }