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