예제 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("----- Pokémon Battle Engine Test -----");

            PBESettings settings = PBESettings.DefaultSettings;

            PBEPokemonShell[] team0Party = PBECompetitivePokemonShells.CreateRandomTeam(settings.MaxPartySize).ToArray();
            PBEPokemonShell[] team1Party = PBECompetitivePokemonShells.CreateRandomTeam(settings.MaxPartySize).ToArray();
            PBEBattle         battle     = new PBEBattle(PBEBattleFormat.Triple, settings, team0Party, team1Party);

            battle.Teams[0].TrainerName = "Team 1";
            battle.Teams[1].TrainerName = "Team 2";
            battle.OnNewEvent          += PBEBattle.ConsoleBattleEventHandler;
            battle.OnStateChanged      += Battle_OnStateChanged;
            try
            {
                writer = new StreamWriter(new FileStream(logFile, FileMode.Create, FileAccess.Write));
            }
            catch (Exception e)
            {
                Console.WriteLine($"Cannot open \"{logFile}\" for writing.");
                Console.WriteLine(e.Message);
                return;
            }
            oldWriter = Console.Out;
            Console.SetOut(writer);
            battle.Begin();
        }
예제 #2
0
 public async Task Challenge(SocketUser battler1)
 {
     if (BattleContext.ActiveBattles.Any(b => b.Battlers.Contains(battler1)))
     {
         await Context.Channel.SendMessageAsync($"{battler1.Username} is already participating in a battle.");
     }
     else if (BattleContext.ActiveBattles.Any(b => b.Battlers.Contains(Context.User)))
     {
         await Context.Channel.SendMessageAsync($"{Context.User.Username} is already participating in a battle.");
     }
     else
     {
         PBEPokemonShell[] team0Party = PBECompetitivePokemonShells.CreateRandomTeam(PBESettings.DefaultSettings.MaxPartySize).ToArray();
         PBEPokemonShell[] team1Party = PBECompetitivePokemonShells.CreateRandomTeam(PBESettings.DefaultSettings.MaxPartySize).ToArray();
         PBEBattle         battle     = new PBEBattle(PBEBattleFormat.Single, PBESettings.DefaultSettings, team0Party, team1Party);
         battle.Teams[0].TrainerName = Context.User.Username;
         battle.Teams[1].TrainerName = battler1.Username;
         var battleContext = new BattleContext(battle, Context.User, battler1, Context.Channel);
     }
 }