示例#1
0
        def Pokemon2_turn():

            while (self.bars > 0) and (Pokemon2.bars > 0):
                print(f"\nGo {Pokemon2.name}!")
                for i, x in enumerate(Pokemon2.moves):
                    print(f"{i+1}.", x)
                while True:
                    try:
                        index = int(input("Pick a move: "))
                    except ValueError:
                        print("Invalid move, try again.")
                        continue
                    break
                printf(f"{Pokemon2.name} used {Pokemon2.moves[index-1]}!")
                time.sleep(1)
                printf(string_2_attack)

                # Determine damage
                self.bars -= Pokemon2.attack
                self.health = ""

                # Add back bars plus give a defense boost
                for _ in range(int(self.bars + 0.1 * self.defense)):
                    self.health += "="
                time.sleep(1)
                print(
                    f"{self.name}\t\tHLTH ({self.health.count('=')}) \t{self.health}"
                )

                print(
                    f"{Pokemon2.name}\t\tHLTH ({Pokemon2.health.count('=')}) \t{Pokemon2.health}\n"
                )
                global loop
                global turn
                loop = True
                turn = 0
                time.sleep(0.5)

                # Check if the pokemon has fainted
                if self.bars <= 0:
                    printf("\n..." + self.name + " fainted")
                    turn = 10
                    money = np.random.choice(5000)
                    printf(f"Opponent paid you {money}.")
                    break
                else:
                    os.system("clear")
                    print(
                        f"{self.name}\t\tHLTH ({self.health.count('=')}) \t{self.health}"
                    )
                    print(
                        f"{Pokemon2.name}\t\tHLTH ({Pokemon2.health.count('=')}) \t{Pokemon2.health}\n"
                    )
                    Pokemon1_turn()
示例#2
0
        def Pokemon1_turn():
            while (self.bars > 0) and (Pokemon2.bars > 0):
                # Print the health of each pokemon
                if loop == False:
                    print(
                        f"{self.name}\t\tHLTH ({self.health.count('=')}) \t{self.health}"
                    )
                    print(
                        f"{Pokemon2.name}\t\tHLTH ({Pokemon2.health.count('=')}) \t{Pokemon2.health}\n"
                    )

                print(f"Go {self.name}!")
                for i, x in enumerate(self.moves):
                    print(f"{i+1}.", x)
                while True:
                    try:
                        index = int(input("Pick a move: "))
                    except ValueError:
                        print("Invalid move, try again.")
                        continue
                    if index > 4:
                        print("Invalid number, try again.")
                        continue
                    break
                printf(f"{self.name} used {self.moves[index-1]}!")
                time.sleep(1)
                printf(string_1_attack)

                # Determine damage
                Pokemon2.bars -= self.attack
                Pokemon2.health = ""

                # Add back bars plus give a defense boost
                for _ in range(int(Pokemon2.bars + 0.1 * Pokemon2.defense)):
                    Pokemon2.health += "="
                time.sleep(1)
                global turn
                turn = 1
                time.sleep(0.5)

                # Check if the pokemon has fainted
                if Pokemon2.bars <= 0:
                    printf(f"\n... {Pokemon2.name} fainted")
                    turn = 10
                    break
                else:
                    os.system("clear")
                    print(
                        f"{self.name}\t\tHLTH ({self.health.count('=')}) \t{self.health}"
                    )
                    print(
                        f"{Pokemon2.name}\t\tHLTH ({Pokemon2.health.count('=')}) \t{Pokemon2.health}\n"
                    )
                    break
示例#3
0
        def Wild_Pokemon_Turn():

            while (self.bars > 0) and (Pokemon2.bars > 0):
                index = random.randrange(1, 5)
                printf(f"{Pokemon2.name} turn!")
                input("\nPress ENTER to continue...")
                printf(f"\n{Pokemon2.name} used {Pokemon2.moves[index-1]}!")
                time.sleep(1)
                printf(string_2_attack)

                # Determine damage
                self.bars -= Pokemon2.attack
                self.health = ""

                # Add back bars plus give a defense boost
                for _ in range(int(self.bars + 0.1 * self.defense)):
                    self.health += "="
                time.sleep(1)
                global loop
                global turn
                loop = True
                turn = 0
                time.sleep(0.5)

                # Check if the pokemon has fainted
                if self.bars <= 0:
                    printf("\n..." + self.name + " fainted")
                    turn = 10
                    break
                else:
                    os.system("clear")
                    print(
                        f"{self.name}\t\tHLTH ({self.health.count('=')}) \t{self.health}"
                    )
                    print(
                        f"{Pokemon2.name}\t\tHLTH ({Pokemon2.health.count('=')}) \t{Pokemon2.health}\n"
                    )
                    Player_turn()