0% found this document useful (0 votes)
22 views3 pages

Source Code

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Source Code

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import random

print("Welcome to the Pokemon Battle Game!")

player_name = input("What's your name, Trainer? : ")

print()

print(f"Nice to meet you, {player_name}! Now, choose your Pokemon.")

pokemon_name = input("What will you name your Pokemon? ")

player_pokemon = {

"name": pokemon_name,

"hp": 100,

"attack": 20,

"heal": 15

wild_pokemons = ["Charmander", "Bulbasaur", "Squirtle"]

wild_pokemon_name = [Link](wild_pokemons)

wild_pokemon = {

"name": wild_pokemon_name,

"hp": 100,

"attack": 15

}
print()

print(f"A wild {wild_pokemon_name} appeared!")

while player_pokemon["hp"] > 0 and wild_pokemon["hp"] > 0:

print(f"{pokemon_name}'s HP: {player_pokemon['hp']}")

print(f"{wild_pokemon_name}'s HP: {wild_pokemon['hp']}")

action = input("Do you want to 'attack' or 'heal'? ").strip().lower()

print()

if action == "attack":

damage = [Link](10, player_pokemon["attack"])

wild_pokemon["hp"] -= damage

print(f"{pokemon_name} attacked {wild_pokemon_name} for {damage} damage!")

elif action == "heal":

heal_amount = [Link](5, player_pokemon["heal"])

player_pokemon["hp"] += heal_amount

print(f"{pokemon_name} healed for {heal_amount} HP!")

else:

print("Invalid action. Please type 'attack' or 'heal'.")

continue
if wild_pokemon["hp"] <= 0:

print(f"{wild_pokemon_name} fainted! {pokemon_name} wins the battle!")

break

damage = [Link](5, wild_pokemon["attack"])

player_pokemon["hp"] -= damage

print(f"{wild_pokemon_name} attacked {pokemon_name} for {damage} damage!")

if player_pokemon["hp"] <= 0:

print(f"{pokemon_name} fainted! {wild_pokemon_name} wins the battle. Better luck


next time, {player_name}!")

break

print()

print("The battle is over! Thank you for playing!")

You might also like