-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
155 lines (152 loc) · 7.06 KB
/
game.py
File metadata and controls
155 lines (152 loc) · 7.06 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
from character import Player
from character import Monster
from stuff import available_stuff
from stats import Stats
from text import TextDialogue, TextFight, TextItem, Interface, TextForest
import random
player = Player("Hero")
monster = Monster("Monster")
# boss = Boss("Boss")
class Game:
def __init__(self):
self.name = "BossFight"
@staticmethod
def start_game():
m = monster
p = player
# i = player.stuff.values
# TextDialogue.title_speed(Interface.logo())
# TextDialogue.text_speed(TextDialogue.intro())
# Interface.separate_logic()
p.name = TextDialogue.player_name()
# Text.clear_screen()
Interface.separate_elem()
TextDialogue.text_speed(TextDialogue.power(p.name))
while p.level <= 100:
menu = TextDialogue.game_menu()
# ================= DEBUT MENU DU DIALOGUE ==================
if menu == "a":
Interface.separate_logic()
# Début des événements aléatoires ; variable "alea" à adapter pour les tests
# 0 = combats ; 1 = piege ; 2 = se blesse ; 3 = trouve un objet ;
alea = random.randint(3, 3)
TextDialogue.text_speed(TextDialogue.go_wood())
# ================= DEBUT COMBAT VS MONSTER =================
if alea == 0:
try:
TextFight.new_enemy_appear()
lvl_enemy = m.monster_level(p.level)
if lvl_enemy > p.level:
Stats.stats(p, m)
p.health_lose(m.damage)
TextFight.take_damage(m.name, m.damage, p.health)
Interface.separate_logic()
if p.health <= 0:
TextFight.p_dead()
Stats.stats_player(p)
quit()
else:
continue
elif lvl_enemy <= p.level:
Stats.stats(p, m)
TextFight.e_killed(p.name, m.name)
p.level_up()
TextFight.lvl_up(p.level, p.health)
Interface.separate_logic()
continue
else:
Stats.stats(p, m)
print("error")
except TypeError:
print("Error in combat system")
# ================= FIN COMBAT VS MONSTER ==================
# ================= DEBUT SYSTEME DE PIEGE =================
elif alea == 1: #piege
try:
health_lose = 3
p.health_lose(health_lose)
TextFight.trap_damages(health_lose, p.health)
Interface.separate_logic()
if p.health <= 0:
TextFight.p_dead()
Stats.stats_player(p)
quit()
else:
continue
except TypeError:
print("Error in trap system")
# ================= FIN SYSTEME DE PIEGE =================
# ================= DEBUT SYSTEME SE BLESSE =================
elif alea == 2: #se blesse
try:
health_lose = 1
p.health_lose(health_lose)
TextFight.walk_damage(health_lose,p.health)
Interface.separate_logic()
if p.health <= 0:
TextFight.p_dead()
Stats.stats_player(p)
quit()
else:
continue
except TypeError:
print("Error in injure system")
# ================= FIN SYSTEME SE BLESSE =================
# ================= DEBUT SYSTEME D'OBJET ================
elif alea == 3: #trouve un objet
try:
obj = available_stuff
TextItem.go_search()
Interface.separate_elem()
objet = random.choice(obj)
if objet.name == "Potion de soin" or objet.name == "Collier de soin":
p.health_up()
if objet == "Potion de soin":
TextItem.healing_pot(objet, p.health)
Interface.separate_logic()
else:
TextItem.healing_neck(objet, p.health)
Interface.separate_logic()
elif objet.name == "Bombe":
p.inventory.append("Bombe")
TextItem.find_bomber()
Interface.separate_logic()
elif objet.name == "Explose":
if objet.name == "Bombe" in p.inventory:
health_lose = 2
p.health_lose(health_lose)
p.inventory.remove("Bombe")
TextItem.explose_bomber(health_lose)
Interface.separate_logic()
if p.health <= 0:
TextFight.p_dead()
Stats.stats_player(p)
quit()
else:
continue
else:
TextItem.shit()
continue
else:
p.inventory.append(objet)
TextItem.find_item(objet)
p.equip(objet.name)
Interface.separate_logic()
except TypeError:
print("Error in loot item system")
# ================= FIN SYSTEME D'OBJET =================
# ================= DEBUT VOYAGE FORET ==================
else: #avance dans la foret sans événements
TextDialogue.text_speed(TextForest.calm())
continue
# ================= FIN VOYAGE FORET =================
# ================= AUTRE CHOIX DU DIALOGUE ==================
elif menu == "s":
Stats.stats_player(p)
elif menu == "q":
TextDialogue.thanks_for_playing()
Interface.separate_logic()
quit()
else:
TextDialogue.need_to_choice()
Interface.separate_logic()