-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacter.py
More file actions
executable file
·30 lines (24 loc) · 825 Bytes
/
character.py
File metadata and controls
executable file
·30 lines (24 loc) · 825 Bytes
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
import random
class Character:
def __init__(self, name, base_health, base_strength, max_random_damage, gold, inventory):
self.name = name
self.base_health = base_health
self.health = base_health
self.base_strength = base_strength
self.strength = base_strength
self.inventory = inventory
self.max_random_damage = max_random_damage
self.gold = gold
self.armor = 0
self.illbane = 1
def is_alive(self):
if self.health > 1:
return True
return False
def do_attack(self):
return random.randint(0, self.max_random_damage)
def get_dropped_object(self):
chance = random.randint(0, 2)
if (chance >= 1):
return Potion("Health Potion", 100, 30, 1, 50)
return None