Feat/relation (#139)
* update relation * feat: add relation_type to avatar info structure and update related components - Added `relation_type` to the avatar structured info in `info_presenter.py`. - Updated `AvatarDetail.vue` to utilize the new `relation_type` for displaying avatar relationships. - Modified `RelationRow.vue` to accept `type` as a prop for enhanced relationship representation. - Updated `core.ts` to include `relation_type` in the `RelationInfo` interface. Closes #
This commit is contained in:
@@ -37,7 +37,7 @@ if TYPE_CHECKING:
|
||||
|
||||
from src.classes.calendar import MonthStamp
|
||||
from src.classes.event import Event
|
||||
from src.classes.relation import Relation
|
||||
from src.classes.relation.relation import Relation
|
||||
from src.utils.config import CONFIG
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from src.classes.calendar import MonthStamp
|
||||
from src.classes.avatar import Avatar
|
||||
from src.classes.event import Event
|
||||
from src.classes.sect import sects_by_id, Sect
|
||||
from src.classes.relation import Relation
|
||||
from src.classes.relation.relation import Relation
|
||||
from src.sim.simulator import Simulator
|
||||
from src.run.load_map import load_cultivation_world_map
|
||||
from src.utils.config import CONFIG
|
||||
|
||||
@@ -14,7 +14,7 @@ from src.classes.age import Age
|
||||
from src.classes.name import get_random_name_for_sect, pick_surname_for_sect, get_random_name_with_surname
|
||||
from src.utils.id_generator import get_avatar_id
|
||||
from src.classes.sect import Sect, sects_by_id, sects_by_name
|
||||
from src.classes.relation import Relation
|
||||
from src.classes.relation.relation import Relation
|
||||
from src.classes.technique import get_technique_by_sect, attribute_to_root, Technique, techniques_by_id, techniques_by_name
|
||||
from src.classes.weapon import Weapon, weapons_by_id, weapons_by_name
|
||||
from src.classes.auxiliary import Auxiliary, auxiliaries_by_id, auxiliaries_by_name
|
||||
|
||||
@@ -366,7 +366,7 @@ class Simulator:
|
||||
"""
|
||||
关系演化阶段:检查并处理满足条件的角色关系变化
|
||||
"""
|
||||
from src.classes.relation_resolver import RelationResolver
|
||||
from src.classes.relation.relation_resolver import RelationResolver
|
||||
|
||||
pairs_to_resolve = []
|
||||
processed_pairs = set() # (id1, id2) id1 < id2
|
||||
@@ -477,9 +477,26 @@ class Simulator:
|
||||
# 14. 处理剩余阶段的交互计数
|
||||
self._phase_handle_interactions(events, processed_event_ids)
|
||||
|
||||
# 15. 归档与时间推进
|
||||
# 15. (每年1月) 更新计算关系 (二阶关系)
|
||||
self._phase_update_calculated_relations()
|
||||
|
||||
# 16. 归档与时间推进
|
||||
return self._finalize_step(events)
|
||||
|
||||
def _phase_update_calculated_relations(self):
|
||||
"""
|
||||
每年 1 月刷新全服角色的二阶关系缓存
|
||||
"""
|
||||
# 仅在 1 月执行
|
||||
if self.world.month_stamp.get_month() != Month.JANUARY:
|
||||
return
|
||||
|
||||
from src.classes.relation.relations import update_second_degree_relations
|
||||
living_avatars = self.world.avatar_manager.get_living_avatars()
|
||||
|
||||
for avatar in living_avatars:
|
||||
update_second_degree_relations(avatar)
|
||||
|
||||
def _finalize_step(self, events: list[Event]) -> list[Event]:
|
||||
"""
|
||||
本轮步进的最终归档:去重、入库、打日志、推进时间。
|
||||
|
||||
Reference in New Issue
Block a user