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:
Kaushal_26 2024-06-03 18:20:17 +05:30
parent 84a240ac8d
commit 73f9b4a961
4 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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", "")

View file

@ -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

View file

@ -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