add plant and animal
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -149,9 +149,8 @@ EXTRA_MOVE_STEP = "extra_move_step"
|
||||
结算: src/classes/action/move.py
|
||||
说明: 每次移动时可以多移动的格子数。
|
||||
数值参考:
|
||||
- 微量: 1
|
||||
- 中量: 2
|
||||
- 大量: 3+
|
||||
- 中量: 1
|
||||
- 大量: 2
|
||||
"""
|
||||
|
||||
# --- 捕捉相关 ---
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user