mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-06-06 21:01:26 +02:00
Fixed some stale code from a PR and fixed monk unarmed strike when importing from Foundry.
Pull-request https://github.com/canismarko/dungeon-sheets/pull/96 introduced some regressions in terms of the model between ``Character`` and ``Entity`` classes. These were cleaned up.
This commit is contained in:
@@ -144,20 +144,10 @@ class Character(Entity):
|
|||||||
# Character-specific
|
# Character-specific
|
||||||
player_name = ""
|
player_name = ""
|
||||||
xp = 0
|
xp = 0
|
||||||
# Hit points
|
# Extra hit points info, for characters only
|
||||||
hp_max = None
|
|
||||||
hp_current = None
|
hp_current = None
|
||||||
hp_temp = None
|
hp_temp = None
|
||||||
# Base stats (ability scores)
|
# Base stats (ability scores)
|
||||||
strength = Ability()
|
|
||||||
dexterity = Ability()
|
|
||||||
constitution = Ability()
|
|
||||||
intelligence = Ability()
|
|
||||||
wisdom = Ability()
|
|
||||||
charisma = Ability()
|
|
||||||
armor_class = ArmorClass()
|
|
||||||
initiative = Initiative()
|
|
||||||
speed = Speed()
|
|
||||||
inspiration = False
|
inspiration = False
|
||||||
attacks_and_spellcasting = ""
|
attacks_and_spellcasting = ""
|
||||||
class_list = list()
|
class_list = list()
|
||||||
@@ -173,14 +163,6 @@ class Character(Entity):
|
|||||||
features_and_traits = "Describe any other features and abilities."
|
features_and_traits = "Describe any other features and abilities."
|
||||||
|
|
||||||
_proficiencies_text = list()
|
_proficiencies_text = list()
|
||||||
# Magic
|
|
||||||
spellcasting_ability = None
|
|
||||||
_spells = list()
|
|
||||||
_spells_prepared = list()
|
|
||||||
infusions = list()
|
|
||||||
# Features IN MAJOR DEVELOPMENT
|
|
||||||
custom_features = list()
|
|
||||||
feature_choices = list()
|
|
||||||
|
|
||||||
# Appearance
|
# Appearance
|
||||||
# portrait = placeholder not sure how to implement
|
# portrait = placeholder not sure how to implement
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class MartialArts(Feature):
|
|||||||
- When you use the Attack action with an unarmed strike or a monk
|
- When you use the Attack action with an unarmed strike or a monk
|
||||||
weapon on your turn, you can make one unarmed strike as a bonus
|
weapon on your turn, you can make one unarmed strike as a bonus
|
||||||
action. For example, if you take the Attack action and attack
|
action. For example, if you take the Attack action and attack
|
||||||
with a quarter- staff, you can also make an unarmed strike as a
|
with a quarterstaff, you can also make an unarmed strike as a
|
||||||
bonus action, assuming you haven't already taken a bonus action
|
bonus action, assuming you haven't already taken a bonus action
|
||||||
this turn.
|
this turn.
|
||||||
|
|
||||||
|
|||||||
@@ -148,15 +148,17 @@ def create_character_pdf_template(character, basename, flatten=False):
|
|||||||
("Wpn Name 2", "Wpn2 AtkBonus ", "Wpn2 Damage "),
|
("Wpn Name 2", "Wpn2 AtkBonus ", "Wpn2 Damage "),
|
||||||
("Wpn Name 3", "Wpn3 AtkBonus ", "Wpn3 Damage "),
|
("Wpn Name 3", "Wpn3 AtkBonus ", "Wpn3 Damage "),
|
||||||
]
|
]
|
||||||
if len(character.weapons) == 0:
|
if len(character.weapons) == 0 or hasattr(character, 'Monk'):
|
||||||
character.wield_weapon("unarmed")
|
character.wield_weapon("unarmed")
|
||||||
for _fields, weapon in zip(weapon_fields, character.weapons):
|
for _fields, weapon in zip(weapon_fields, character.weapons):
|
||||||
name_field, atk_field, dmg_field = _fields
|
name_field, atk_field, dmg_field = _fields
|
||||||
fields[name_field] = weapon.name
|
fields[name_field] = weapon.name
|
||||||
fields[atk_field] = "{:+d}".format(weapon.attack_modifier)
|
fields[atk_field] = "{:+d}".format(weapon.attack_modifier)
|
||||||
fields[dmg_field] = f"{weapon.damage}/{weapon.damage_type}"
|
fields[dmg_field] = f"{weapon.damage}/{weapon.damage_type}"
|
||||||
|
# Additional attacks beyond 3
|
||||||
|
attack = [f"{w.name}: Atk {weapon.attack_modifier:+d}, Dam {weapon.damage}/{weapon.damage_type}"
|
||||||
|
for w in character.weapons[len(weapon_fields):]]
|
||||||
# Other attack information
|
# Other attack information
|
||||||
attack = []
|
|
||||||
if character.armor:
|
if character.armor:
|
||||||
attack.append(f"Armor: {character.armor}")
|
attack.append(f"Armor: {character.armor}")
|
||||||
if character.shield:
|
if character.shield:
|
||||||
|
|||||||
@@ -284,8 +284,9 @@ def make_character_sheet(
|
|||||||
character_props = readers.read_sheet_file(char_file)
|
character_props = readers.read_sheet_file(char_file)
|
||||||
character = _char.Character.load(character_props)
|
character = _char.Character.load(character_props)
|
||||||
# Set the fields in the FDF
|
# Set the fields in the FDF
|
||||||
char_base = os.path.splitext(character_file)[0] + "_char"
|
basename = char_file.stem
|
||||||
person_base = os.path.splitext(character_file)[0] + "_person"
|
char_base = basename + "_char"
|
||||||
|
person_base = basename + "_person"
|
||||||
sheets = [char_base + ".pdf", person_base + ".pdf"]
|
sheets = [char_base + ".pdf", person_base + ".pdf"]
|
||||||
pages = []
|
pages = []
|
||||||
tex = [
|
tex = [
|
||||||
|
|||||||
@@ -314,6 +314,12 @@ class Roll20CharacterReader(JSONCharacterReader):
|
|||||||
|
|
||||||
|
|
||||||
class FoundryCharacterReader(JSONCharacterReader):
|
class FoundryCharacterReader(JSONCharacterReader):
|
||||||
|
# List of weapons to ignore, only for class features that get added automatically
|
||||||
|
_invalid_weapons = [
|
||||||
|
"unarmed strike (monk)",
|
||||||
|
"<no name>",
|
||||||
|
]
|
||||||
|
|
||||||
def _skill_proficiency_value(self, key: str) -> float:
|
def _skill_proficiency_value(self, key: str) -> float:
|
||||||
proficiency_labels = {
|
proficiency_labels = {
|
||||||
"acrobatics": "acr",
|
"acrobatics": "acr",
|
||||||
@@ -377,7 +383,8 @@ class FoundryCharacterReader(JSONCharacterReader):
|
|||||||
"""Iterator over the weapons the character is carrying in her inventory."""
|
"""Iterator over the weapons the character is carrying in her inventory."""
|
||||||
items = self.json_data()["items"]
|
items = self.json_data()["items"]
|
||||||
for item in items:
|
for item in items:
|
||||||
if item["type"] == "weapon" and item["name"] != "<no name>":
|
is_valid_weapon = (item["type"] == "weapon" and item["name"].lower() not in self._invalid_weapons)
|
||||||
|
if is_valid_weapon:
|
||||||
yield item["name"].lower()
|
yield item["name"].lower()
|
||||||
|
|
||||||
def armor(self):
|
def armor(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user