Esempio n. 1
0
    def enter_capture_module(self):

        #Randomize a pokemon object from pokemon_meta table:
        pokemon = database.get_pokemon()
        self.encounter_pokemon(pokemon)
        while (len(self.encountering_pokemon) > 0):
            self.invoke_capture_menu()
Esempio n. 2
0
async def get_pokedex(ctx, author, pkmn_id):
    color = _get_tier_color(int(pkmn_id))
    embed = Embed(color=color, description="**{}**'s Pokedex".format(author))

    if database.is_caught(author, pkmn_id):
        pkmn = database.get_pokemon(pkmn_id)
        pkmn_id = pkmn["national_id"]
        pkmn_name = pkmn["name"]
        pkmn_name_stripped = pkmn_name.lower().split("-")[0]

        types = _get_types_string(pkmn["types"])

        # description = database.get_random_description(pkmn["descriptions"])
        description = "None"

        embed.add_field(name='Name', value="{} [{}]".format(pkmn_name, pkmn_id))
        embed.add_field(name="Types", value=types, inline=True)
        embed.add_field(name='Description', value=description, inline=False)
        embed.add_field(name='Hp', value=pkmn["hp"], inline=True)
        embed.add_field(name='Attack', value=pkmn["attack"], inline=True)
        embed.add_field(name='Defense', value=pkmn["defense"], inline=True)
        embed.add_field(name='Speed', value=pkmn["speed"], inline=True)
        embed.set_image(url="http://www.pkparaiso.com/imagenes/xy/sprites/animados/{}.gif".format(pkmn_name_stripped))
        embed.set_thumbnail(url="http://marktan.us/pokemon/img/icons/{}.png".format(pkmn_id))
        return await ctx.send(embed=embed)
    else:
        return await ctx.send("Oak: You can't see what you don't have.")
Esempio n. 3
0
def get_pokemon(name):
    conn = sqlite3.connect(db)
    result = None
    if (conn is not None):
        result = database.get_pokemon(conn, name)
        conn.close()
        return result
Esempio n. 4
0
def _attack(pkmn1, pkmn2) -> int:
    """
    pkmn1 attacks pkmn2
    :return: Return pkmn2's health after the battle
    """
    pkmn1_obj = database.get_pokemon(pkmn1["national_id"])
    pkmn2_obj = database.get_pokemon(pkmn2["national_id"])

    eff = _get_effectiveness(pkmn1_obj["types"], pkmn2_obj["types"])
    r = random.uniform(0.8, 1.2)
    power = (pkmn1["attack"] + pkmn1["sp_atk"])/2 * eff * 30
    power /= (pkmn2["defense"] + pkmn2["sp_def"])/2
    # print("effectiveness: %s rand: %s power: %d" % (eff, r, power))
    pkmn2["health"] -= power

    if pkmn2["health"] <= 0:
        return 0
    return pkmn2["health"]