commiting changes

This commit is contained in:
Andreas Zweili 2015-07-14 23:12:32 +02:00
parent 99d625ea06
commit 17e3432c35
2 changed files with 30 additions and 11 deletions

View File

@ -55,19 +55,36 @@ def beginning():
# A function which changes the status of the pet depending of the age value. # A function which changes the status of the pet depending of the age value.
# Each status has it's own characteristics. # Each status has it's own characteristics.
def set_youngling_stats():
pet_variables.max_health = 10
pet_variables.max_happiness = 8
pet_variables.max_hunger = 7
def set_adult_stats():
pet_variables.max_health = 10
pet_variables.max_happiness = 8
pet_variables.max_hunger = 7
def set_elderly_stats():
pet_variables.max_health = 7
pet_variables.max_happiness = 5
pet_variables.max_hunger = 10
def reset_stats():
pet_variables.pet_health = pet_variables.max_health
pet_variables.pet_happiness = pet_variables.max_happiness
pet_variables.pet_hunger = pet_variables.max_hunger
def aging(): def aging():
if pet_variables.pet_age == 5: if pet_variables.pet_age == 5:
pet_variables.pet_status = "adult" pet_variables.pet_status = "adult"
pet_variables.max_health = 10 set_adult_stats()
pet_variables.max_happiness = 8
pet_variables.max_hunger = 7
print("Congratulation your pet has become an adult. It needs less food now") print("Congratulation your pet has become an adult. It needs less food now")
print("and it's health has improved however it's grumpier than a youngling.") print("and it's health has improved however it's grumpier than a youngling.")
elif pet_variables.pet_age == 15: elif pet_variables.pet_age == 15:
pet_variables.pet_status = "elderly" pet_variables.pet_status = "elderly"
pet_variables.max_health = 7 set_elderly_stats()
pet_variables.max_happiness = 5
pet_variables.max_hunger = 10
print("Congratulation your pet has become an elderly it needs now less food.") print("Congratulation your pet has become an elderly it needs now less food.")
print("However it's health is worse and it's grumpier than an adult.") print("However it's health is worse and it's grumpier than an adult.")
@ -75,7 +92,8 @@ def aging():
### Functions to increase and decrease stats ### ### Functions to increase and decrease stats ###
def increase_hunger(): def increase_hunger():
pet_variables.pet_hunger = pet_variables.pet_hunger + 1 if pet_variables.pet_hunger < pet_variables.max_hunger:
pet_variables.pet_hunger = pet_variables.pet_hunger + 1
def increase_poke_count(): def increase_poke_count():
@ -117,7 +135,6 @@ def decrease_stats():
while True: while True:
time.sleep(pet_variables.day) time.sleep(pet_variables.day)
decrease_hunger() decrease_hunger()
decrease_poke_count()
if pet_variables.pet_hunger <= 0: if pet_variables.pet_hunger <= 0:
decrease_health() decrease_health()
decrease_happiness() decrease_happiness()
@ -168,7 +185,7 @@ def playing():
# if you poke it more than 3 times it will get angry at you # if you poke it more than 3 times it will get angry at you
def poking(): def poking():
os.system('clear') os.system('clear')
if pet_variables.poke_count < 4: if pet_variables.poke_count < 3:
print("You poke " + pet_variables.pet_name + " and it starts to speak.") print("You poke " + pet_variables.pet_name + " and it starts to speak.")
increase_poke_count() increase_poke_count()
mixer.init() mixer.init()
@ -188,8 +205,10 @@ def poking():
def sleeping(): def sleeping():
os.system('clear') os.system('clear')
print("Your pet is sleeping now.") print("Your pet is sleeping now.")
time.sleep(10)
if pet_variables.max_hunger / pet_variables.pet_hunger > 0.5: if pet_variables.max_hunger / pet_variables.pet_hunger > 0.5:
print("Sleeping works") reset_stats()
print("Your pet woke up feeling rested and in a good mood.")
else: else:
print("Something is broken") print("Your pet has woken up.")
time.sleep(3) time.sleep(3)