fix pytest
This commit is contained in:
@@ -87,7 +87,7 @@ class Avatar(
|
||||
tile: Optional[Tile] = None
|
||||
|
||||
root: Root = field(default_factory=lambda: random.choice(list(Root)))
|
||||
personas: List[Persona] = field(default_factory=list)
|
||||
personas: List[Persona] = field(default=None) # type: ignore
|
||||
technique: Technique | None = None
|
||||
_pending_events: List[Event] = field(default_factory=list)
|
||||
current_action: Optional[ActionInstance] = None
|
||||
@@ -325,7 +325,7 @@ class Avatar(
|
||||
max_hp = HP_MAX_BY_REALM.get(self.cultivation_progress.realm, 100)
|
||||
self.hp = HP(max_hp, max_hp)
|
||||
|
||||
if not self.personas:
|
||||
if self.personas is None:
|
||||
self.personas = get_random_compatible_personas(persona_num, avatar=self)
|
||||
|
||||
if self.technique is None:
|
||||
|
||||
@@ -16,7 +16,7 @@ from src.classes.calendar import create_month_stamp, Year, Month
|
||||
@pytest.fixture
|
||||
def target_avatar(base_world):
|
||||
"""创建第二个角色作为赠送目标"""
|
||||
return Avatar(
|
||||
av = Avatar(
|
||||
world=base_world,
|
||||
name="TargetNPC",
|
||||
id=get_avatar_id(),
|
||||
@@ -25,8 +25,11 @@ def target_avatar(base_world):
|
||||
gender=Gender.FEMALE,
|
||||
pos_x=0,
|
||||
pos_y=0,
|
||||
personas=[], # 避免随机特质影响价格测试
|
||||
personas=[], # 显式清空特质,避免随机特质影响价格测试
|
||||
)
|
||||
# 强制重算一次效果,确保属性干净
|
||||
av.recalc_effects()
|
||||
return av
|
||||
|
||||
@pytest.fixture
|
||||
def gift_action(dummy_avatar, base_world):
|
||||
|
||||
Reference in New Issue
Block a user