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