-
Notifications
You must be signed in to change notification settings - Fork 0
/
ennemy.py
36 lines (28 loc) · 1.16 KB
/
ennemy.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
from debug import *
from random import *
class Ennemy:
def __init__(self, name : str, hp : float, atk : float, dfc : float, debug = False):
self.name = name
self.hp = hp
self.atk = atk
self.dfc = dfc
self.dead = False
debug_print(debug, name + " Ennemy stats succesfully created")
def check_alive(self, name):
if self.hp <= 0:
self.dead = True
print(self.name + " has been killed by " + name)
def attack(self, players, debug = False):
#TODO: Creer un algorythme de priorité d'attaque
atkedplayer = randint(0, len(players)-1)
if not players[atkedplayer].dead:
players[atkedplayer].get_atacked(self.name, self.atk)
debug_print(debug, "Player attacked with " + str(self.atk) + " atk point")
def defence(self, debug = False):
pass
def magic(self, debug = False):
pass
def get_attacked(self, name, atk):
self.hp -= min_int_0(atk-self.dfc)
print(self.name+" is Attacked by "+name+" and deal "+str(min_int_0(atk-self.dfc))+" damage")
self.check_alive(name)