Example #1
0
        public async Task RegisterPokeBattle(PokeBattleForCreationDto pokeBattleForCreationDto)
        {
            PokeBattleData battleDataForRepo = _mapper.Map <PokeBattleData>(pokeBattleForCreationDto);

            _repo.Add(battleDataForRepo);
            var res = await _repo.SaveAll();

            if (!res)
            {
                throw new Exception($"Failed to register new PokeBattle to database. Please check battle data construction.");
            }

            System.Console.WriteLine($"PokeBattle Id {battleDataForRepo.BattleTokenId} successfully added.");
        }
Example #2
0
        public async Task InitializeAsync(Guid battleTokenId)
        {
            if (PlayerOne == null || PlayerTwo == null)
            {
                return;
            }
            PokeBattleForCreationDto pokeBattleForCreationDto = new PokeBattleForCreationDto
                                                                (
                battleTokenId,
                PlayerOne.DiscordId,
                PlayerTwo.DiscordId
                                                                );

            StateManager = new PokeBattleStateManager(PlayerOne, PlayerTwo);
            await PokemonController.RegisterPokeBattle(pokeBattleForCreationDto);
        }