from PIL import Image
import random

class Pokemon:
    def __init__(self, attack_choice, power):
        self.__attack_choice = attack_choice
        self.power = power

    def attack(self):
        if self.__attack_choice == 1:
            attack_points = random.randint(18, 25)
            return attack_points
        elif self.__attack_choice == 2:
            attack_points = random.randint(10, 35)
            return attack_points
        else:
            print("That is not a valid selection. You lost your turn!")

    def heal(self):
        heal_points = random.randint(18, 25)
        return heal_points

pokemon_choices = [
    {"name": "Pikachu", "power": 30},
    {"name": "Charizard", "power": 40},
    {"name": "Venusaur", "power": 30},
    {"name": "Blastoise", "power": 50},
    {"name": "Snorlax", "power": 25},
]

battle_arena_image = Image.open("/home/jared/vscode/JaredsBlog/images/battle_arena.jpeg")

def display_images(user_pokemon, mew_pokemon):
    battle_arena_image.show()  # Display the battle arena image
    user_pokemon_image = Image.open("/home/jared/vscode/JaredsBlog/images/" + user_pokemon['name'] + ".jpeg")
    mew_pokemon_image = Image.open("/home/jared/vscode/JaredsBlog/images/" + mew_pokemon['name'] + ".jpeg")


    user_pokemon_image.show()  # Display user's Pokémon image
    mew_pokemon_image.show()   # Display Mew's Pokémon image

print("Choose your Pokémon:")
for i, choice in enumerate(pokemon_choices, start=1):
    print(f"{i}. {choice['name']} (Power: {choice['power']})")

pokemon_choice = int(input("Enter the number of your chosen Pokémon: "))

if 1 <= pokemon_choice <= len(pokemon_choices):
    chosen_pokemon = pokemon_choices[pokemon_choice - 1]
    print(f"You chose {chosen_pokemon['name']} as your Pokémon with a power of {chosen_pokemon['power']}.")
else:
    print("Invalid choice. You lost your turn!")

user_health = 100
mew_health = 100
battle_continue = True

mew_choice = random.randint(1, 3)
mew_pokemon = pokemon_choices[mew_choice - 1]

print(f"\nMew chose {mew_pokemon['name']} as its Pokémon with a power of {mew_pokemon['power']}.")

print("Get ready for the battle!\n")

display_images(chosen_pokemon, mew_pokemon)

while battle_continue:
    print("Your current health: " + str(user_health) + " HP")
    print("Mew's current health: " + str(mew_health) + " HP\n")

    print("\nATTACK CHOICES")
    print("1. Close range attack")
    print("2. Far range attack")
    print("3. Heal")
    attack_choice = eval(input("\nSelect an attack: "))

    mew = Pokemon(mew_choice, mew_pokemon['power'])  # Set Mew's power
    user_pokemon = Pokemon(attack_choice, chosen_pokemon['power'])  # Set user's Pokémon's power

    if attack_choice == 1 or attack_choice == 2:
        damage_to_mew = user_pokemon.attack()
        heal_self = 0
        print(f"You dealt {damage_to_mew} damage.")

    if mew_choice == 1 or mew_choice == 2:
        damage_to_user = mew.attack()
        heal_mew = 0
        print(f"Mew dealt {damage_to_user} damage.")

    if attack_choice == 3:
        heal_self = user_pokemon.heal()
        damage_to_mew = 0
        print(f"You healed {heal_self} health points.")

    if mew_choice == 3:
        heal_mew = mew.heal()
        damage_to_user = 0
        print(f"Mew healed {heal_mew} health points.")

    user_health = user_health - damage_to_user + heal_self
    mew_health = mew_health - damage_to_mew + heal_mew

    if user_health <= 0 and mew_health <= 0:
        battle_continue = False
        print("It's a draw!")

    if user_health > 100:
        user_health = 100
    elif user_health <= 0:
        user_health = 0
        battle_continue = False

    if mew_health > 100:
        mew_health = 100
    elif mew_health <= 0:
        mew_health = 0
        battle_continue = False1
Choose your Pokémon:
1. Pikachu (Power: 30)
2. Charizard (Power: 40)
3. Venusaur (Power: 30)
4. Blastoise (Power: 50)
5. Snorlax (Power: 25)


You chose Blastoise as your Pokémon with a power of 50.

Mew chose Charizard as its Pokémon with a power of 40.
Get ready for the battle!

png

png

png

Your current health: 100 HP
Mew's current health: 100 HP


ATTACK CHOICES
1. Close range attack
2. Far range attack
3. Heal
You dealt 20 damage.
Mew dealt 33 damage.
Your current health: 67 HP
Mew's current health: 80 HP


ATTACK CHOICES
1. Close range attack
2. Far range attack
3. Heal
You dealt 18 damage.
Mew dealt 34 damage.
Your current health: 33 HP
Mew's current health: 62 HP


ATTACK CHOICES
1. Close range attack
2. Far range attack
3. Heal
You dealt 18 damage.
Mew dealt 19 damage.
Your current health: 14 HP
Mew's current health: 44 HP


ATTACK CHOICES
1. Close range attack
2. Far range attack
3. Heal
Mew dealt 29 damage.
You healed 20 health points.
Your current health: 5 HP
Mew's current health: 44 HP


ATTACK CHOICES
1. Close range attack
2. Far range attack
3. Heal
Mew dealt 33 damage.
You healed 18 health points.