private static void ApplyLowSalaryLoyalty(GameEntity company, ref Bonus <int> bonus, HumanFF worker)
        {
            bool isFounder = worker.hasShareholder; // &&

            // company.shareholders.Shareholders.ContainsKey(worker.shareholder.Id);

            if (isFounder)
            {
                return;
            }

            var salary = Humans.GetSalary(worker);

            var expectedSalary = (double)GetSalaryPerRating(worker);

            bool isGreedy = Humans.HasTrait(worker, Trait.Greedy);
            bool isShy    = Humans.HasTrait(worker, Trait.Shy);

            float multiplier = 0.8f;

            if (isGreedy)
            {
                multiplier = 0.9f;
            }
            else if (isShy)
            {
                multiplier = 0.5f;
            }

            // multiply on 4 cause period = week
            if (salary * 4 < expectedSalary * multiplier)
            {
                bonus.Append("Low salary", -5);
            }
        }
        public static Bonus <int> GetLoyaltyChangeBonus(HumanFF worker, TeamInfo team,
                                                        Dictionary <CorporatePolicy, int> culture, GameEntity company)
        {
            var bonus = new Bonus <int>("Loyalty");

            bonus.Append("Base value", 1);

            var loyaltyBuff = team.ManagerTasks.Count(t => t == ManagerTask.ImproveAtmosphere);

            bonus.AppendAndHideIfZero("Manager focus on atmosphere", loyaltyBuff);

            var role = worker.WorkerComponent.WorkerRole;

            // TODO: if is CEO in own project, morale loss is zero or very low
            bonus.AppendAndHideIfZero("IS FOUNDER", worker.WorkerComponent.WorkerRole == WorkerRole.CEO ? 5 : 0);

            // same role workers
            //ApplyDuplicateWorkersLoyalty(company, team, gameContext, ref bonus, worker, role);

            // salary
            ApplyLowSalaryLoyalty(company, ref bonus, worker);

            // incompetent leader
            //ApplyCEOLoyalty(company, team, gameContext, ref bonus, worker, role);

            // no possibilities to grow
            var rating = Humans.GetRating(worker);
            var max    = 70;

            if (role != WorkerRole.CEO)
            {
                bonus.AppendAndHideIfZero($"Outgrown company (skill >= {max})", rating >= max ? -3 : 0);
            }

            bonus.AppendAndHideIfZero("Too many leaders", Humans.HasTrait(worker, Trait.Leader) && team.TooManyLeaders ? -2 : 0);

            if (team.isManagedBadly)
            {
                bonus.Append("Terrible management", -3);
            }

            // bonus.AppendAndHideIfZero(hu)
            return(bonus);
        }
Ejemplo n.º 3
0
        public static float GetPersonalSalaryModifier(HumanFF human)
        {
            float modifier = 0;

            bool isShy    = Humans.HasTrait(human, Trait.Shy);
            bool isGreedy = Humans.HasTrait(human, Trait.Greedy);

            if (isShy)
            {
                modifier -= 0.3f;
            }

            if (isGreedy)
            {
                modifier += 0.3f;
            }

            return(modifier);
        }
        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);
        }