From 17e3432c350f602c789f3955f16519f1cf82b8ec Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 14 Jul 2015 23:12:32 +0200 Subject: [PATCH] commiting changes --- __pycache__/pet_functions.cpython-34.pyc | Bin 5386 -> 6113 bytes pet_functions.py | 41 +++++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/__pycache__/pet_functions.cpython-34.pyc b/__pycache__/pet_functions.cpython-34.pyc index 4a96bb7f7df09adec16da486dd1291ff706bd81a..431919a929c7628b240e6578021662afdab966e3 100644 GIT binary patch delta 1767 zcmb7EO>Y}T7@o0r*K2#6b?h`GO+vSEzBVDTlQ=0Pq)nrO5E2H2P@yVBR(DAg8{3`T z04axnQgPsfGDidwhl(pGCy=O+xF9Ni14W#ApsM%)D7ca7)H&|By^Vr-o=KcS5T^OM?0GM~{_qb5z-cHai12s}e( z)laD@^^bjOBn+bUo%VKXqq*7ISP!Fm6fV=A&>~zM&wW&=%ltpa?~;9`ZcqkIKakCxnDmAJkWPa1 z^$GG)JGbJd>W*&3?KHIC)UCDR*7BN{I#FOZlF(HaVT}O_ir9y;G627B@5|(VRIK2F z%PH{gcE}s^(mWdpCKr$A870{s4I?rz**zXxhPGOZhf$`EYBJx_8B*rvQB>+E%8sK* zHIPQSCOzW4V%7}| z$!Qd&R?{n10fCtM1bz%UJ=Pj|K3Y~^iT>FH+cI(Z8k|W|h!uC6T1|Q1NHY4ntec#u zNlsCotsaQJ{5+Xb_hbQ96p!FnEhSJa&2@fmg1shs-yP(s@zixg;(-ryhy76naPUUFAQhnOz^A=v8|3y=STHN zVU%A&!hBPmDY~^o;hJoV^huav1HQo;29q@wkt!+kh;A;@Ea|(IVR)dHLhMPlMaqvg ztUGF}o#OB=jy$A7pL-W>&cEH>mTo7A+z;E0z}@b+?*#$wG?$KE6!>nv<-40Lx9)DV z+rIlg!OYFxqoC{cPzSasaz@gH&Ahb4jVaRrUH5UZxYJUH=X+HQRqU`C1RY}gomN5| z9Si~|qL;>zOVBuQ-FQ#OXX~7*_LO!nkVp0co&uZ&j05z6n}jt5mdFILHkY4~HUgMI@DXMcAkTuIV9i7Vd_xNc_@)+2 z@GUJ6Cc#g_eFS7FrKQGMHZoIMGd%%6quq%qjw2@AWQw_mV=DU}RW_yq@PU#P7uGFG z@Um6+7w00$@_L#fMX+>Qy~%W`6PaI5N@htRa}2IJne0JZ-QBUX&#F&OHztQj9d-}^ zdYIW5Hah>UWJQ&-BdXJBSFeSgUu;YU@;nD7bfBz~dC|GJP18%7R`o7BirxG&RTKqp zob9HL$fNAr@EFD>^(VQTh&{Zl^4V^ca!;zVQ}HIY{5_O4?a#Iqr&mw~Hn}|YJljD* zQ{MD8CCUK`=u$7;cI?q9e0H0i277EIJ;;R1XGn8?M@bC{yx(UgaE9lm-WlLt8VAjP)s3M08NOWnN3 zLADNZ$l0bLkEk!X)#OojKBk^GRj{f)HTAbV-tJmLK|>C$xcM%`K6R+jjZf9p!X6w} z%Z2aQrskUuVyAl1d_LF1O#BWh7<$#8=FV)K3$OKN(#ab-pI7Q!%U&GelyO`=YAFpx z2FzH{?i(;`f*b-WIo%+>EDc*PsN(U>nMrM4BVF2*`rXpm!^daI9pkFfc1yPw}Sy3?PqC#LHGGEOGg;^s>xx75r$LLxvoKu e6A5ADc$%Iigh-1fQ4l5#>)%KUS7b$o^o74huHF;? diff --git a/pet_functions.py b/pet_functions.py index c0ebe50..da04fd7 100644 --- a/pet_functions.py +++ b/pet_functions.py @@ -55,19 +55,36 @@ def beginning(): # A function which changes the status of the pet depending of the age value. # 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(): if pet_variables.pet_age == 5: pet_variables.pet_status = "adult" - pet_variables.max_health = 10 - pet_variables.max_happiness = 8 - pet_variables.max_hunger = 7 + set_adult_stats() 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.") elif pet_variables.pet_age == 15: pet_variables.pet_status = "elderly" - pet_variables.max_health = 7 - pet_variables.max_happiness = 5 - pet_variables.max_hunger = 10 + set_elderly_stats() 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.") @@ -75,7 +92,8 @@ def aging(): ### Functions to increase and decrease stats ### 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(): @@ -117,7 +135,6 @@ def decrease_stats(): while True: time.sleep(pet_variables.day) decrease_hunger() - decrease_poke_count() if pet_variables.pet_hunger <= 0: decrease_health() decrease_happiness() @@ -168,7 +185,7 @@ def playing(): # if you poke it more than 3 times it will get angry at you def poking(): 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.") increase_poke_count() mixer.init() @@ -188,8 +205,10 @@ def poking(): def sleeping(): os.system('clear') print("Your pet is sleeping now.") + time.sleep(10) 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: - print("Something is broken") + print("Your pet has woken up.") time.sleep(3)