-
Notifications
You must be signed in to change notification settings - Fork 0
/
Treasure_generator.py
42 lines (33 loc) · 1.18 KB
/
Treasure_generator.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
import random
from Weapon import Weapon
from Spell import Spell
class Treasure_generator:
@staticmethod
def get_treasure(hero):
rand = random.randint(1, 4)
if rand == 1:
# hero.get_starting_mana()
mana_points = random.randint(10, 200)
hero.take_mana(mana_points)
if hero.get_mana() == hero.starting_mana:
print('Found mana. Hero mana is max.')
else:
print('Found mana. Hero mana is {}').format(hero.get_mana())
elif rand == 2:
health_points = random.randint(10, 20)
hero.take_healing(health_points)
if hero.get_health() == hero.starting_health:
print('Found health. Hero health is max.')
else:
print('Found health. Hero health is {}').format(
hero.get_health())
elif rand == 3:
w = Weapon.load_weapon_from_file('weapons.json')
print('Hero took:')
print(w)
hero.equip(w)
else:
s = Spell.load_spell_from_file('spells.json')
print('Hero learnt')
print(s)
hero.learn(s)