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_found = 0
|
||||||
pieces_not_found = []
|
pieces_not_found = []
|
||||||
|
|
||||||
|
# Store the full set for protection calculations
|
||||||
|
self.current_armor_set = armor_set
|
||||||
|
|
||||||
# Try to find each piece in the set
|
# Try to find each piece in the set
|
||||||
for piece_name in armor_set.pieces:
|
for piece_name in armor_set.pieces:
|
||||||
# Find the armor in the API results
|
# Find the armor in the API results
|
||||||
|
|
@ -1704,19 +1707,22 @@ class LoadoutManagerDialog(QDialog):
|
||||||
|
|
||||||
if slot_widget:
|
if slot_widget:
|
||||||
# Create ArmorPiece from NexusArmor
|
# Create ArmorPiece from NexusArmor
|
||||||
|
# Use the SET'S protection values, not individual piece (which are 0 in API)
|
||||||
from core.armor_system import ArmorPiece
|
from core.armor_system import ArmorPiece
|
||||||
piece = ArmorPiece(
|
piece = ArmorPiece(
|
||||||
item_id=matching_armor.item_id,
|
item_id=matching_armor.item_id,
|
||||||
name=matching_armor.name,
|
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),
|
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(
|
protection=ProtectionProfile(
|
||||||
impact=matching_armor.protection_impact,
|
impact=armor_set.total_protection.impact,
|
||||||
cut=matching_armor.protection_cut,
|
cut=armor_set.total_protection.cut,
|
||||||
stab=matching_armor.protection_stab,
|
stab=armor_set.total_protection.stab,
|
||||||
burn=matching_armor.protection_burn,
|
burn=armor_set.total_protection.burn,
|
||||||
cold=matching_armor.protection_cold,
|
cold=armor_set.total_protection.cold,
|
||||||
acid=matching_armor.protection_acid,
|
acid=armor_set.total_protection.acid,
|
||||||
electric=matching_armor.protection_electric,
|
electric=armor_set.total_protection.electric,
|
||||||
),
|
),
|
||||||
durability=matching_armor.durability,
|
durability=matching_armor.durability,
|
||||||
decay_per_hp=Decimal("0.05") * (Decimal(1) - Decimal(matching_armor.durability) / Decimal("100000"))
|
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)
|
equipped.equip_piece(piece_copy)
|
||||||
|
|
||||||
# Set full set if all pieces match
|
# Note: We don't call equip_full_set here because:
|
||||||
if self.current_armor_set:
|
# 1. current_armor_set is a NexusArmorSet (API type), not ArmorSet (core type)
|
||||||
equipped.equip_full_set(self.current_armor_set)
|
# 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(
|
return LoadoutConfig(
|
||||||
name=self.loadout_name_edit.text().strip() or "Unnamed",
|
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 --"),
|
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