Пример #1
0
        private void updateCitizenAfterWork(Company company, Citizen citizen)
        {
            var employee = company.CompanyEmployees.First(e => e.CitizenID == citizen.ID);

            employee.TodayProduction = (decimal)GetProductionPoints(citizen, company);
            employee.TodayHP         = citizen.HitPoints;
            employee.TodaySalary     = (decimal)(GetTodaySalary(citizen, employee));

            var experience    = getXPFromWork(company, citizen);
            var skillIncrease = citizenService.GetSkillIncreaseForWork(citizen.ID, (WorkTypeEnum)company.WorkTypeID);
            var lostHP        = getHPForWork(citizen, company);

            citizen.HitPoints      -= lostHP;
            citizen.LastActivityDay = GameHelper.CurrentDay;
            using (NoSaveChanges)
                citizenService.GrantExperience(citizen, getXPFromWork(company, citizen));

            citizenService.IncreaseSkill(citizen.ID, (WorkTypeEnum)company.WorkTypeID, skillIncrease);

            citizen.Worked = true;
            citizen.DayWorkedRow++;
        }