Пример #1
0
 /// <summary>
 /// プレイヤーの囁きを返す
 /// </summary>
 /// <returns>発話文字列</returns>
 public virtual string Whisper()
 {
     ChooseAttackVoteCandidate();
     if (attackVoteCandidate != null && attackVoteCandidate != declaredAttackVoteCandidate)
     {
         WhisperQueue.Enqueue(new Content(new AttackContentBuilder(attackVoteCandidate)));
         declaredAttackVoteCandidate = attackVoteCandidate;
     }
     return(WhisperQueue.Count > 0 ? WhisperQueue.Dequeue().Text : Utterance.SKIP);
 }
Пример #2
0
        /// <summary>
        /// プレイヤーの発言を返す
        /// </summary>
        /// <returns>発言の文字列</returns>
        /// <remarks>
        /// nullはSkipを意味する
        /// </remarks>
#else
        /// <summary>
        /// Returns this player's talk.
        /// </summary>
        /// <returns>The string representing this player's talk.</returns>
        /// <remarks>
        /// Null means Skip.
        /// </remarks>
#endif
        public override string Talk()
        {
            talkTurn++;
            if (fakeRole != Role.VILLAGER)
            {
                if (!isCameout)
                {
                    // 他の人狼のカミングアウト状況を調べて騙る役職が重複しないようにする
                    int fakeSeerCO   = werewolves.Where(a => a != Me && GetCoRole(a) == Role.SEER).Count();
                    int fakeMediumCO = werewolves.Where(a => a != Me && GetCoRole(a) == Role.MEDIUM).Count();
                    if ((fakeRole == Role.SEER && fakeSeerCO > 0) || (fakeRole == Role.MEDIUM && fakeMediumCO > 0))
                    {
                        fakeRole = Role.VILLAGER; // 潜伏
                        WhisperQueue.Enqueue(new Content(new ComingoutContentBuilder(Me, Role.VILLAGER)));
                    }
                    else
                    {
                        // 対抗カミングアウトがある場合,今日カミングアウトする
                        if (humans.Where(a => GetCoRole(a) == fakeRole).Count() > 0)
                        {
                            comingoutDay = Day;
                        }
                        // カミングアウトするタイミングになったらカミングアウト
                        if (Day >= comingoutDay && talkTurn >= comingoutTurn)
                        {
                            isCameout = true;
                            TalkQueue.Enqueue(new Content(new ComingoutContentBuilder(Me, fakeRole)));
                        }
                    }
                }
                // カミングアウトしたらこれまでの偽判定結果をすべて公開
                else
                {
                    while (fakeJudgeQueue.Count > 0)
                    {
                        Judge judge = fakeJudgeQueue.Dequeue();
                        if (fakeRole == Role.SEER)
                        {
                            TalkQueue.Enqueue(new Content(new DivinedResultContentBuilder(judge.Target, judge.Result)));
                        }
                        else if (fakeRole == Role.MEDIUM)
                        {
                            TalkQueue.Enqueue(new Content(new IdentContentBuilder(judge.Target, judge.Result)));
                        }
                    }
                }
            }
            return(base.Talk());
        }
Пример #3
0
        /// <summary>
        /// ゲーム情報更新の際に呼ばれる
        /// </summary>
        /// <param name="gameInfo">最新のゲーム情報</param>
#else
        /// <summary>
        /// Called when the game information is updated.
        /// </summary>
        /// <param name="gameInfo">The current information of this game.</param>
#endif
        public override void Update(GameInfo gameInfo)
        {
            base.Update(gameInfo);
            // 占い/霊媒結果が嘘の場合,裏切り者候補
            possessed = DivinationList.Concat(IdentList)
                        .Where(j => !werewolves.Contains(j.Agent) &&
                               ((humans.Contains(j.Target) && j.Result == Species.WEREWOLF) ||
                                (werewolves.Contains(j.Target) && j.Result == Species.HUMAN)))
                        .Select(j => j.Agent).Distinct().Shuffle().FirstOrDefault();
            if (possessed != null && !possessedList.Contains(possessed))
            {
                possessedList.Add(possessed);
                WhisperQueue.Enqueue(new Content(new EstimateContentBuilder(possessed, Role.POSSESSED)));
            }
        }
Пример #4
0
        /// <summary>
        /// ゲーム開始時に呼ばれる
        /// </summary>
        /// <param name="gameInfo">最新のゲーム情報</param>
        /// <param name="gameSetting">ゲーム設定</param>
#else
        /// <summary>
        /// Called when the game started.
        /// </summary>
        /// <param name="gameInfo">The current information of this game.</param>
        /// <param name="gameSetting">The setting of this game.</param>
#endif
        public override void Initialize(GameInfo gameInfo, GameSetting gameSetting)
        {
            base.Initialize(gameInfo, gameSetting);
            numWolves  = gameSetting.RoleNumMap[Role.WEREWOLF];
            werewolves = gameInfo.RoleMap.Keys.ToList();
            humans     = AliveOthers.Where(a => !werewolves.Contains(a)).ToList();
            // ランダムに騙る役職を決める
            fakeRole = new Role[] { Role.VILLAGER, Role.SEER, Role.MEDIUM }.
            Where(r => gameInfo.ExistingRoleList.Contains(r)).Shuffle().First();
            WhisperQueue.Enqueue(new Content(new ComingoutContentBuilder(Me, fakeRole)));
            // 1~3日目からランダムにカミングアウトする
            comingoutDay = new int[] { 1, 2, 3 }.Shuffle().First();
            // 第0~4ターンからランダムにカミングアウトする
            comingoutTurn = new int[] { 0, 1, 2, 3, 4 }.Shuffle().First();
            isCameout     = false;
            fakeJudgeList.Clear();
            fakeJudgeQueue.Clear();
            judgedAgents.Clear();
            possessedList.Clear();
        }
Пример #5
0
 /// <summary>
 /// 新しい日が始まるときに呼ばれる
 /// </summary>
 public virtual void DayStart()
 {
     CanTalk    = true;
     CanWhisper = false;
     if (CurrentGameInfo.Role == Role.WEREWOLF)
     {
         CanWhisper = true;
     }
     TalkQueue.Clear();
     WhisperQueue.Clear();
     declaredVoteCandidate       = null;
     voteCandidate               = null;
     declaredAttackVoteCandidate = null;
     attackVoteCandidate         = null;
     talkListHead = 0;
     // 前日に追放されたエージェントを登録
     AddExecutedAgent(CurrentGameInfo.ExecutedAgent);
     // 昨夜に死亡した(襲撃された)エージェントを登録
     if (CurrentGameInfo.LastDeadAgentList.Count > 0)
     {
         AddKilledAgent(CurrentGameInfo.LastDeadAgentList[0]);
     }
 }
Пример #6
0
        /// <summary>
        /// 新しい日が始まるときに呼ばれる
        /// </summary>
#else
        /// <summary>
        /// Called when the day started.
        /// </summary>
#endif
        public override void DayStart()
        {
            base.DayStart();
            talkTurn = -1;
            if (Day == 0)
            {
                WhisperQueue.Enqueue(new Content(new ComingoutContentBuilder(Me, fakeRole)));
            }
            // 偽の判定
            else
            {
                Judge fakeJudge = GetFakeJudge(fakeRole);
                if (fakeJudge != null)
                {
                    fakeJudgeList.Add(fakeJudge);
                    fakeJudgeQueue.Enqueue(fakeJudge);
                    if (fakeRole == Role.SEER)
                    {
                        judgedAgents.Add(fakeJudge.Target);
                    }
                }
            }
        }