add plant and animal

This commit is contained in:
bridge
2025-12-04 21:25:55 +08:00
parent 06e43f2add
commit bdf78bc3d6
17 changed files with 250 additions and 133 deletions

View File

@@ -47,6 +47,7 @@ class Animal:
def get_structured_info(self) -> dict:
items_info = [item.get_structured_info() for item in self.items]
return {
"id": str(self.id),
"name": self.name,
"desc": self.desc,
"grade": self.realm.value,

View File

@@ -149,9 +149,8 @@ EXTRA_MOVE_STEP = "extra_move_step"
结算: src/classes/action/move.py
说明: 每次移动时可以多移动的格子数。
数值参考:
- 量: 1
- 量: 2
- 大量: 3+
- 量: 1
- 量: 2
"""
# --- 捕捉相关 ---

View File

@@ -27,6 +27,7 @@ class Item:
def get_structured_info(self) -> dict:
return {
"id": str(self.id),
"name": self.name,
"desc": self.desc,
"grade": self.realm.value,

View File

@@ -47,6 +47,7 @@ class Plant:
def get_structured_info(self) -> dict:
items_info = [item.get_structured_info() for item in self.items]
return {
"id": str(self.id),
"name": self.name,
"desc": self.desc,
"grade": self.realm.value,

View File

@@ -73,7 +73,7 @@ class Region(ABC):
def get_structured_info(self) -> dict:
return {
"id": self.id,
"id": str(self.id),
"name": self.name,
"desc": self.desc,
"type": self.get_region_type(),
@@ -156,8 +156,14 @@ class NormalRegion(Region):
def get_structured_info(self) -> dict:
info = super().get_structured_info()
info["type_name"] = "普通区域"
info["animals"] = [a.get_structured_info() for a in self.animals]
info["plants"] = [p.get_structured_info() for p in self.plants]
# Fix: Return the actual structure instead of just calling get_structured_info on elements but never assigning
# The previous implementation (if it existed) was inherited from base or incorrect
# Assuming animals and plants are populated in __post_init__
info["animals"] = [a.get_structured_info() for a in self.animals] if self.animals else []
info["plants"] = [p.get_structured_info() for p in self.plants] if self.plants else []
return info