forked from cschultz16/test_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfighter.py
More file actions
60 lines (42 loc) · 1.57 KB
/
fighter.py
File metadata and controls
60 lines (42 loc) · 1.57 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
import random
import shield
import weapon
class FighterFactory(object):
def __init__(self):
self.names = "Squire Artur,Admiral Anselmus,Earl Rotgerius,Lady Ariana,Countess Ninette,Empress Mariel".split(",")
def get_random_fighter(self):
# returns random fighter with random name, random weapon and random shield
pass
class Fighter(object):
def __init__(self, name, weapon, shield):
self.name = name
self.health = 100
pass
def get_name(self):
# returns name of the fighter
pass
def get_weapon_name(self):
# returns name of the weapon
pass
def get_shield_name(self):
# returns name of the shield
pass
def attack(self, other_fighter):
attack_strength = self.weapon.attack()
block_strength = other_fighter.block()
if attack_strength > block_strength:
damage_diff = attack_strength - block_strength
print(self.name + " scores a brutal attack on "+other_fighter.get_name()+ " for " + str(damage_diff))
other_fighter.takes_damage(attack_strength - block_strength)
else:
print(other_fighter.get_name() + " has blocked " + self.name + " puny attack!")
def block(self):
return self.shield.block()
def takes_damage(self, damage):
# substracts damage from health
pass
def is_defeated(self):
# returns True if health is less then or equal to 0
pass
def status(self):
return self.name + " has " + str(self.health) + " health remaining"