-
Notifications
You must be signed in to change notification settings - Fork 1
/
enemies.py
43 lines (31 loc) · 874 Bytes
/
enemies.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
from character import Character
import random
class Goblin(Character):
def __str__(self):
return "Goblin"
class Zombie(Character):
def __str__(self):
return "Zombie"
def alive(self):
if self.health < -50:
self.isalive = False
class Shadow(Character):
def __str__(self):
return "Shadow"
def alive(self):
modifier = random.randint(1, 10)
if modifier == 10:
if self.health < 1:
self.isalive = False
else:
print('The shadow dodged the attack!')
self.health = 1
class Ogre(Character):
def __str__(self):
return "Ogre"
class Gigant(Character):
def __str__(self):
return "Gigant"
class Dragon(Character):
def __str__(self):
return "Dragon"