Skip to content

Commit

Permalink
add job stats to log file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous committed May 23, 2020
1 parent 9d09462 commit 369e771
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions randomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,39 @@ def get_most_common(self, attribute):
return random.choice(choices)
return None

@property
def profile(self):
if not self.is_generic:
raise NotImplementedError

generics = [j for j in JobObject if j.is_generic]
assert self in generics

s = '/={0:=<19}=\\\n'.format(self.name.upper())
s += ('| {0:3} | {1:5} | {2:5} |\n'.format('', 'BASE', 'GROW'))
s += ('|-----+-------+-------|\n')
stats = ['hp', 'mp', 'pa', 'ma', 'spd']
for stat in stats:
mult_attr = '{0}mult'.format(stat)
grow_attr = '{0}growth'.format(stat)

f = lambda j: getattr(j, mult_attr)
g = lambda j: 255 - getattr(j, grow_attr)

mult_index = sorted(
generics, key=lambda j: (f(j), g(j))).index(self)
mult_rank = int(round((4*mult_index / float(len(generics)-1)))) + 1
assert 1 <= mult_rank <= 5
grow_index = sorted(
generics, key=lambda j: (g(j), f(j))).index(self)
grow_rank = int(round((4*grow_index / float(len(generics)-1)))) + 1
assert 1 <= grow_rank <= 5
s += '| {0:>3} | {1:5} | {2:5} |\n'.format(
stat.upper(), '*'*mult_rank, '*'*grow_rank)
s += '\\=====================/\n'

return s.strip()

@property
def jobreq(self):
return JobReqObject.get(self.index)
Expand Down Expand Up @@ -4772,6 +4805,15 @@ def recurse(j):
return treestr


def get_profiles_str():
generics = sorted([j for j in JobObject.every if j.is_generic],
key=lambda j: j.name)
s = ''
for j in generics:
s += j.profile + '\n\n'
return s.strip()


def get_poach_str():
s = ("SECRET HUNT LIST\n"
"Secret Hunt is always a Thief ability.\n")
Expand Down Expand Up @@ -5075,6 +5117,11 @@ def randomize():
random.seed(seed)
mutate_job_stats()

s = get_profiles_str()
f = open(logfile, "a+")
f.write(s + "\n\n")
f.close()

if 'm' in flags:
# before units
random.seed(seed)
Expand Down

0 comments on commit 369e771

Please sign in to comment.