-
Notifications
You must be signed in to change notification settings - Fork 7
/
healthmanager.py
69 lines (57 loc) · 2.06 KB
/
healthmanager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import random
class HealthManager:
def __init__(self):
self.happiness = 50
self.__age = 0
def update(self, elapsed_time):
self.__age += elapsed_time
self.happiness -= elapsed_time / 60
return 0
def funpill(self):
"""
Gurkbert konsumerar ett piller för en god tid.
"""
self.happiness += 3
print("The pill brings Gurkbert a bit of joy.")
def playnormal(self):
"""
Gurkbert gör något lätt och roligt.
"""
self.happiness += 5
easygamechoice = random.randint(0,1)
if easygamechoice == 0:
print("Gurkbert skips the rope.")
elif easygamechoice == 1:
print("Gurkbert claps his hands joyously.")
else:
print("Gurkbert cheers.")
def playhard(self):
"""
Gurkbert gör något svårare med bättre vinster dock med risk för förlust.
"""
winorlose = random.randint(0,6)
if winorlose == 6:
print("Gurkbert fails and runs into a table. Not a gamer move! :(")
self.happiness -= 10
elif winorlose != 6:
self.happiness += 15
hardgamechoice = random.randint(0,1)
if hardgamechoice == 0:
print("Gurkbert sets a new Pacman record!")
elif hardgamechoice == 1:
print("Gurkbert wins a match of Stalin Simulator!")
else:
print("Gurkbert wins a game of Fortnite!")
def playgod(self):
"""
Gurkbert utmanar Gud själv i en lek om liv och döden.
"""
defeatzeus = random.randint(0,1)
if defeatzeus == 0:
print("Gurkbert was sheeple and is struck by lightning.")
self.happiness = self.happiness * 0.6
elif defeatzeus == 1:
print("Gurkbert yells 'ABSORB BREAK!' and throws a thunderbolt at Zeus.")
self.happiness += 30
def get_options(self):
return ['funpill', 'playnormal', 'playhard', 'playgod']