+/IBCS
git clone https://git.julia.blue/+/IBCS
88eb4b6
master
1import random 2import msvcrt 3import os 4import colorama 5 6 7colorama .init () 8 9WHITE = "\033[1;37m" 10RED = "\033[0;31m" 11GREEN = "\033[0;32m" 12 13 14class Pokemon : 15def __init__ (self ): 16self .health = 100 17self .hunger = 50 18self .wins = 0 19self .losses = 0 20self .sleep = 0 21 22def __str__ (self ): 23return ((WHITE if self .health > 10 else RED )+ "Hp: " + str (self .health )+ (WHITE if self .hunger > 20 else RED )+ "\nHunger: " + str (self .hunger )+ (WHITE if self .sleep < 5 else RED )+ "\nTiredness: " + str (self .sleep )+ (WHITE if self .losses < 9 else RED )+ "\nLosses: " + str (self .losses )+ WHITE + "\nWins: " + str (self .wins )) 24 25def battle (self ): 26if random .random ()< .5 : 27self .wins += 1 28self .health += 10 29self .hunger -= 10 30"you won the fight!" 31else : 32self .losses += 1 33self .health -= 10 34self .hunger -= 10 35self .sleep += 1 36"you lost the fight!" 37 38def rest (self ): 39self .sleep = 0 40self .health += 10 41self .hunger -= 10 42"zzzzzzzzzzzz" 43 44def eat (self ): 45if random .random ()< .5 : 46self .hunger += 15 47"you ate rations" 48else : 49if random .random ()< .5 : 50self .health += 10 51self .hunger += 10 52"you ate yummy food" 53else : 54self .health -= 10 55"you ate rotten food" 56 57 58gameOver = False 59pikachu = Pokemon () 60choice = "" 61while (not gameOver ): 62pikachu 63"Do you want to: [E]at, [S]leep, or [F]ight" 64choice = msvcrt .getch () 65os .system ("cls" ) 66if choice in "eE" : 67pikachu .eat () 68elif choice in "sS" : 69pikachu .rest () 70else : 71pikachu .battle () 72pikachu .health = min (pikachu .health ,100 ) 73if pikachu .sleep >= 5 : 74pikachu .health -= 10 75pikachu .sleep += 1 76if pikachu .wins == 10 : 77GREEN ,"YOU WIN (10 fights won)" 78gameOver = True 79elif pikachu .losses == 10 : 80RED ,"YOU DIE (10 fights lost)" 81gameOver = True 82elif pikachu .hunger <= 0 or pikachu .hunger >= 100 : 83RED ,"YOU DIE (hunger)" 84gameOver = True 85elif pikachu .health <= 0 : 86RED ,"YOU DIE (hp)" 87gameOver = True