|
@@ -2,14 +2,144 @@
|
|
|
|
|
|
import pickle
|
|
import pickle
|
|
import pprint
|
|
import pprint
|
|
|
|
+import re
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+charsheet = {
|
|
|
|
+ 'bab': 9,
|
|
|
|
+ 'str': 20,
|
|
|
|
+ 'dex': 14,
|
|
|
|
+ 'con': 14,
|
|
|
|
+ 'int': 14,
|
|
|
|
+ 'wis': 10,
|
|
|
|
+ 'cha': 10,
|
|
|
|
+ 'level': [
|
|
|
|
+ ('fighter', 9)
|
|
|
|
+ ],
|
|
|
|
+ 'feat': [
|
|
|
|
+ 'toughness',
|
|
|
|
+ 'armor proficiency, medium',
|
|
|
|
+ 'power attack',
|
|
|
|
+ 'combat stamina',
|
|
|
|
+ 'improved unarmed strike',
|
|
|
|
+ 'combat expertise',
|
|
|
|
+ 'point blank shot',
|
|
|
|
+ 'deadly aim',
|
|
|
|
+ 'improved bull rush',
|
|
|
|
+ 'improved overrun',
|
|
|
|
+ 'improved trip',
|
|
|
|
+ 'weapon focus',
|
|
|
|
+ 'weapon focus with chosen weapon',
|
|
|
|
+ 'weapon focus (greataxe)',
|
|
|
|
+ 'weapon focus (glaive)',
|
|
|
|
+ 'weapon focus with chosen melee weapon',
|
|
|
|
+ 'weapon focus with selected weapon',
|
|
|
|
+ 'weapon focus with the chosen weapon',
|
|
|
|
+ 'weapon focus (any two-handed reach weapon)',
|
|
|
|
+ 'weapon specialization',
|
|
|
|
+ 'weapon specialization with selected weapon',
|
|
|
|
+ 'improved critical',
|
|
|
|
+ 'armor focus',
|
|
|
|
+ 'proficiency with selected armor',
|
|
|
|
+ 'medium armor proficiency',
|
|
|
|
+ 'light armor proficiency',
|
|
|
|
+ 'proficiency with light armor',
|
|
|
|
+ 'proficiency with medium armor',
|
|
|
|
+ 'armor training class feature',
|
|
|
|
+ 'armor trainingclass feature',
|
|
|
|
+ 'martial focus',
|
|
|
|
+ 'weapon training class feature',
|
|
|
|
+ 'combat reflexes',
|
|
|
|
+ ],
|
|
|
|
+ 'skill': [
|
|
|
|
+ ('knowledge (arcane)', 9),
|
|
|
|
+ ('knowledge (dungeoneering)', 9),
|
|
|
|
+ ('knowledge (local)', 9),
|
|
|
|
+ ('knowledge (nature)', 9),
|
|
|
|
+ ('knowledge (planes)', 9),
|
|
|
|
+ ('knowledge (religion)', 9),
|
|
|
|
+ ('knowledge (engineering)', 1),
|
|
|
|
+ ('knowledge (geography)', 2),
|
|
|
|
+ ('knowledge (history)', 4),
|
|
|
|
+ ('acrobatics', 9),
|
|
|
|
+ ('climb', 3),
|
|
|
|
+ ('atealth', 1),
|
|
|
|
+ ('disable device', 1),
|
|
|
|
+ ('spellcraft', 1),
|
|
|
|
+ ('intimidate', 1),
|
|
|
|
+ ('use magic device', 1),
|
|
|
|
+ ('diplomacy', 1),
|
|
|
|
+ ('perception', 1),
|
|
|
|
+ ('linguistics', 4),
|
|
|
|
+ ('lore (divine battles)', 4),
|
|
|
|
+ ('art (anatomy)', 1),
|
|
|
|
+ ('perform (oratory)', 2),
|
|
|
|
+ ],
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
with open('feats.pickle', 'rb') as f:
|
|
with open('feats.pickle', 'rb') as f:
|
|
allfeats = pickle.load(f)
|
|
allfeats = pickle.load(f)
|
|
|
|
|
|
-prefeats = {}
|
|
|
|
|
|
|
|
-for f in allfeats:
|
|
|
|
- if 'feat' in f['prereqs']:
|
|
|
|
|
|
+def texify(textstr):
|
|
|
|
+ textstr = re.sub(r'â', '\textemdash', textstr)
|
|
|
|
+ textstr = re.sub(r'"', "''", textstr)
|
|
|
|
+ return textstr
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def grabfeat(feats, featname):
|
|
|
|
+ for f in feats:
|
|
|
|
+ if f['name'].lower() == featname.lower():
|
|
|
|
+ return f
|
|
|
|
+
|
|
|
|
+def fillsreqs(pr, charsheet):
|
|
|
|
+ qual = True
|
|
|
|
+ for attr in ['str', 'dex', 'con', 'int', 'wis', 'cha', 'bab']:
|
|
|
|
+ if attr in pr:
|
|
|
|
+ if int(pr[attr]) > charsheet[attr]:
|
|
|
|
+ qual = False
|
|
|
|
+ if 'level' in pr:
|
|
|
|
+ for l in pr['level']:
|
|
|
|
+ print(l)
|
|
|
|
+ llqual = False
|
|
|
|
+ for ll in charsheet['level']:
|
|
|
|
+ print(ll)
|
|
|
|
+ if l[0] == ll[0] and int(l[1]) <= ll[1]:
|
|
|
|
+ llqual = True
|
|
|
|
+ break
|
|
|
|
+ if llqual == False:
|
|
|
|
+ qual = False
|
|
|
|
+ break
|
|
|
|
+ if 'skill' in pr:
|
|
|
|
+ for s in pr['skill']:
|
|
|
|
+ squal = False
|
|
|
|
+ for cs in charsheet['skill']:
|
|
|
|
+ if s[0] == cs[0] and int(s[1]) <= cs[1]:
|
|
|
|
+ csqual = True
|
|
|
|
+ break
|
|
|
|
+ if csqual == False:
|
|
|
|
+ qual = False
|
|
|
|
+ break
|
|
|
|
+ return qual
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def qualfeat(feat, charsheet):
|
|
|
|
+ if feat['prereqs']:
|
|
|
|
+ return fillsreqs(feat['prereqs'], charsheet)
|
|
|
|
+ else:
|
|
|
|
+ return True
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def qualfeats(feats, charsheet):
|
|
|
|
+ return [f for f in feats if qualfeat(f, charsheet)]
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def prefeats(feats):
|
|
|
|
+ for f in allfeats:
|
|
|
|
+ prefeats = {}
|
|
fs = f['prereqs']['feat']
|
|
fs = f['prereqs']['feat']
|
|
if isinstance(fs, list):
|
|
if isinstance(fs, list):
|
|
for pf in fs:
|
|
for pf in fs:
|
|
@@ -17,14 +147,60 @@ for f in allfeats:
|
|
prefeats[pf] += 1
|
|
prefeats[pf] += 1
|
|
else:
|
|
else:
|
|
prefeats[pf] = 1
|
|
prefeats[pf] = 1
|
|
- else:
|
|
|
|
- if fs in prefeats:
|
|
|
|
- prefeats[fs] += 1
|
|
|
|
else:
|
|
else:
|
|
- prefeats[fs] = 1
|
|
|
|
|
|
+ if fs in prefeats:
|
|
|
|
+ prefeats[fs] += 1
|
|
|
|
+ else:
|
|
|
|
+ prefeats[fs] = 1
|
|
|
|
+ return prefeats
|
|
|
|
+
|
|
|
|
+def asfeat(feat):
|
|
|
|
+ featsnip = '\subsubsection*{%s}\n\n' % feat['name']
|
|
|
|
+ featsnip += '\\textbf{Benefit:} %s\n\n' % feat['benefit']
|
|
|
|
+ if feat['trick']:
|
|
|
|
+ featsnip += '\\textbf{Combat Trick:} %s\n\n' % feat['trick']
|
|
|
|
+
|
|
|
|
+ if feat['special']:
|
|
|
|
+ featsnip += '\\textbf{Special:} %s\n\n' % feat['special']
|
|
|
|
+
|
|
|
|
+ return featsnip
|
|
|
|
+
|
|
|
|
+def aschainfeat(feat):
|
|
|
|
+ featsnip = '\item \\textbf{%s} %s\n\n' % (feat['name'], feat['benefit'])
|
|
|
|
+ if feat['trick']:
|
|
|
|
+ featsnip += '\\textbf{Combat Trick:} %s\n\n' % feat['trick']
|
|
|
|
+ if feat['special']:
|
|
|
|
+ featsnip += '\\textbf{Special:} %s\n\n' % feat['special']
|
|
|
|
+ return featsnip
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def chainfeats(feats):
|
|
|
|
+ chainsnip = '\begin{itemize}\n\n'
|
|
|
|
+ for f in feats:
|
|
|
|
+ chainsnip += aschainfeat(f)
|
|
|
|
+ chainsnip += '\end{itemize}'
|
|
|
|
+
|
|
|
|
+ return chainsnip
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+if __name__ == '__main__':
|
|
|
|
+ sectsnip = ''
|
|
|
|
+ for f in sorted(charsheet['feat']):
|
|
|
|
+ ff = grabfeat(allfeats, f)
|
|
|
|
+ if ff:
|
|
|
|
+ sectsnip += asfeat(ff)
|
|
|
|
+ print(sectsnip)
|
|
|
|
+
|
|
|
|
+ sectsnip = ''
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+# for f in allfeats:
|
|
|
|
+# if 'skill' in f['prereqs']:
|
|
|
|
+# pprint.pprint(f['prereqs']['skill'])
|
|
|
|
|
|
-outfeats = sorted(prefeats, key=lambda x: prefeats[x])
|
|
|
|
|
|
+# outfeats = sorted(prefeats, key=lambda x: prefeats[x])
|
|
|
|
|
|
-for of in outfeats:
|
|
|
|
- print("%s, %s" % (of, prefeats[of]))
|
|
|
|
|
|
+# for of in outfeats:
|
|
|
|
+# print("%s, %s" % (of, prefeats[of]))
|
|
|
|
|