Exemplo n.º 1
0
 private void DetermineWhoIsWorkingOnJob(FreelanceJob job)
 {
     world.MyAgency.Manager.WorkingOnJob = true;
     if (world.MyAgency.AgentCount > 0)
     {
         if (job.JobType == JobType.scouting || job.JobType == JobType.negotiating)
         {
             foreach (Agent a in world.MyAgency.AgentList)
             {
                 a.WorkingOnJob = true;
             }
         }
     }
 }
Exemplo n.º 2
0
        public void AttemptJob(FreelanceJob job, Timer timer, ProgressBar progressBar)
        {
            //setup Agency to record days attempting new job
            world.MyAgency.AttemptingJob     = true;
            world.MyAgency.DaysAttemptingJob = 0;

            AttemptedJob = job;

            DetermineWhoIsWorkingOnJob(AttemptedJob);

            jobTimer               = timer;
            jobProgressBar         = progressBar;
            jobProgressBar.Maximum = AttemptedJob.PointsUntilCompletion;
            DetermineIncrement(AttemptedJob);
            InitializeMyTimer(jobTimer, jobProgressBar);

            // disable buttons so agency cannot do anything other than this job
            DisableButtons();
        }
Exemplo n.º 3
0
        private int DetermineIncrement(FreelanceJob job)
        {
            int min = 0;
            int max = 0;


            if (AttemptedJob.JobType == JobType.education)
            {
                min = Convert.ToInt32(Math.Round((Convert.ToDouble(world.MyAgency.Manager.CurrentEfficiency) / 100) * Convert.ToDouble(world.MyAgency.Manager.Intelligence)));
                max = world.MyAgency.Manager.Intelligence;
            }
            else if (AttemptedJob.JobType == JobType.negotiating)
            {
                min += Convert.ToInt32(Math.Round((Convert.ToDouble(world.MyAgency.Manager.CurrentEfficiency) / 100) * Convert.ToDouble(((world.MyAgency.Manager.Negotiating * 3) + (world.MyAgency.Manager.Power * 2) + (world.MyAgency.Manager.Greed)) / 6)));
                max += ((world.MyAgency.Manager.Negotiating * 3) + (world.MyAgency.Manager.Power * 2) + (world.MyAgency.Manager.Greed)) / 6;

                if (world.MyAgency.AgentList.Count > 0)
                {
                    foreach (Agent a in world.MyAgency.AgentList)
                    {
                        min += Convert.ToInt32(Math.Round((Convert.ToDouble(a.CurrentEfficiency) / 100) * Convert.ToDouble(((a.Negotiating * 3) + (a.Power * 2) + (a.Greed)) / 6)));
                        max += ((a.Negotiating * 3) + (a.Power * 2) + (a.Greed)) / 6;
                    }
                }
            }
            else if (AttemptedJob.JobType == JobType.scouting)
            {
                min += Convert.ToInt32(Math.Round((Convert.ToDouble(world.MyAgency.Manager.CurrentEfficiency) / 100) * Convert.ToDouble(((world.MyAgency.Manager.Scouting * 9) + (world.MyAgency.Manager.Intelligence)) / 10)));
                max += ((world.MyAgency.Manager.Scouting * 9) + (world.MyAgency.Manager.Intelligence)) / 10;
                foreach (Agent a in world.MyAgency.AgentList)
                {
                    min += Convert.ToInt32(Math.Round((Convert.ToDouble(a.CurrentEfficiency) / 100) * Convert.ToDouble(((a.Scouting * 9) + (a.Intelligence)) / 10)));
                    max += ((a.Scouting * 9) + (a.Intelligence)) / 10;
                }
            }

            increment = rnd.Next(min, max + 1);
            Console.WriteLine("min = " + min.ToString() + ", max = " + max.ToString() + ", Increment = " + increment.ToString());

            return(increment);
        }
Exemplo n.º 4
0
 public void AddFreelanceJob(FreelanceJob job)
 {
     _FreelanceJobsAvailable.Add(job);
 }
Exemplo n.º 5
0
 private void AwardCompanyPayouts(FreelanceJob job)
 {
     world.MyAgency.AddInfluencePoints(job.IPPayout);
     world.MyAgency.AddMoney(job.MoneyPayout);
 }
Exemplo n.º 6
0
        private void ScoreJob(FreelanceJob job)
        {
            double baselineScore = job.BaselineJobScore;
            double jobScore      = 10;
            bool   jobDoneInTime;
            string results;
            double penaltyPercentage = 0;

            BasketballPlayer basketballPlayer = null;
            BaseballPlayer   baseballPlayer   = null;
            HockeyPlayer     hockeyPlayer     = null;
            FootballPlayer   footballPlayer   = null;
            SoccerPlayer     soccerPlayer     = null;

            Console.WriteLine("Agency Days To Complete Job: " + world.MyAgency.DaysAttemptingJob.ToString());

            if (world.MyAgency.DaysAttemptingJob <= job.DaysToComplete)
            {
                jobDoneInTime = true;
            }
            else
            {
                jobDoneInTime = false;
            }

            if (!jobDoneInTime)
            {
                penaltyPercentage = (Convert.ToDouble(world.MyAgency.DaysAttemptingJob) - Convert.ToDouble(job.DaysToComplete)) / Convert.ToDouble(job.DaysToComplete);
                Console.WriteLine("Original Job Score: " + jobScore.ToString());
            }

            if (job.JobType == JobType.education)
            {
                jobScore = 10;
            }
            else if (job.JobType == JobType.negotiating)
            {
                GetClientSignedFunctions getClientSignedFunctions = new GetClientSignedFunctions(world.mainForm, world);
                League        league;
                List <Agency> agencyList = new List <Agency>();
                Sports        sport      = world.MyAgency.Licenses[world.rnd.Next(0, world.MyAgency.Licenses.Count)];
                job.Sport = sport;
                foreach (Agency a in world.Agencies)
                {
                    if (a != world.MyAgency)
                    {
                        agencyList.Add(a);
                    }
                }

                if (job.Sport == Sports.Soccer)
                {
                    agencyList          = agencyList.OrderByDescending(o => o.SoccerControl).ToList();
                    league              = world.MLS;
                    soccerPlayer        = new SoccerPlayer(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26), AssignRandomPosition(job.Sport));
                    soccerPlayer.League = league;
                    getClientSignedFunctions.AttemptToGetPlayerSigned(soccerPlayer, league, agencyList[0]);
                    getClientSignedFunctions.BeginNegotiations("money");
                    jobScore = soccerPlayer.TeamHappiness;
                }
                else if (job.Sport == Sports.Hockey)
                {
                    agencyList          = agencyList.OrderByDescending(o => o.HockeyControl).ToList();
                    league              = world.NHL;
                    hockeyPlayer        = new HockeyPlayer(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26), AssignRandomPosition(job.Sport));
                    hockeyPlayer.League = league;
                    getClientSignedFunctions.AttemptToGetPlayerSigned(hockeyPlayer, league, agencyList[0]);
                    getClientSignedFunctions.BeginNegotiations("money");
                    jobScore = hockeyPlayer.TeamHappiness;
                }
                else if (job.Sport == Sports.Baseball)
                {
                    agencyList            = agencyList.OrderByDescending(o => o.BaseballControl).ToList();
                    league                = world.MLB;
                    baseballPlayer        = new BaseballPlayer(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26), AssignRandomPosition(job.Sport));
                    baseballPlayer.League = league;
                    getClientSignedFunctions.AttemptToGetPlayerSigned(baseballPlayer, league, agencyList[0]);
                    getClientSignedFunctions.BeginNegotiations("money");
                    jobScore = baseballPlayer.TeamHappiness;
                }
                else if (job.Sport == Sports.Basketball)
                {
                    agencyList              = agencyList.OrderByDescending(o => o.BasketballControl).ToList();
                    league                  = world.NBA;
                    basketballPlayer        = new BasketballPlayer(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26), AssignRandomPosition(job.Sport));
                    basketballPlayer.League = league;
                    getClientSignedFunctions.AttemptToGetPlayerSigned(basketballPlayer, league, agencyList[0]);
                    getClientSignedFunctions.BeginNegotiations("money");
                    jobScore = basketballPlayer.TeamHappiness;
                }
                else //if (job.Sport == Sports.Football)
                {
                    agencyList            = agencyList.OrderByDescending(o => o.FootballControl).ToList();
                    league                = world.NFL;
                    footballPlayer        = new FootballPlayer(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26), AssignRandomPosition(job.Sport));
                    footballPlayer.League = league;
                    getClientSignedFunctions.AttemptToGetPlayerSigned(footballPlayer, league, agencyList[0]);
                    getClientSignedFunctions.BeginNegotiations("money");
                    jobScore = footballPlayer.TeamHappiness;
                }

                jobScore = jobScore / 10;

                /*Player createdPlayer = new Player(world.rnd, league.IdCount, job.Sport, world.rnd.Next(21, 26));
                 * createdPlayer.Position = AssignRandomPosition(job.Sport);
                 * createdPlayer.League = league;
                 * getClientSignedFunctions.AttemptToGetPlayerSigned(createdPlayer, league, agencyList[0]);
                 * getClientSignedFunctions.BeginNegotiations("money");
                 * jobScore = createdPlayer.TeamHappiness;*/


                //if (jobDoneInTime) jobScore = rnd.Next(6, 11);
                //else jobScore = rnd.Next(1, 6);
            }
            else if (job.JobType == JobType.scouting)
            {
            }



            jobScore = jobScore * (1 - penaltyPercentage);

            Console.WriteLine("penaltyPercentage = " + penaltyPercentage);

            results = "Baseline Score Needed: " + baselineScore.ToString() + Environment.NewLine
                      + "Agency's Job Score: " + jobScore.ToString() + Environment.NewLine;

            if (jobScore >= baselineScore)
            {
                results = results + "SUCCESS!";
                AwardCompanyPayouts(job);
            }
            else
            {
                results = results + "JOB FAILED!";
                // knock agency reputation?
                world.MyAgency.Manager.AddPower(-1);
                world.MyAgency.Manager.UpdateManagerUI(world.mainForm);
            }
            MessageBox.Show(results);
            world.MyAgency.FreelanceJobsAvailable.Remove(job);
            AllEmployeesNotWorking();
            DisplayAvailableJobs();
        }
Exemplo n.º 7
0
        private void btnAcceptJob3_Click(object sender, EventArgs e)
        {
            FreelanceJob job = world.MyAgency.FreelanceJobsAvailable[2];

            freelance.AttemptJob(job, freelanceJobTimer, jobProgressBar);
        }