Пример #1
0
        public override void QualifyClubs()
        {
            List <Club> ranking = Ranking();
            //Simuler des gains d'argent de matchs pour les clubs (affluence)

            DateTime fin = DateEndRound();
            DateTime dateInitialisationRound = DateInitialisationRound();

            if (fin.Month < dateInitialisationRound.Month)
            {
                fin = fin.AddYears(1);
            }
            else if (fin.Month == dateInitialisationRound.Month && fin.Day < dateInitialisationRound.Day)
            {
                fin = fin.AddYears(1);
            }
            int matchesCount = (int)((fin - dateInitialisationRound).TotalDays) / 14;

            foreach (Club c in ranking)
            {
                CityClub cv = c as CityClub;
                if (cv != null)
                {
                    cv.ModifyBudget(matchesCount * cv.supporters * cv.ticketPrice, BudgetModificationReason.TournamentGrant);
                }
            }

            List <Qualification> adjustedQualifications = new List <Qualification>(_qualifications);

            adjustedQualifications.Sort(new QualificationComparator());

            if (_rules.Contains(Rule.ReservesAreNotPromoted))
            {
                adjustedQualifications = Utils.AdjustQualificationsToNotPromoteReserves(_qualifications, ranking, Tournament);
            }

            foreach (Qualification q in adjustedQualifications)
            {
                Club c = ranking[q.ranking - 1];
                if (!q.isNextYear)
                {
                    q.tournament.rounds[q.roundId].clubs.Add(c);
                }
                else
                {
                    q.tournament.AddClubForNextYear(c, q.roundId);
                }
                if (q.tournament.isChampionship && c.Championship != null)
                {
                    if (q.tournament.level > c.Championship.level)
                    {
                        c.supporters = (int)(c.supporters * 1.4f);
                    }
                    else if (q.tournament.level < c.Championship.level)
                    {
                        c.supporters = (int)(c.supporters / 1.4f);
                    }
                }
            }
        }
Пример #2
0
        public override void DistributeGrants()
        {
            List <Club> ranking = new List <Club>(_clubs);

            ranking.Sort(new ClubRankingComparator(this.matches));
            foreach (Prize d in _prizes)
            {
                CityClub cc = ranking[d.Ranking - 1] as CityClub;
                if (cc != null)
                {
                    cc.ModifyBudget(d.Amount, BudgetModificationReason.TournamentGrant);
                }
            }
        }
Пример #3
0
        public override void DistributeGrants()
        {
            List <Match> matches;

            if (twoLegs)
            {
                matches = new List <Match>(_matches);
            }
            else
            {
                matches = new List <Match>();
                int nbMatches = _matches.Count;
                for (int i = 0; i < nbMatches; i++)
                {
                    matches.Add(_matches[i]);
                }
            }
            foreach (Prize d in _prizes)
            {
                if (d.Ranking == 1)
                {
                    foreach (Match m in matches)
                    {
                        CityClub cv = m.Winner as CityClub;
                        if (cv != null)
                        {
                            cv.ModifyBudget(d.Amount, BudgetModificationReason.TournamentGrant);
                        }
                    }
                }
                if (d.Ranking == 2)
                {
                    foreach (Match m in matches)
                    {
                        CityClub cv = m.Looser as CityClub;
                        if (cv != null)
                        {
                            cv.ModifyBudget(d.Amount, BudgetModificationReason.TournamentGrant);
                        }
                    }
                }
            }
        }