<commit_before>'use strict'

const { MessageEmbed } = require('discord.js');
const Matcher = require('did-you-mean');
const stripIndents = require('common-tags').stripIndents;
const config = require('config.json')('./config.json');

const abilities = require("../data/abilities.js");
const aliases = require("../data/aliases.js");
const items = require("../data/items.js");
const learnsets = require("../data/learnsets.js");
const moves = require("../data/moves.js");
const pokedex = require("../data/pokedex.js");
const typechart = require("../data/typechart.js");

class EmbedGenerator {
    constructor(parser) {
        this.parser = parser;
    }

    quick(title, text) {
        return new MessageEmbed()
        .setDescription(text)
        .setTitle(title)
        .setColor(config.embedColor)
        .setTimestamp();
    }

    generateAbilityEmbed(ability, parser) {
        return new MessageEmbed()
        .setDescription(`${ability.desc}`)
        .setAuthor(ability.name)
        .setColor(config.embedColor)
        .setTimestamp();
    }
    generatePokemonEmbed(pokemon, parser) {
        let weakChart = parser.weak(pokemon);

        return new MessageEmbed()
        .setAuthor(`${pokemon.num.toString()} - ${pokemon.species}`)
        .setColor(config.embedColor)
        .setDescription(stripIndents`
        **HP:** ${pokemon.baseStats.hp}
        **Atk:** ${pokemon.baseStats.atk}
        **Def:** ${pokemon.baseStats.def}
        **SpA:** ${pokemon.baseStats.spa}
        **SpD:** ${pokemon.baseStats.spd}
        **Spe:** ${pokemon.baseStats.spe}
        **BST:** ${Object.values(pokemon.baseStats).reduce((a, b) => a + b, 0)}`)
        .setThumbnail(`http://play.pokemonshowdown.com/sprites/xyani/${pokemon.species.toLowerCase().replace(" ", "")}.gif`)
        .setTimestamp()
        .addField(`Types`, `${pokemon.types.join(", ")}`)
        .addField(`Abilities`, `${Object.values(pokemon.abilities).join(", ")}`)
        .addField(`Weakness & Resistance`, stripIndents`
        *1x values are ommited use \`weak ${weakChart.pokemon} true\` to show.*`
        + `${weakChart["Bug"] != 1 ? `\n**Bug**: ${weakChart["Bug"]}`: ""}`
        + `${weakChart["Dark"] != 1 ? `\n**Dark**: ${weakChart["Dark"]}`: ""}`
        + `${weakChart["Dragon"] != 1 ? `\n**Dragon**: ${weakChart["Dragon"]}`: ""}`
        + `${weakChart["Electric"] != 1 ? `\n**Electric**: ${weakChart["Electric"]}`: ""}`
        + `${weakChart["Fairy"] != 1 ? `\n**Fairy**: ${weakChart["Fairy"]}`: ""}`
        + `${weakChart["Fighting"] != 1 ? `\n**Fighting**: ${weakChart["Fighting"]}`: ""}`
        + `${weakChart["Fire"] != 1 ? `\n**Fire**: ${weakChart["Fire"]}`: ""}`
        + `${weakChart["Flying"] != 1 ? `\n**Flying**: ${weakChart["Flying"]}`: ""}`
        + `${weakChart["Ghost"] != 1 ? `\n**Ghost**: ${weakChart["Ghost"]}`: ""}`
        + `${weakChart["Grass"] != 1 ? `\n**Grass**: ${weakChart["Grass"]}`: ""}`
        + `${weakChart["Ground"] != 1 ? `\n**Ground**: ${weakChart["Ground"]}`: ""}`
        + `${weakChart["Ice"] != 1 ? `\n**Ice**: ${weakChart["Ice"]}`: ""}`
        + `${weakChart["Normal"] != 1 ? `\n**Normal**: ${weakChart["Normal"]}`: ""}`
        + `${weakChart["Poison"] != 1 ? `\n**Poison**: ${weakChart["Poison"]}`: ""}`
        + `${weakChart["Psychic"] != 1 ? `\n**Psychic**: ${weakChart["Psychic"]}`: ""}`
        + `${weakChart["Rock"] != 1 ? `\n**Rock**: ${weakChart["Rock"]}`: ""}`
        + `${weakChart["Steel"] != 1 ? `\n**Steel**: ${weakChart["Steel"]}`: ""}`
        + `${weakChart["Water"] != 1 ? `\n**Water**: ${weakChart["Water"]}`: ""}`)
        .addField(`Misc`, stripIndents`**Height (M):** ${pokemon.heightm}
        **Weight (KG):** ${pokemon.weightkg}
        **Color:** ${pokemon.color}`)
    }
    generateItemEmbed(item, parser) {
        return new MessageEmbed()
        .setDescription(`${item.desc}`)
        .setAuthor(item.name)
        .setColor(config.embedColor)
        .setThumbnail(`https://www.serebii.net/itemdex/sprites/pgl/${item.id}.png`)
        .setTimestamp();
    }
    generateMoveEmbed(move, parser) {
        let details = {
            "Priority": move.priority,
            "Gen": move.gen || 'CAP',
        };

        if (move.secondary || move.secondaries) details["Secondary effect"] = "";
        if (move.flags['contact']) details["Contact"] = "";
        if (move.flags['sound']) details["Sound"] = "";
        if (move.flags['bullet']) details["Bullet"] = "";
        if (move.flags['pulse']) details["Pulse"] = "";
        if (!move.flags['protect'] && !/(ally|self)/i.test(move.target)) details["Bypasses Protect"] = "";
        if (move.flags['authentic']) details["Bypasses Substitutes"] = "";
        if (move.flags['defrost']) details["Thaws user"] = "";
        if (move.flags['bite']) details["Bite"] = "";
        if (move.flags['punch']) details["Punch"] = "";
        if (move.flags['powder']) details["Powder"] = "";
        if (move.flags['reflectable']) details["Bounceable"] = "";
        if (move.flags['gravity']) details["Suppressed by Gravity"] = "";

        if (move.zMovePower) {
            details["Z-Power"] = move.zMovePower;
        } else if (move.zMoveEffect) {
            details["Z-Effect"] = {
                'clearnegativeboost': "Restores negative stat stages to 0",
                'crit2': "Crit ratio +2",
                'heal': "Restores HP 100%",
                'curse': "Restores HP 100% if user is Ghost type, otherwise Attack +1",
                'redirect': "Redirects opposing attacks to user",
                'healreplacement': "Restores replacement's HP 100%",
            }[move.zMoveEffect];
        } else if (move.zMoveBoost) {
            details["Z-Effect"] = "";
            let boost = move.zMoveBoost;
            let stats = {atk: 'Attack', def: 'Defense', spa: 'Sp. Atk', spd: 'Sp. Def', spe: 'Speed', accuracy: 'Accuracy', evasion: 'Evasiveness'};
            for (let i in boost) {
                details["Z-Effect"] += " " + stats[i] + " +" + boost[i];
            }
        } else {
            details["Z-Effect"] = "None";
        }

        details["Target"] = {
            'normal': "One Adjacent Pokmon",
            'self': "User",
            'adjacentAlly': "One Ally",
            'adjacentAllyOrSelf': "User or Ally",
            'adjacentFoe': "One Adjacent Opposing Pokmon",
            'allAdjacentFoes': "All Adjacent Opponents",
            'foeSide': "Opposing Side",
            'allySide': "User's Side",
            'allyTeam': "User's Side",
            'allAdjacent': "All Adjacent Pokmon",
            'any': "Any Pokmon",
            'all': "All Pokmon",
        }[move.target] || "Unknown";

        if (move.id === 'mirrormove') {
            details['https://pokemonshowdown.com/dex/moves/mirrormove'] = '';
        }

        return new MessageEmbed()
        .setAuthor(`${move.name}`)
        .setColor(config.embedColor)
        .setDescription(stripIndents`
        ${move.desc}`)
        .setTimestamp()
        .addField(`Info`, stripIndents`
        **Type:** ${move.type}
        **Category:** ${move.category}
        **Target:** ${details["Target"]}
        **${details.hasOwnProperty("Z-Effect") ? `Z-Effect:** ${details["Z-Effect"]}` : `Z-Power:** ${details["Z-Power"]}`}`
        + `${details.hasOwnProperty("Contact") ? `${details["Contact"]}\n` : ""}`
        + `${details.hasOwnProperty("Sound") ? `${details["Sound"]}\n` : ""}`
        + `${details.hasOwnProperty("Bullet") ? `${details["Bullet"]}\n` : ""}`
        + `${details.hasOwnProperty("Pulse") ? `${details["Pulse"]}\n` : ""}`
        + `${details.hasOwnProperty("Bypasses Protect") ? `${details["Bypasses Protect"]}\n` : ""}`
        + `${details.hasOwnProperty("Bypasses Substitutes") ? `${details["Bypasses Substitutes"]}\n` : ""}`
        + `${details.hasOwnProperty("Thaws user") ? `${details["Thaws user"]}\n` : ""}`
        + `${details.hasOwnProperty("Bite") ? `${details["Bite"]}\n` : ""}`
        + `${details.hasOwnProperty("Punch") ? `${details["Punch"]}\n` : ""}`
        + `${details.hasOwnProperty("Powder") ? `${details["Powder"]}\n` : ""}`
        + `${details.hasOwnProperty("Bounceable") ? `${details["Bounceable"]}\n` : ""}`
        + `${details.hasOwnProperty("Suppressed by Gravity") ? `${details["Suppressed by Gravity"]}\n` : ""}
        `)
    }
    generateWeakEmbed(weakChart, full) {
        if (full) {
            return new MessageEmbed()
            .setDescription(stripIndents`
            \n*Damage multiplyers for ${weakChart.pokemon}*
            **Bug**: ${weakChart["Bug"]}
            **Dark**: ${weakChart["Dark"]}
            **Dragon**: ${weakChart["Dragon"]}
            **Electric**: ${weakChart["Electric"]}
            **Fairy**: ${weakChart["Fairy"]}<commit_msg>Add basePower to move<commit_after>'use strict'

const { MessageEmbed } = require('discord.js');
const Matcher = require('did-you-mean');
const stripIndents = require('common-tags').stripIndents;
const config = require('config.json')('./config.json');

const abilities = require("../data/abilities.js");
const aliases = require("../data/aliases.js");
const items = require("../data/items.js");
const learnsets = require("../data/learnsets.js");
const moves = require("../data/moves.js");
const pokedex = require("../data/pokedex.js");
const typechart = require("../data/typechart.js");

class EmbedGenerator {
    constructor(parser) {
        this.parser = parser;
    }

    quick(title, text) {
        return new MessageEmbed()
        .setDescription(text)
        .setTitle(title)
        .setColor(config.embedColor)
        .setTimestamp();
    }

    generateAbilityEmbed(ability, parser) {
        return new MessageEmbed()
        .setDescription(`${ability.desc}`)
        .setAuthor(ability.name)
        .setColor(config.embedColor)
        .setTimestamp();
    }
    generatePokemonEmbed(pokemon, parser) {
        let weakChart = parser.weak(pokemon);

        return new MessageEmbed()
        .setAuthor(`${pokemon.num.toString()} - ${pokemon.species}`)
        .setColor(config.embedColor)
        .setDescription(stripIndents`
        **HP:** ${pokemon.baseStats.hp}
        **Atk:** ${pokemon.baseStats.atk}
        **Def:** ${pokemon.baseStats.def}
        **SpA:** ${pokemon.baseStats.spa}
        **SpD:** ${pokemon.baseStats.spd}
        **Spe:** ${pokemon.baseStats.spe}
        **BST:** ${Object.values(pokemon.baseStats).reduce((a, b) => a + b, 0)}`)
        .setThumbnail(`http://play.pokemonshowdown.com/sprites/xyani/${pokemon.species.toLowerCase().replace(" ", "")}.gif`)
        .setTimestamp()
        .addField(`Types`, `${pokemon.types.join(", ")}`)
        .addField(`Abilities`, `${Object.values(pokemon.abilities).join(", ")}`)
        .addField(`Weakness & Resistance`, stripIndents`
        *1x values are ommited use \`weak ${weakChart.pokemon} true\` to show.*`
        + `${weakChart["Bug"] != 1 ? `\n**Bug**: ${weakChart["Bug"]}`: ""}`
        + `${weakChart["Dark"] != 1 ? `\n**Dark**: ${weakChart["Dark"]}`: ""}`
        + `${weakChart["Dragon"] != 1 ? `\n**Dragon**: ${weakChart["Dragon"]}`: ""}`
        + `${weakChart["Electric"] != 1 ? `\n**Electric**: ${weakChart["Electric"]}`: ""}`
        + `${weakChart["Fairy"] != 1 ? `\n**Fairy**: ${weakChart["Fairy"]}`: ""}`
        + `${weakChart["Fighting"] != 1 ? `\n**Fighting**: ${weakChart["Fighting"]}`: ""}`
        + `${weakChart["Fire"] != 1 ? `\n**Fire**: ${weakChart["Fire"]}`: ""}`
        + `${weakChart["Flying"] != 1 ? `\n**Flying**: ${weakChart["Flying"]}`: ""}`
        + `${weakChart["Ghost"] != 1 ? `\n**Ghost**: ${weakChart["Ghost"]}`: ""}`
        + `${weakChart["Grass"] != 1 ? `\n**Grass**: ${weakChart["Grass"]}`: ""}`
        + `${weakChart["Ground"] != 1 ? `\n**Ground**: ${weakChart["Ground"]}`: ""}`
        + `${weakChart["Ice"] != 1 ? `\n**Ice**: ${weakChart["Ice"]}`: ""}`
        + `${weakChart["Normal"] != 1 ? `\n**Normal**: ${weakChart["Normal"]}`: ""}`
        + `${weakChart["Poison"] != 1 ? `\n**Poison**: ${weakChart["Poison"]}`: ""}`
        + `${weakChart["Psychic"] != 1 ? `\n**Psychic**: ${weakChart["Psychic"]}`: ""}`
        + `${weakChart["Rock"] != 1 ? `\n**Rock**: ${weakChart["Rock"]}`: ""}`
        + `${weakChart["Steel"] != 1 ? `\n**Steel**: ${weakChart["Steel"]}`: ""}`
        + `${weakChart["Water"] != 1 ? `\n**Water**: ${weakChart["Water"]}`: ""}`)
        .addField(`Misc`, stripIndents`**Height (M):** ${pokemon.heightm}
        **Weight (KG):** ${pokemon.weightkg}
        **Color:** ${pokemon.color}`)
    }
    generateItemEmbed(item, parser) {
        return new MessageEmbed()
        .setDescription(`${item.desc}`)
        .setAuthor(item.name)
        .setColor(config.embedColor)
        .setThumbnail(`https://www.serebii.net/itemdex/sprites/pgl/${item.id}.png`)
        .setTimestamp();
    }
    generateMoveEmbed(move, parser) {
        let details = {
            "Priority": move.priority,
            "Gen": move.gen || 'CAP',
        };

        if (move.secondary || move.secondaries) details["Secondary effect"] = "";
        if (move.flags['contact']) details["Contact"] = "";
        if (move.flags['sound']) details["Sound"] = "";
        if (move.flags['bullet']) details["Bullet"] = "";
        if (move.flags['pulse']) details["Pulse"] = "";
        if (!move.flags['protect'] && !/(ally|self)/i.test(move.target)) details["Bypasses Protect"] = "";
        if (move.flags['authentic']) details["Bypasses Substitutes"] = "";
        if (move.flags['defrost']) details["Thaws user"] = "";
        if (move.flags['bite']) details["Bite"] = "";
        if (move.flags['punch']) details["Punch"] = "";
        if (move.flags['powder']) details["Powder"] = "";
        if (move.flags['reflectable']) details["Bounceable"] = "";
        if (move.flags['gravity']) details["Suppressed by Gravity"] = "";

        if (move.zMovePower) {
            details["Z-Power"] = move.zMovePower;
        } else if (move.zMoveEffect) {
            details["Z-Effect"] = {
                'clearnegativeboost': "Restores negative stat stages to 0",
                'crit2': "Crit ratio +2",
                'heal': "Restores HP 100%",
                'curse': "Restores HP 100% if user is Ghost type, otherwise Attack +1",
                'redirect': "Redirects opposing attacks to user",
                'healreplacement': "Restores replacement's HP 100%",
            }[move.zMoveEffect];
        } else if (move.zMoveBoost) {
            details["Z-Effect"] = "";
            let boost = move.zMoveBoost;
            let stats = {atk: 'Attack', def: 'Defense', spa: 'Sp. Atk', spd: 'Sp. Def', spe: 'Speed', accuracy: 'Accuracy', evasion: 'Evasiveness'};
            for (let i in boost) {
                details["Z-Effect"] += " " + stats[i] + " +" + boost[i];
            }
        } else {
            details["Z-Effect"] = "None";
        }

        details["Target"] = {
            'normal': "One Adjacent Pokmon",
            'self': "User",
            'adjacentAlly': "One Ally",
            'adjacentAllyOrSelf': "User or Ally",
            'adjacentFoe': "One Adjacent Opposing Pokmon",
            'allAdjacentFoes': "All Adjacent Opponents",
            'foeSide': "Opposing Side",
            'allySide': "User's Side",
            'allyTeam': "User's Side",
            'allAdjacent': "All Adjacent Pokmon",
            'any': "Any Pokmon",
            'all': "All Pokmon",
        }[move.target] || "Unknown";

        if (move.id === 'mirrormove') {
            details['https://pokemonshowdown.com/dex/moves/mirrormove'] = '';
        }

        return new MessageEmbed()
        .setAuthor(`${move.name}`)
        .setColor(config.embedColor)
        .setDescription(stripIndents`
        ${move.desc}`)
        .setTimestamp()
        .addField(`Info`, stripIndents`
        **Type:** ${move.type}
        **Category:** ${move.category}
        **Base Power:** ${move.hasOwnProperty('basePower') ? move.basePower : 'N/A'}
        **Target:** ${details["Target"]}
        **${details.hasOwnProperty("Z-Effect") ? `Z-Effect:** ${details["Z-Effect"]}` : `Z-Power:** ${details["Z-Power"]}`}`
        + `${details.hasOwnProperty("Contact") ? `${details["Contact"]}\n` : ""}`
        + `${details.hasOwnProperty("Sound") ? `${details["Sound"]}\n` : ""}`
        + `${details.hasOwnProperty("Bullet") ? `${details["Bullet"]}\n` : ""}`
        + `${details.hasOwnProperty("Pulse") ? `${details["Pulse"]}\n` : ""}`
        + `${details.hasOwnProperty("Bypasses Protect") ? `${details["Bypasses Protect"]}\n` : ""}`
        + `${details.hasOwnProperty("Bypasses Substitutes") ? `${details["Bypasses Substitutes"]}\n` : ""}`
        + `${details.hasOwnProperty("Thaws user") ? `${details["Thaws user"]}\n` : ""}`
        + `${details.hasOwnProperty("Bite") ? `${details["Bite"]}\n` : ""}`
        + `${details.hasOwnProperty("Punch") ? `${details["Punch"]}\n` : ""}`
        + `${details.hasOwnProperty("Powder") ? `${details["Powder"]}\n` : ""}`
        + `${details.hasOwnProperty("Bounceable") ? `${details["Bounceable"]}\n` : ""}`
        + `${details.hasOwnProperty("Suppressed by Gravity") ? `${details["Suppressed by Gravity"]}\n` : ""}
        `)
    }
    generateWeakEmbed(weakChart, full) {
        if (full) {
            return new MessageEmbed()
            .setDescription(stripIndents`
            \n*Damage multiplyers for ${weakChart.pokemon}*
            **Bug**: ${weakChart["Bug"]}
            **Dark**: ${weakChart["Dark"]}
            **Dragon**: ${weakChart["Dragon"]}
            **Electric**: ${weakChart["Electric"]}
            **Fairy**: ${weakChart["Fairy"]}
{'fraction_non_alphanumeric': 0.2303240083981161, 'fraction_numerical': 0.003745105827611644, 'mean_word_length': 2.7852233676975944, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3358037', 'n_tokens_mistral': 5757, 'n_tokens_neox': 5706, 'n_words': 933}