示例#1
0
async def start(ctx):
    player = Player(ctx.message.author.id)

    if player.has_player_started():
        embed = discord.Embed(
            description="You have already chosen a starter pokemon.",
            colour=0xff0000)
        embed.set_author(name=(await get_name(ctx.message.author)),
                         icon_url=ctx.message.author.avatar_url)

        await bot.send_message(ctx.message.channel, embed=embed)
        return True

    description = "Pokemon Trainee " + await get_name(ctx.message.author
                                                      ) + ", \n\n"
    for i in range(len(PokeConfig.startingPokemon)):
        poke = Pokemon(id=int(PokeConfig.startingPokemon[i]))
        description = description + (
            str(i + 1) + ". " + ("**" + poke.get_name() + "**").title()) + "\n"
    description = description + "\nType the number of the item listed above (e.g 1) to buy the item."

    embed = discord.Embed(description=description, colour=0x00ff00)
    embed.set_author(name="Choose a starter pokemon",
                     icon_url=ctx.message.author.avatar_url)

    await bot.send_message(ctx.message.channel, embed=embed)

    msg = await bot.wait_for_message(timeout=15,
                                     author=ctx.message.author,
                                     channel=ctx.message.channel,
                                     check=pokemon_starter_predicate_check)
    if not (msg is None):
        poke = PokeConfig.startingPokemon[int(msg.content) - 1]
        poke_obj = Pokemon(id=poke)
        starting_moves = poke_obj.get_starting_moves()
        player.add_pokemon(int(poke_obj.get_id()), 1, ','.join(starting_moves),
                           10)
        player.set_player_started()

        embed = discord.Embed(
            description="Congratulations! You got yourself a lil " +
            poke_obj.get_name().title() + "! Starting Moves: " +
            ', '.join(starting_moves),
            colour=0x00ff00)
        await bot.send_message(ctx.message.channel, embed=embed)
示例#2
0
    Move('hyper-fang', 'normal', 80, 90, 2),
    Move('comet-punch', 'normal', 18, 85, 2),
    Move('pay-day', 'normal', 40, 100, 2)
]
p2 = Pokemon('pidgeot', 'normal', 'flying', m_L, 83, 80, 75, 70, 70)
m_L2 = [
    Move('slam', 'normal', 80, 75, 2),
    Move('thunder-punch', 'electric', 75, 100, 2),
    Move('thunderbolt', 'electric', 90, 100, 3),
    Move('thunder', 'electric', 110, 70, 3)
]
p1 = Pokemon('pikachu', 'electric', '', m_L2, 35, 55, 40, 50, 50)
print(p1)
print(p2)
print("Attack #1")
print("{} hp before:{}".format(p2.get_name(), p2.get_hp()))
p1.attack(Move('thunderbolt', 'electric', 90, 100, 3), p2)
print("{} hp after:{}".format(p2.get_name(), p2.get_hp()))
assert p2.get_hp() == 0
print('-' * 20)
m_L3 = [
    Move('bubble', 'water', 40, 100, 3),
    Move('rock-throw', 'rock', 50, 90, 2),
    Move('bone-club', 'ground', 65, 85, 2),
    Move('dig', 'ground', 80, 100, 2)
]
m_L4 = [
    Move('wrap', 'normal', 15, 90, 2),
    Move('horn-attack', 'normal', 65, 100, 2),
    Move('self-destruct', 'normal', 200, 100, 2),
    Move('egg-bomb', 'normal', 100, 75, 2)