-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
47 lines (31 loc) · 940 Bytes
/
models.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
44
45
class Player:
def __init__(self, name, health, strength, speed):
self.name = name
self.health = health
self.strength = strength
self.speed = speed
def __str__(self):
print(f'{self.name}')
def damage(self, amount):
self.health -= amount
def heal(self, amount):
self.health += amount
def buff(self, sp_inc, str_inc):
self.speed += sp_inc
self.strength += str_inc
def nerf(self, sp_dec, str_dec):
self.speed -= sp_dec
self.strength -= str_dec
class Monster:
def __init__(self, health, strength, speed):
self.health = health
self.strength = strength
self.speed = speed
def damage(self, amount):
self.health -= amount
class Object:
def __init__(self, name, effect):
self.name = name
self.effect = effect
def __str__(self):
print(f'{self.name}')