public CreateTournamentResult TryCreatePlayerInitiatedTournament()
        {
            var payorHero = MBHero.MainHero;

            var options = new CreateTournamentOptions()
            {
                Settlement = payorHero.CurrentSettlement,
                Type       = TournamentType.PlayerInitiated
            };

            return(CreateTournament(options));
        }
        public CreateTournamentResult TryCreateProsperityTournament()
        {
            var findSettlementResult = SettlementFinder.FindForProsperityTournament();

            if (findSettlementResult.Failed)
            {
                return(CreateTournamentResult.Failure);
            }

            var options = new CreateTournamentOptions()
            {
                Settlement = findSettlementResult.AllQualifiedCandidates.Shuffle().First(),
                Type       = TournamentType.Prosperity
            };

            return(CreateTournament(options));
        }
Esempio n. 3
0
        public CreateTournamentResult TryCreateHighbornTournament()
        {
            var findSettlementResult = SettlementFinder.FindForHighbornTournament();

            if (findSettlementResult.Failed)
            {
                return(CreateTournamentResult.Failure);
            }

            var createTournamentOptions = new CreateTournamentOptions()
            {
                InitiatingHero = findSettlementResult.InitiatingHero,
                Settlement     = findSettlementResult.Nominee,
                Type           = TournamentType.Peace
            };

            return(CreateTournament(createTournamentOptions));
        }
        public CreateTournamentResult TryCreateWeddingTournament(MBHero firstWeddedHero,
                                                                 MBHero secondWeddedHero)
        {
            var findSettlementResult = SettlementFinder.FindForWeddingTournament(firstWeddedHero, secondWeddedHero);

            if (findSettlementResult.Failed)
            {
                return(CreateTournamentResult.Failure);
            }

            var options = new CreateTournamentOptions()
            {
                Settlement = findSettlementResult.Nominee,
                Type       = TournamentType.Wedding
            };

            return(CreateTournament(options));
        }
Esempio n. 5
0
        public CreateTournamentResult TryMakeBirthTournament(MBHero mother)
        {
            var findSettlementResult = SettlementFinder.FindForBirthTournament(mother);

            if (findSettlementResult.Failed)
            {
                return(CreateTournamentResult.Failure);
            }

            var createTournamentOptions = new CreateTournamentOptions()
            {
                InitiatingHero = findSettlementResult.InitiatingHero,
                Settlement     = findSettlementResult.Nominee,
                Type           = TournamentType.Peace
            };

            return(CreateTournament(createTournamentOptions));
        }
        public virtual void CreateInitialTournaments()
        {
            var townsWithExisting    = MBTown.AllTownsWithTournaments;
            var townsWithoutExisting = MBTown.AllTownsWithoutTournaments;
            var numExisting          = townsWithExisting.Count;
            var maxPossible          = townsWithoutExisting.Count;
            var numRequested         = Settings.TournamentInitialSpawnCount - numExisting;
            var numToCreate          = (numRequested <= maxPossible) ? numRequested : maxPossible;

            CreateTournamentOptions options;

            foreach (var town in townsWithExisting)
            {
                options = new CreateTournamentOptions()
                {
                    Settlement = town.Settlement,
                    Type       = TournamentType.Initial
                };

                CreateTournament(options);
            }

            var numCreated = 0;

            foreach (var town in townsWithoutExisting.Shuffle())
            {
                if (numCreated >= numToCreate)
                {
                    break;
                }

                options = new CreateTournamentOptions()
                {
                    Settlement = town.Settlement,
                    Type       = TournamentType.Initial,
                };

                CreateTournament(options);

                numCreated++;
            }
        }