fix(armor): add decay_per_hp field and ClassVar constants to ArmorPiece

- Added decay_per_hp field for custom economy per piece
- Added BASE_DECAY_FACTOR and MAX_DURABILITY as ClassVar
- Added ClassVar to typing imports
This commit is contained in:
LemonNexus 2026-02-09 11:22:35 +00:00
parent 8e26602069
commit 30229a8ce3
1 changed files with 6 additions and 5 deletions

View File

@ -13,7 +13,7 @@ Implements Entropia Universe armor mechanics:
from dataclasses import dataclass, field
from decimal import Decimal
from typing import Optional, Dict, List, Tuple
from typing import Optional, Dict, List, Tuple, ClassVar
from enum import Enum, auto
@ -232,14 +232,15 @@ class ArmorPiece:
protection: ProtectionProfile = field(default_factory=ProtectionProfile)
durability: int = 2000 # Durability affects economy
weight: Decimal = Decimal("1.0") # Weight in kg
# Base decay factor: 0.05 PEC per HP (20 hp/pec standard)
BASE_DECAY_FACTOR: Decimal = Decimal("0.05")
MAX_DURABILITY: int = 100000
decay_per_hp: Decimal = Decimal("0.05") # PEC per HP absorbed (0.05 = 20 hp/pec)
# Optional plate attachment
attached_plate: Optional[ArmorPlate] = None
# Class constants (not instance fields)
BASE_DECAY_FACTOR: ClassVar[Decimal] = Decimal("0.05")
MAX_DURABILITY: ClassVar[int] = 100000
def get_base_protection(self) -> ProtectionProfile:
"""Get base protection without plate."""
return self.protection