public async Task Info([Remainder] string abilityName)
            {
                PBEAbility?nAbility = PBELocalizedString.GetAbilityByName(abilityName);

                if (!nAbility.HasValue || nAbility.Value == PBEAbility.None)
                {
                    await Context.Channel.SendMessageAsync($"{Context.User.Mention} Invalid ability!");
                }
                else
                {
                    PBEAbility   ability = nAbility.Value;
                    EmbedBuilder embed   = new EmbedBuilder()
                                           .WithAuthor(Context.User)
                                           .WithColor(Utils.RandomColor())
                                           .WithTitle(PBELocalizedString.GetAbilityName(ability).English)
                                           .WithUrl(Utils.URL)
                                           .WithDescription(PBELocalizedString.GetAbilityDescription(ability).English.Replace('\n', ' '));
                    await Context.Channel.SendMessageAsync(string.Empty, embed : embed.Build());
                }
            }
예제 #2
0
        private unsafe void DrawStatsPage(uint *bmpAddress, int bmpWidth, int bmpHeight)
        {
            const float winX            = 0.03f;
            const float winY            = 0.15f;
            const float winW            = 0.97f - winX;
            const float winH            = 0.995f - winY;
            const float leftColX        = winX + 0.02f;
            const float rightColX       = winX + 0.52f;
            const float rightColY       = winY + 0.02f;
            const float rightColW       = 0.95f - rightColX;
            const float rightColH       = 0.535f;
            const float rightColCenterX = rightColX + (rightColW / 2f);
            const float textStartY      = rightColY + 0.01f;
            const float textStart2Y     = rightColY + 0.13f;
            const float textSpacingY    = 0.08f;
            const float abilTextY       = textStart2Y + (5.5f * textSpacingY);
            const float abilDescX       = leftColX + 0.03f;
            const float abilDescY       = textStart2Y + (6.6f * textSpacingY);
            const float abilX           = winX + 0.18f;
            const float abilTextX       = abilX + 0.03f;
            const float abilY           = abilTextY;
            const float abilW           = 0.95f - abilX;
            const float abilH           = 0.075f;
            int         hpW             = (int)(bmpWidth * 0.3f);
            int         hpX             = RenderUtils.GetCoordinatesForCentering(bmpWidth, hpW, rightColCenterX);
            int         hpY             = (int)(bmpHeight * (rightColY + 0.09f));

            RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, winX, winY, winX + winW, winY + winH, 12, RenderUtils.Color(135, 145, 250, 255));
            // Stats
            RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, rightColX, rightColY, rightColX + rightColW, rightColY + rightColH, 8, RenderUtils.Color(210, 210, 210, 255));
            // Abil
            RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, abilX, abilY, abilX + abilW, abilY + abilH, 5, RenderUtils.Color(210, 210, 210, 255));
            // Abil desc
            RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, leftColX, abilDescY, 0.95f, 0.98f, 5, RenderUtils.Color(210, 210, 210, 255));

            Font leftColFont = Font.Default;

            uint[] leftColColors = Font.DefaultWhite_DarkerOutline_I;
            Font   rightColFont  = Font.Default;

            uint[] rightColColors = Font.DefaultBlack_I;
            uint[] boostedColors  = Font.DefaultRed_Lighter_O;
            uint[] dislikedColors = Font.DefaultCyan_O;

            void PlaceLeftCol(int i, string leftColStr, bool boosted, bool disliked)
            {
                float y;

                if (i == -1)
                {
                    y = abilTextY;
                }
                else if (i == -2)
                {
                    y = textStartY;
                }
                else
                {
                    y = textStart2Y + (i * textSpacingY);
                }
                uint[] colors;
                if (boosted)
                {
                    colors = boostedColors;
                }
                else if (disliked)
                {
                    colors = dislikedColors;
                }
                else
                {
                    colors = leftColColors;
                }
                leftColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, leftColX, y, leftColStr, colors);
            }

            void PlaceRightCol(int i, string rightColStr, uint[] colors)
            {
                float y = i == -2 ? textStartY : textStart2Y + (i * textSpacingY);

                rightColFont.MeasureString(rightColStr, out int strW, out _);
                rightColFont.DrawString(bmpAddress, bmpWidth, bmpHeight,
                                        RenderUtils.GetCoordinatesForCentering(bmpWidth, strW, rightColCenterX), (int)(bmpHeight * y), rightColStr, colors);
            }

            BaseStats          bs;
            PBEAbility         abil;
            PBENature          nature;
            IPBEStatCollection evs;
            IVs    ivs;
            byte   level;
            ushort hp;
            ushort maxHP;

            if (_pPkmn is not null)
            {
                bs     = BaseStats.Get(_pPkmn.Species, _pPkmn.Form, true);
                abil   = _pPkmn.Ability;
                nature = _pPkmn.Nature;
                evs    = _pPkmn.EffortValues;
                ivs    = _pPkmn.IndividualValues;
                level  = _pPkmn.Level;
                hp     = _pPkmn.HP;
                maxHP  = _pPkmn.MaxHP;
            }
            else if (_pcPkmn is not null)
            {
                bs     = BaseStats.Get(_pcPkmn.Species, _pcPkmn.Form, true);
                abil   = _pcPkmn.Ability;
                nature = _pcPkmn.Nature;
                evs    = _pcPkmn.EffortValues;
                ivs    = _pcPkmn.IndividualValues;
                level  = _pcPkmn.Level;
                hp     = maxHP = PBEDataUtils.CalculateStat(bs, PBEStat.HP, nature, evs.GetStat(PBEStat.HP), ivs.HP, level, PkmnConstants.PBESettings);
            }
            else
            {
                PartyPokemon     pPkmn = _bPkmn.PartyPkmn;
                PBEBattlePokemon bPkmn = _bPkmn.Pkmn;
                bs     = BaseStats.Get(pPkmn.Species, bPkmn.RevertForm, true);
                abil   = pPkmn.Ability;
                nature = pPkmn.Nature;
                evs    = bPkmn.EffortValues;
                ivs    = pPkmn.IndividualValues;
                level  = bPkmn.Level;
                hp     = bPkmn.HP;
                maxHP  = bPkmn.MaxHP;
            }
            ushort  atk      = PBEDataUtils.CalculateStat(bs, PBEStat.Attack, nature, evs.GetStat(PBEStat.Attack), ivs.Attack, level, PkmnConstants.PBESettings);
            ushort  def      = PBEDataUtils.CalculateStat(bs, PBEStat.Defense, nature, evs.GetStat(PBEStat.Defense), ivs.Defense, level, PkmnConstants.PBESettings);
            ushort  spAtk    = PBEDataUtils.CalculateStat(bs, PBEStat.SpAttack, nature, evs.GetStat(PBEStat.SpAttack), ivs.SpAttack, level, PkmnConstants.PBESettings);
            ushort  spDef    = PBEDataUtils.CalculateStat(bs, PBEStat.SpDefense, nature, evs.GetStat(PBEStat.SpDefense), ivs.SpDefense, level, PkmnConstants.PBESettings);
            ushort  speed    = PBEDataUtils.CalculateStat(bs, PBEStat.Speed, nature, evs.GetStat(PBEStat.Speed), ivs.Speed, level, PkmnConstants.PBESettings);
            PBEStat?favored  = nature.GetLikedStat();
            PBEStat?disliked = nature.GetDislikedStat();

            PlaceLeftCol(-2, "HP", false, false);
            PlaceLeftCol(0, "Attack", favored == PBEStat.Attack, disliked == PBEStat.Attack);
            PlaceLeftCol(1, "Defense", favored == PBEStat.Defense, disliked == PBEStat.Defense);
            PlaceLeftCol(2, "Special Attack", favored == PBEStat.SpAttack, disliked == PBEStat.SpAttack);
            PlaceLeftCol(3, "Special Defense", favored == PBEStat.SpDefense, disliked == PBEStat.SpDefense);
            PlaceLeftCol(4, "Speed", favored == PBEStat.Speed, disliked == PBEStat.Speed);
            PlaceLeftCol(-1, "Ability", false, false);

            // HP
            string str = string.Format("{0}/{1}", hp, maxHP);

            PlaceRightCol(-2, str, rightColColors);
            double percent = (double)hp / maxHP;

            RenderUtils.HP_TripleLine(bmpAddress, bmpWidth, bmpHeight, hpX, hpY, hpW, percent);
            // Attack
            str = atk.ToString();
            PlaceRightCol(0, str, rightColColors);
            // Defense
            str = def.ToString();
            PlaceRightCol(1, str, rightColColors);
            // Sp. Attack
            str = spAtk.ToString();
            PlaceRightCol(2, str, rightColColors);
            // Sp. Defense
            str = spDef.ToString();
            PlaceRightCol(3, str, rightColColors);
            // Speed
            str = speed.ToString();
            PlaceRightCol(4, str, rightColColors);
            // Ability
            str = PBELocalizedString.GetAbilityName(abil).English;
            rightColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, abilTextX, abilTextY, str, rightColColors);
            // Ability desc
            str = PBELocalizedString.GetAbilityDescription(abil).English;
            leftColFont.DrawString(bmpAddress, bmpWidth, bmpHeight, abilDescX, abilDescY, str, rightColColors);
        }