canismarko / dungeon-sheets

A tool to create character sheets and GM session notes for Dungeons and Dragons fifth edition (D&D 5e).
https://dungeon-sheets.readthedocs.io/en/latest/
GNU General Public License v3.0
160 stars 67 forks source link

Tabaxi have Claws duplicated as a weapon #29

Closed geckon closed 1 month ago

geckon commented 5 years ago

When a Tabaxi character is generated using create-character, the weapons line in the Python file looks e.g. like this:

weapons = ["Claws", "Shortbow", "Dagger", "Spear"]  # Example: ('shortsword', 'longsword')

And this is the respective section in the PDF: screenshot_2019-08-12_2150_21:50RRR

After editing the Python file to this:

weapons = ["Shortbow", "Dagger", "Spear", "Claws"]  # Example: ('shortsword', 'longsword')

the PDF still contains the Claws in the first place: screenshot_2019-08-12_2152_21:52RRR

Therefore, I assume that Claws are added automatically by makesheets no matter what the Python file contains which can cause trouble like in this case.

PJBrs commented 2 months ago

I think this same problem applies to the Lizardfolk bite attack and the Aarakocra talons attack (these get added in race.py, and to the Monk Unarmed attack:

dungeonsheets/character.py-        # Account for unarmed strike
dungeonsheets/character.py:        if len(my_weapons) == 0 or hasattr(self, "Monk"):
dungeonsheets/character.py-            my_weapons.append(weapons.Unarmed(wielder=self))

The issue is that create-character will add all weapons to the character sheet, which includes the above attacks, and then makesheets adds them again, causing duplicates. The solution would seem that create-character only adds the user's weapon choices:

diff --git a/dungeonsheets/create_character.py b/dungeonsheets/create_character.py
index 36ac473..0473e5a 100644
--- a/dungeonsheets/create_character.py
+++ b/dungeonsheets/create_character.py
@@ -693,9 +693,8 @@ class WeaponForm(LinkedListForm):
             new_weapons = tuple(s.lower() for s in new_weapons)
         else:
             new_weapons = ()
-        for wpn in new_weapons:
-            self.parentApp.character.wield_weapon(wpn)
-        log.debug(f"Weapons wielded: {new_weapons}")
+        self.parentApp.character.new_weapons = new_weapons
+        log.debug(f"Weapons added: {new_weapons}")
         super().to_next()

     def update_remaining(self, widget=None):
diff --git a/dungeonsheets/forms/empty_template.txt b/dungeonsheets/forms/empty_template.txt
index ce7f6ff..b992fcc 100644
--- a/dungeonsheets/forms/empty_template.txt
+++ b/dungeonsheets/forms/empty_template.txt
@@ -69,7 +69,7 @@ gp = 0
 pp = 0

 # TODO: Put your equipped weapons and armor here
-weapons = {{ char.weapons }}  # Example: ('shortsword', 'longsword')
+weapons = {{ char.new_weapons }}  # Example: ('shortsword', 'longsword')
 magic_items = ()  # Example: ('ring of protection',)
 armor = "{{ char.armor }}"  # Eg "leather armor"
 shield = "{{ char.shield }}"  # Eg "shield"

@canismarko I can add a patch for this too, somewhere anyway.