-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDm_class.py
46 lines (37 loc) · 1.66 KB
/
Dm_class.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
46
from datetime import datetime
import numpy as np
import os
import sys
class DungeonMaster:
def __init__(self):
self.AI_blank = False #just ignore, but MUST be False, see AI Class
self.printing_on = False
self.start_time = datetime.now()
if getattr(sys, 'frozen', False):
application_path = os.path.dirname(sys.executable)
elif __file__:
application_path = os.path.dirname(__file__)
self.Battlefield = np.genfromtxt(application_path + '/Battlefield.txt', delimiter= ',') #load Informations from Battlefield
self.density = self.Battlefield[0][1]
#density: 0 - loose, 1 - normal, 2 - dense
self.rounds_number = 1
self.text = ''
def reset(self):
#This function is called a the start of the fighting and resets the DM
self.rounds_number = 1
def block_print(self):
self.printing_on = False
def enable_print(self):
self.printing_on = True
def say(self, text_to_say, this_is_new_line=False):
if self.printing_on:
if False: #This is a hard coded, disabled developer Function
if False:#total diff in ms
print(str(round((datetime.now() - self.start_time).total_seconds()*1000, 3)), end=': ')
if True:#diff to last
print(str(round((datetime.now() - self.start_time).total_seconds()*1000, 3)), end=': ')
self.start_time = datetime.now()
if this_is_new_line:
print(self.text)
self.text = '' #start new line
self.text = ''.join([self.text, text_to_say])