Exemple #1
0
        // stated to change.

        public async Task CreateGame(IUser Hoster, IGuild Host, ITextChannel public_GvG, ITextChannel guardian_Channel, ITextChannel gaia_Channel, ITextChannel oC_Channel)
        {
            if (Status > GameStatus.Cancelled && Status < GameStatus.GaiaEnding)
            {
                throw new AlreadyOngoingGameGvGGameException();
            }

            Day = 0;

            this.Hoster = Hoster;

            Guardian        = Host.Roles.First((x) => x.Name == Parent.config.guardian_chan_name);
            Gaia            = Host.Roles.First((x) => x.Name == Parent.config.gaia_chan_name);
            Occult_Club     = Host.Roles.First((x) => x.Name == Parent.config.oc_chan_name);
            GvG_Player      = Host.Roles.First((x) => x.Name == Parent.config.gvg_player_role_name);
            GvG_Dead_Player = Host.Roles.First((x) => x.Name == Parent.config.gvg_dead_player_role_name);

            ServerHost       = Host;
            Public_GvG       = public_GvG;
            Gaia_Channel     = gaia_Channel;
            Guardian_Channel = guardian_Channel;
            OC_Channel       = oC_Channel;

            GaiaMembers.Clear();
            GuardianMembers.Clear();
            OCMembers.Clear();
            Civilians.Clear();
            DeadPeople.Clear();

            RoleAssignments.Clear();

            Status = GameStatus.GamePreparation;

            await(await Host.GetTextChannelsAsync()).First((x) => x.Name == Parent.config.pub_gvg_chan_name)
            .SendMessageAsync(null, false, new EmbedBuilder()
                              .WithTitle(ResultMessages.CreateGameSuccess)
                              .WithDescription(string.Format(ResultMessages.CreateGameSuccess_Desc, Hoster.Mention))
                              .Build());
        }
Exemple #2
0
    // TODO: test wih Parallel.ForEach
    // note paralellism overhead

    //  Parallel.ForEach(Population, p =>
    //  {
    //      //Your stuff
    //  });

    // potential to run foreach(demo d in demografics) {foreach Person p in d }

    // TODO individual person turn control

    // public bool nextPerson;
    protected override void turn()
    {
        // start new log
        for (int i = 0; i < Markets.Length; i++)
        {
            Markets[i].StartTimeSpan();
        }
        // turn
        foreach (Person p in Population)
        {
            p.turn();
        }
        // print data
        Interface.printDems();
        // respawn death row people
        // foreach(Person p in DeadPeople) {
        //     lostCash += p.Cash;
        //     RespawnPerson(p);
        // }
        RespawnBankruptPeople();
        // update current DataPanels. BEFORE endTimeSpan, else currents return null
        Interface.updateCurrentData(getCurrentLogs());
        // store current logs
        for (int i = 0; i < Markets.Length; i++)
        {
            Markets[i].EndTimeSpan();
        }
        // determine most profitable
        // decimal currentHighest_perCapita = 0m;
        // for(int i = 0; i < Markets.Length; i++) {
        //     // CurrencyVolume / Demographic.Count > currentHighest
        //     if(Markets[i].Logs.LastOrDefault().CurrencyVolume / Demographics[i].Count > currentHighest_perCapita) {
        //         currentHighest_perCapita = Markets[i].Logs.LastOrDefault().CurrencyVolume / Demographics[i].Count;

        //         currentProfitable = (Profession)i;
        //     }
        // }
        DeadPeople.Clear();
    }