Combat foundation complete
This commit is contained in:
@@ -130,6 +130,7 @@ class EnemyTemplate:
|
||||
gold_reward_max: Maximum gold dropped
|
||||
difficulty: Difficulty classification for encounter building
|
||||
tags: Classification tags (e.g., ["humanoid", "goblinoid"])
|
||||
location_tags: Location types where this enemy appears (e.g., ["forest", "dungeon"])
|
||||
image_url: Optional image reference for UI
|
||||
|
||||
Combat-specific attributes:
|
||||
@@ -149,6 +150,7 @@ class EnemyTemplate:
|
||||
gold_reward_max: int = 5
|
||||
difficulty: EnemyDifficulty = EnemyDifficulty.EASY
|
||||
tags: List[str] = field(default_factory=list)
|
||||
location_tags: List[str] = field(default_factory=list)
|
||||
image_url: Optional[str] = None
|
||||
|
||||
# Combat attributes
|
||||
@@ -194,6 +196,10 @@ class EnemyTemplate:
|
||||
"""Check if enemy has a specific tag."""
|
||||
return tag.lower() in [t.lower() for t in self.tags]
|
||||
|
||||
def has_location_tag(self, location_type: str) -> bool:
|
||||
"""Check if enemy can appear at a specific location type."""
|
||||
return location_type.lower() in [t.lower() for t in self.location_tags]
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Serialize enemy template to dictionary.
|
||||
@@ -213,6 +219,7 @@ class EnemyTemplate:
|
||||
"gold_reward_max": self.gold_reward_max,
|
||||
"difficulty": self.difficulty.value,
|
||||
"tags": self.tags,
|
||||
"location_tags": self.location_tags,
|
||||
"image_url": self.image_url,
|
||||
"base_damage": self.base_damage,
|
||||
"crit_chance": self.crit_chance,
|
||||
@@ -259,6 +266,7 @@ class EnemyTemplate:
|
||||
gold_reward_max=data.get("gold_reward_max", 5),
|
||||
difficulty=difficulty,
|
||||
tags=data.get("tags", []),
|
||||
location_tags=data.get("location_tags", []),
|
||||
image_url=data.get("image_url"),
|
||||
base_damage=data.get("base_damage", 5),
|
||||
crit_chance=data.get("crit_chance", 0.05),
|
||||
|
||||
Reference in New Issue
Block a user