fix(api): use armor set's total protection for each piece
- API returns 0 protection for individual armor pieces - Protection values are only at the armor set level (Defense field) - Now each piece gets the full set protection values assigned - Removed equip_full_set call with wrong type (NexusArmorSet vs ArmorSet) - Individual pieces now have correct protection for calculations
This commit is contained in:
parent
437f6b3027
commit
22b4e6e8bb
|
|
@ -1660,6 +1660,9 @@ class LoadoutManagerDialog(QDialog):
|
|||
pieces_found = 0
|
||||
pieces_not_found = []
|
||||
|
||||
# Store the full set for protection calculations
|
||||
self.current_armor_set = armor_set
|
||||
|
||||
# Try to find each piece in the set
|
||||
for piece_name in armor_set.pieces:
|
||||
# Find the armor in the API results
|
||||
|
|
@ -1704,19 +1707,22 @@ class LoadoutManagerDialog(QDialog):
|
|||
|
||||
if slot_widget:
|
||||
# Create ArmorPiece from NexusArmor
|
||||
# Use the SET'S protection values, not individual piece (which are 0 in API)
|
||||
from core.armor_system import ArmorPiece
|
||||
piece = ArmorPiece(
|
||||
item_id=matching_armor.item_id,
|
||||
name=matching_armor.name,
|
||||
slot=self._get_slot_from_type(armor_type) if armor_type in slot_mapping else self._get_slot_from_name(piece_name),
|
||||
# Use armor set's total protection for each piece
|
||||
# In EU, protection comes from the full set, not individual pieces
|
||||
protection=ProtectionProfile(
|
||||
impact=matching_armor.protection_impact,
|
||||
cut=matching_armor.protection_cut,
|
||||
stab=matching_armor.protection_stab,
|
||||
burn=matching_armor.protection_burn,
|
||||
cold=matching_armor.protection_cold,
|
||||
acid=matching_armor.protection_acid,
|
||||
electric=matching_armor.protection_electric,
|
||||
impact=armor_set.total_protection.impact,
|
||||
cut=armor_set.total_protection.cut,
|
||||
stab=armor_set.total_protection.stab,
|
||||
burn=armor_set.total_protection.burn,
|
||||
cold=armor_set.total_protection.cold,
|
||||
acid=armor_set.total_protection.acid,
|
||||
electric=armor_set.total_protection.electric,
|
||||
),
|
||||
durability=matching_armor.durability,
|
||||
decay_per_hp=Decimal("0.05") * (Decimal(1) - Decimal(matching_armor.durability) / Decimal("100000"))
|
||||
|
|
@ -2181,10 +2187,11 @@ class LoadoutManagerDialog(QDialog):
|
|||
|
||||
equipped.equip_piece(piece_copy)
|
||||
|
||||
# Set full set if all pieces match
|
||||
if self.current_armor_set:
|
||||
equipped.equip_full_set(self.current_armor_set)
|
||||
|
||||
# Note: We don't call equip_full_set here because:
|
||||
# 1. current_armor_set is a NexusArmorSet (API type), not ArmorSet (core type)
|
||||
# 2. Individual pieces already have the full set protection values stored on them
|
||||
# 3. The EquippedArmor.get_total_protection() will sum up pieces correctly
|
||||
|
||||
return LoadoutConfig(
|
||||
name=self.loadout_name_edit.text().strip() or "Unnamed",
|
||||
weapon_name=self.current_weapon.name if self.current_weapon else (self.weapon_name_label.text() if self.weapon_name_label.text() != "No weapon selected" else "-- Custom --"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue