-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharmy.py
More file actions
85 lines (67 loc) · 1.58 KB
/
army.py
File metadata and controls
85 lines (67 loc) · 1.58 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
import abc
__author__ = 'Bruno'
class Soldier:
"""
The soldier class
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def combat_move(self):
"""
Do the combat's move
"""
raise NotImplementedError
@abc.abstractmethod
def load_weapon(self):
"""
Loads the weapon
"""
raise NotImplementedError
def attack(self):
"""
Do the attack
"""
self.load_weapon()
self.combat_move()
class Warrior(Soldier):
"""
The warrior class
"""
def load_weapon(self):
"""
Loads his sword
"""
print('The brave warrior unsheathe his sword')
def combat_move(self):
"""
The combat move
"""
print('Then, he falls it into his enemy')
class Archer(Soldier):
"""
The archer class
"""
def load_weapon(self):
"""
Loads his arrow
"""
print('The precise archer take the arrow from his bag')
def combat_move(self):
"""
The combat move
"""
print("He aims the enemy, take a deep breath and hold...he shoots the arrow in the bull's eye ")
class SpellCaster(Soldier):
"""
The SpellCaster class
"""
def load_weapon(self):
"""
Loads his book
"""
print('The SpellCaster start reading his book')
def combat_move(self):
"""
The combat move
"""
print("Then he start to spell some words and rises his tome, creating a fireball that toast the enemy!")