-
Notifications
You must be signed in to change notification settings - Fork 0
/
kirbyadven01.py
67 lines (67 loc) · 1.91 KB
/
kirbyadven01.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
"""[Extra] KIRBY Adventure - 01 [HELP!]"""
def role(agent):
"เลือกอาชีพ"
if agent == "sword":
return 4
elif agent == "magic":
return 2
elif agent == "sleep":
return 0
elif agent == "master":
return 9
def enlife(enemy):
"""เลือดศัตรู"""
if enemy == "waddle dee":
return 2
if enemy == "waddle doo":
return 5
if enemy == "laser ball":
return 3
else:
return 0
def enatk(enemy):
"""พลังโจมตีศัตรู"""
if enemy == "waddle dee":
return 1
if enemy == "waddle doo":
return 3
if enemy == "laser ball":
return 2
else:
return 0
def main():
"""เหลือHpเท่าไหร่ killศัตรูเท่าไหร่"""
hp_ag = int(input())
num_kill = 0
hp_en = 0
atac_en = 0
while hp_ag > 0:
agent = input().lower()
atac_ag = role(agent)
enemy = input().lower()
hp_en = enlife(enemy)
atac_en = enatk(enemy)
print("------------")
if enemy == "none":
print("%d HP left" %hp_ag)
print("Kirby won!")
print("You had defeated %d enemies" %num_kill)
print("------------")
break
elif enemy == "heal":
hp_ag += 2
else:
hp_ag -= atac_en
hp_en -= atac_ag
if hp_en <= 0 and hp_ag > 0:
print("- %s had defeated -" %enemy)
num_kill += 1
elif hp_ag <= 0:
print("%d HP left" %hp_ag)
print("GameOver!")
print("You had defeated %d enemies" %num_kill)
print("------------")
break
print("%d HP left" %hp_ag)
print("------------")
main()