Skip to content

Commit

Permalink
Proficiencies: Harmonize capitalization and punction in MSavage.tex
Browse files Browse the repository at this point in the history
This patch uses str().title capitalization in, and a period after all
the types of other proficiencies and languages.
  • Loading branch information
PJBrs committed Jan 21, 2023
1 parent 39ff432 commit 93c173c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions dungeonsheets/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,26 +800,27 @@ def proficiencies_by_type(self):
prof_dict = {}
w_pro = set(self.weapon_proficiencies)
if weapons.MartialWeapon in w_pro:
prof_dict["Weapons"] = ["All weapons"]
prof_dict["Weapons"] = ["All Weapons"]
elif weapons.SimpleWeapon in w_pro:
prof_dict["Weapons"] = ["Simple weapons"]
prof_dict["Weapons"] = ["Simple Weapons"]
for w in w_pro:
if not(issubclass(w, weapons.SimpleWeapon)):
prof_dict["Weapons"] += [w.name]
else:
prof_dict["Weapons"] = [w.name for w in w_pro]
if "Weapons" in prof_dict.keys():
prof_dict["Weapons"] = ", ".join(prof_dict["Weapons"]) + "."
prof_dict["Weapons"] = ", ".join(prof_dict["Weapons"])

armor_types = ["all armor", "light armor", "medium armor",
"heavy armor"]
prof_set = set([prof.lower().strip().strip('.')
for prof in self.proficiencies_text.split(',')])
prof_dict["Armor"] = [ar for ar in armor_types if ar in prof_set]
prof_dict["Armor"] = [ar.title() for ar in armor_types if ar in prof_set]
if len(prof_dict["Armor"]) > 2 or 'all armor' in prof_set:
prof_dict["Armor"] = ["All armor"]
prof_dict["Armor"] = ["All Armor"]
if 'shields' in prof_set:
prof_dict["Armor"] += ["shields"]
prof_dict["Armor"] = ", ".join(prof_dict["Armor"]) + "."
prof_dict["Armor"] += ["Shields"]
prof_dict["Armor"] = ", ".join(prof_dict["Armor"])
if hasattr(self, 'chosen_tools'):
prof_dict["Other"] = self.chosen_tools
return prof_dict
Expand Down
8 changes: 4 additions & 4 deletions dungeonsheets/forms/MSavage_template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
\StealthSkillModifier{[[ "{:+d}".format(char.stealth.modifier) ]]}
\SurvivalSkillModifier{[[ "{:+d}".format(char.survival.modifier) ]]}

% Prociciencies
% Proficiencies
\StrengthProficiency{[[ "strength" in char.saving_throw_proficiencies ]]}
\DexterityProficiency{[[ "dexterity" in char.saving_throw_proficiencies ]]}
\ConstitutionProficiency{[[ "constitution" in char.saving_throw_proficiencies ]]}
Expand Down Expand Up @@ -123,9 +123,9 @@
}

\OtherProficienciesLanguages{
\textbf{Languages:} [[ char.languages ]] \\
\textbf{Languages:} [[ char.languages ]]. \\
[%- for prof_type, values in char.proficiencies_by_type.items() %]
\textbf{[[ prof_type ]]}: [[ values ]] \\
\textbf{[[ prof_type ]]}: [[ values ]]. \\
[%- endfor -%]
}

Expand Down Expand Up @@ -202,4 +202,4 @@
\renderspellsheet
[% endif %]

\end{document}
\end{document}

0 comments on commit 93c173c

Please sign in to comment.