Combat foundation complete
This commit is contained in:
@@ -177,6 +177,46 @@ class EnemyLoader:
|
||||
if enemy.has_tag(tag)
|
||||
]
|
||||
|
||||
def get_enemies_by_location(
|
||||
self,
|
||||
location_type: str,
|
||||
difficulty: Optional[EnemyDifficulty] = None
|
||||
) -> List[EnemyTemplate]:
|
||||
"""
|
||||
Get all enemies that can appear at a specific location type.
|
||||
|
||||
This is used by the encounter generator to find location-appropriate
|
||||
enemies for random encounters.
|
||||
|
||||
Args:
|
||||
location_type: Location type to filter by (e.g., "forest", "dungeon",
|
||||
"town", "wilderness", "crypt", "ruins", "road")
|
||||
difficulty: Optional difficulty filter to narrow results
|
||||
|
||||
Returns:
|
||||
List of EnemyTemplate instances that can appear at the location
|
||||
"""
|
||||
if not self._loaded:
|
||||
self.load_all_enemies()
|
||||
|
||||
candidates = [
|
||||
enemy for enemy in self._enemy_cache.values()
|
||||
if enemy.has_location_tag(location_type)
|
||||
]
|
||||
|
||||
# Apply difficulty filter if specified
|
||||
if difficulty is not None:
|
||||
candidates = [e for e in candidates if e.difficulty == difficulty]
|
||||
|
||||
logger.debug(
|
||||
"Enemies found for location",
|
||||
location_type=location_type,
|
||||
difficulty=difficulty.value if difficulty else None,
|
||||
count=len(candidates)
|
||||
)
|
||||
|
||||
return candidates
|
||||
|
||||
def get_random_enemies(
|
||||
self,
|
||||
count: int = 1,
|
||||
|
||||
Reference in New Issue
Block a user