@@ -124,33 +124,12 @@ def get_brawling_weapon_item(npc: Npc, all_weapons: List[ItemWithNames]) -> Item
124124 name = "Brawling" )
125125
126126
127- def add_weapon_to_npc (weapon : Item , npc : Npc , weapon_skills_data : Dict [str , str ]):
128- skill_name : Optional [str ] = None
129- for tag in weapon .get_all_tags ():
130- if tag in weapon_skills_data .keys ():
131- skill_name = weapon_skills_data [tag ]
132- break
133-
134- assert skill_name
135- skill_value : int = npc .get_skill_total_value (skill_name )
136- if weapon .quality == ItemQuality .EXCELLENT :
137- skill_value += 1
138-
139- weapon = replace (
140- weapon ,
141- name = f"[{ skill_value } ] { weapon .name } " )
142-
143- npc .weapons .add (weapon )
144-
145-
146127def generate_weapon (npc : Npc , npc_template : NpcTemplate ) -> Npc :
147128 logging .debug ("\n Generating weapons..." )
148129
149130 weapons_data = load_data ("configs/items/weapon.json" )
150131 all_weapons : List [ItemWithNames ] = [dataclass_wizard .fromdict (ItemWithNames , x ) for x in weapons_data ]
151132
152- weapon_skills_data : Dict [str , str ] = load_data ("configs/weapon_skills.json" )
153-
154133 total_weapons_budget : int = round (npc_template .rank .items_budget [ItemType .WEAPON ].generate ())
155134 logging .debug (f"\t { total_weapons_budget = } " )
156135
@@ -172,7 +151,7 @@ def generate_weapon(npc: Npc, npc_template: NpcTemplate) -> Npc:
172151 npc )
173152
174153 if primary_weapon :
175- add_weapon_to_npc (primary_weapon , npc , weapon_skills_data )
154+ npc . weapons . add (primary_weapon )
176155
177156 # try to buy a secondary weapon with any budget left
178157 secondary_weapon , _ = pick_weapon (
@@ -183,14 +162,14 @@ def generate_weapon(npc: Npc, npc_template: NpcTemplate) -> Npc:
183162 npc )
184163
185164 if secondary_weapon :
186- add_weapon_to_npc (secondary_weapon , npc , weapon_skills_data )
165+ npc . weapons . add (secondary_weapon )
187166
188167 # add all the rest weapons from the cyberware
189168 for cyberware in npc .cyberware :
190169 if cyberware .item .damage :
191- add_weapon_to_npc (cyberware .item , npc , weapon_skills_data )
170+ npc . weapons . add (cyberware .item )
192171
193172 # add boxing or martial arts
194- add_weapon_to_npc (get_brawling_weapon_item (npc , all_weapons ), npc , weapon_skills_data )
173+ npc . weapons . add (get_brawling_weapon_item (npc , all_weapons ))
195174
196175 return npc
0 commit comments