示例#1
0
        public static async Task <Embed> CreateBattleSceneEmbed(SocketSelfUser self, BattlePlayer playerInControl, BattlePlayer opponent, PokemonController pokemonController)
        {
            var controllerPokemon = playerInControl.CurrentPokemon;
            var opponentPokemon   = opponent.CurrentPokemon;
            var backFacingSprite  = (await pokemonController.GetPokemonData(controllerPokemon.PokeId)).BackSpriteUrl;
            var frontFacingSprite = (await pokemonController.GetPokemonData(opponentPokemon.PokeId)).FrontSpriteUrl;

            string controllerHealthbar = GetPokemonHealthBar(controllerPokemon);
            string opponentHealthBar   = GetPokemonHealthBar(opponentPokemon);

            var opponentField = new EmbedFieldBuilder()
                                .WithName($"`{opponentHealthBar}`\n{(int)opponentPokemon.Stats.HP}/{(int)opponentPokemon.Stats.MaxHP}")
                                .WithValue($"`{opponentPokemon.Name} Lv. {opponentPokemon.Stats.Level}`");
            var controllerField = new EmbedFieldBuilder()
                                  .WithName($"`{controllerHealthbar}`\n {(int)controllerPokemon.Stats.HP}/{(int)controllerPokemon.Stats.MaxHP}")
                                  .WithValue($"`{controllerPokemon.Name} Lv. {controllerPokemon.Stats.Level}`")
                                  .WithIsInline(true);
            var moves   = "▄▄▄▄▄▄▄▄▄▄▄\n\n►► Moves ◄◄\n";
            int counter = 1;

            foreach (var move in controllerPokemon.Moves)
            {
                moves += $"║ {counter}. {move.Name} :: {move.PP} PP\n";
                counter++;
            }
            var fieldEmpty1 = new EmbedFieldBuilder()
                              .WithName(".")
                              .WithValue(".");
            var fieldEmpty2 = new EmbedFieldBuilder()
                              .WithName(".")
                              .WithValue(".");
            var fieldEmpty3 = new EmbedFieldBuilder()
                              .WithName(".")
                              .WithIsInline(true)
                              .WithValue(".");
            var fieldEmpty4 = new EmbedFieldBuilder()
                              .WithName(".")
                              .WithIsInline(true)
                              .WithValue(".");

            return(new EmbedBuilder()
                   .WithFields(new[] { opponentField, fieldEmpty1, fieldEmpty2, fieldEmpty3, fieldEmpty4, controllerField })
                   .WithFooter(footer => footer.Text = moves)
                   .WithThumbnailUrl(frontFacingSprite)
                   .WithImageUrl(backFacingSprite)
                   .Build());
        }