mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
refactor: Update in the last commit of werewolf game
- Reviewed changes: https://github.com/geekan/MetaGPT/pull/1316#discussion_r1624248864
This commit is contained in:
parent
84a240ac8d
commit
73f9b4a961
4 changed files with 4 additions and 4 deletions
|
|
@ -86,7 +86,7 @@ class BasePlayer(Role):
|
|||
# FIXME: hard code to split, restricted为"Moderator"或"Moderator, 角色profile"
|
||||
# Moderator加密发给自己的,意味着要执行角色的特殊动作
|
||||
self.rc.todo = self.special_actions[0]()
|
||||
return self.rc.todo is not None
|
||||
return True
|
||||
|
||||
async def _act(self):
|
||||
# todo为_think时确定的,有两种情况,Speak或Protect
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class Moderator(BasePlayer):
|
|||
else:
|
||||
# 上一轮消息是游戏角色的发言,解析角色的发言
|
||||
self.rc.todo = ParseSpeak()
|
||||
return self.rc.todo is not None
|
||||
return True
|
||||
|
||||
def _init_fields_from_obj(self, obs: dict[str, Union[int, str, list[str]]]):
|
||||
self.game_setup = obs.get("game_setup", "")
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ class Werewolf(BasePlayer):
|
|||
await super()._think()
|
||||
if isinstance(self.rc.todo, Speak):
|
||||
self.rc.todo = Impersonate()
|
||||
return self.rc.todo is not None
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@ class Witch(BasePlayer):
|
|||
self.rc.todo = Poison()
|
||||
else:
|
||||
raise ValueError("Moderator's instructions must include save or poison keyword")
|
||||
return self.rc.todo is not None
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue