fix talk no recent events bug
This commit is contained in:
@@ -58,7 +58,9 @@ class Catch(TimedAction):
|
||||
# 覆盖为新的灵兽
|
||||
self.avatar.spirit_animal = SpiritAnimal(name=target.name, realm=target.realm)
|
||||
# 记录结果供 finish 生成事件
|
||||
self._caught_result = (str(target.name), target.realm)
|
||||
self._caught_result = (str(target.name), target.realm, "success")
|
||||
else:
|
||||
self._caught_result = (None, None, "fail")
|
||||
|
||||
def can_start(self) -> tuple[bool, str]:
|
||||
# 仅百兽宗
|
||||
@@ -85,11 +87,14 @@ class Catch(TimedAction):
|
||||
|
||||
def finish(self) -> list[Event]:
|
||||
res = self._caught_result
|
||||
if not (isinstance(res, tuple) and len(res) == 2):
|
||||
if not (isinstance(res, tuple) and len(res) == 3):
|
||||
return []
|
||||
target_name, target_realm = res[0], res[1]
|
||||
realm_label = target_realm.value
|
||||
text = f"{self.avatar.name} 御兽成功,{realm_label}境的{target_name}成为其灵兽"
|
||||
return [Event(self.world.month_stamp, text, related_avatars=[self.avatar.id])]
|
||||
target_name, target_realm, result = res[0], res[1], res[2]
|
||||
if result == "fail":
|
||||
return [Event(self.world.month_stamp, f"{self.avatar.name} 御兽失败", related_avatars=[self.avatar.id])]
|
||||
else:
|
||||
realm_label = target_realm.value
|
||||
text = f"{self.avatar.name} 御兽成功,{realm_label}境的{target_name}成为其灵兽"
|
||||
return [Event(self.world.month_stamp, text, related_avatars=[self.avatar.id])]
|
||||
|
||||
|
||||
|
||||
@@ -44,12 +44,17 @@ class Conversation(MutualAction):
|
||||
}
|
||||
# 可能的后天关系(转中文名,给模板阅读)
|
||||
possible_relations = [relation_display_names[r] for r in get_possible_post_relations(self.avatar, target_avatar)]
|
||||
# 历史上下文:仅双方共同经历的最近事件(与 MutualAction 对齐)
|
||||
n = CONFIG.social.event_context_num
|
||||
em = self.world.event_manager
|
||||
pair_recent_events = [str(e) for e in em.get_events_between(self.avatar.id, target_avatar.id, limit=n)]
|
||||
return {
|
||||
"avatar_infos": avatar_infos,
|
||||
"avatar_name_1": avatar_name_1,
|
||||
"avatar_name_2": avatar_name_2,
|
||||
"can_into_relation": bool(can_into_relation),
|
||||
"possible_relations": possible_relations,
|
||||
"recent_events": pair_recent_events,
|
||||
}
|
||||
|
||||
def can_start(self, target_avatar: "Avatar|str|None" = None, **kwargs) -> tuple[bool, str]:
|
||||
|
||||
@@ -33,14 +33,13 @@ social:
|
||||
defined_avatar:
|
||||
surname: 丰川
|
||||
given_name: 祥子
|
||||
level: 29
|
||||
level: 31
|
||||
age: 18
|
||||
gender: 女
|
||||
sect: 百兽宗
|
||||
appearance: 10
|
||||
personas:
|
||||
- 穿越者
|
||||
- 开放
|
||||
- 随性
|
||||
- 外向
|
||||
treasure: 万魂幡
|
||||
technique: 九天淬体雷诀
|
||||
|
||||
@@ -29,4 +29,4 @@ id,name,exclusion_ids,desc,weight,condition
|
||||
27,腼腆,26,你对待和他人结为道侣或者双修比较谨慎,1,
|
||||
28,舔狗,13;14;22;27,你对异性中外貌出众者格外友善,倾向主动接近、帮助与合作。,1,
|
||||
29,嫉妒,11;23,你对在修为、外貌或财富等方面远超于你的人容易产生敌意,更倾向对其冷淡、挑衅或打压。,1,
|
||||
30,穿越者,,你来自现代社会,怀念现代社会的一切,希望调查清楚你来的原因,早日回到现代,你的思考方式都是现代化的,1000,
|
||||
30,穿越者,,你来自现代社会,怀念现代社会的一切,你的思考(thinking)必须是现代化的思考,1000,
|
||||
|
Can't render this file because it contains an unexpected character in line 26 and column 121.
|
@@ -8,6 +8,9 @@
|
||||
两者是否可能进入某种关系:{can_into_relation}。注意,如果为True,也不代表一定要进入某种关系。这都由你来判断。
|
||||
{avatar_name_2}可能相对于{avatar_name_1}的身份为: {possible_relations}
|
||||
|
||||
最近事件:
|
||||
{recent_events}
|
||||
|
||||
注意,只返回json格式的结果。
|
||||
只返回{avatar_name_2}的行动,格式为:
|
||||
{{
|
||||
|
||||
Reference in New Issue
Block a user