Esempio n. 1
0
 /// <summary>
 /// マッチしないパターンを削除する
 /// </summary>
 /// <param name="condition"></param>
 public void RemoveNotMatchPattern(ICondition condition)
 {
     for (int i = MonsterSidePattern.Count - 1; i >= 0; i--)
     {
         MonsterSidePattern pattern = MonsterSidePattern[i];
         if (!condition.IsMatch(pattern))
         {
             RemovePattern(pattern);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 指定したパターンを削除する
        /// </summary>
        /// <param name="pattern">削除するパターン</param>
        private void RemovePattern(MonsterSidePattern pattern)
        {
            // この視点から指定したパターンを削除する
            MonsterSidePattern.Remove(pattern);

            // 包含する視点から指定したパターンを削除する
            foreach (Viewpoint child in InclusionViewpoint)
            {
                child.RemovePattern(pattern);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 指定したパターンを削除する
        /// </summary>
        /// <param name="pattern">削除するパターン</param>
        private void RemovePattern(int key)
        {
            // この視点から指定したパターンを削除する
            MonsterSidePattern.Remove(key);

            // 包含する視点から指定したパターンを削除する
            foreach (Viewpoint child in InclusionViewpoint)
            {
                child.RemovePattern(key);
            }

            isCacheEnable = false;
        }
Esempio n. 4
0
        /// <summary>
        /// マッチしないパターンを削除する
        /// </summary>
        /// <param name="condition"></param>
        public void RemoveNotMatchPattern(ICondition condition)
        {
            List <int> keys = new List <int>(MonsterSidePattern.Keys);

            foreach (int key in keys)
            {
                MonsterSidePattern pattern = MonsterSidePattern[key];
                if (!condition.IsMatch(pattern))
                {
                    RemovePattern(key);
                }
            }

            isCacheEnable = false;
        }
Esempio n. 5
0
        /// <summary>
        /// 人狼の数が範囲外のパターンを削除する
        /// </summary>
        /// <param name="agentList">検査するエージェントのリスト</param>
        /// <param name="minNum">人狼の最小数</param>
        /// <param name="maxNum">人狼の最大数</param>
        public void RemovePatternFromWolfNum(List <Agent> agentList, int minNum, int maxNum)
        {
            for (int i = MonsterSidePattern.Count - 1; i >= 0; i--)
            {
                MonsterSidePattern pattern = MonsterSidePattern[i];
                int aliveWolfNum           = 0;

                foreach (Agent agent in agentList)
                {
                    if (pattern.IsExist(agent, Role.WEREWOLF))
                    {
                        aliveWolfNum++;
                    }
                }

                if (aliveWolfNum < minNum || aliveWolfNum > maxNum)
                {
                    RemovePattern(pattern);
                }
            }
        }
Esempio n. 6
0
        //TODO 他編成対応
        /// <summary>
        /// 人外パターンの設定
        /// </summary>
        /// <param name="gameSetting"></param>
        private void SetMonsterSidePattern(GameSetting gameSetting)
        {
            MonsterSidePattern = new List <MonsterSidePattern>();

            // 3狼1狂
            if (gameSetting.RoleNumMap[Role.WEREWOLF] == 3 && gameSetting.RoleNumMap[Role.POSSESSED] == 1)
            {
                for (int wolfAcnt = 1; wolfAcnt <= gameSetting.PlayerNum - 2; wolfAcnt++)
                {
                    for (int wolfBcnt = wolfAcnt + 1; wolfBcnt <= gameSetting.PlayerNum - 1; wolfBcnt++)
                    {
                        for (int wolfCcnt = wolfBcnt + 1; wolfCcnt <= gameSetting.PlayerNum; wolfCcnt++)
                        {
                            List <Agent> wolfAgent = new List <Agent>
                            {
                                Agent.GetAgent(wolfAcnt),
                                Agent.GetAgent(wolfBcnt),
                                Agent.GetAgent(wolfCcnt)
                            };

                            for (int possessedcnt = 1; possessedcnt <= gameSetting.PlayerNum; possessedcnt++)
                            {
                                if (possessedcnt != wolfAcnt && possessedcnt != wolfBcnt && possessedcnt != wolfCcnt)
                                {
                                    List <Agent> posAgent = new List <Agent>
                                    {
                                        Agent.GetAgent(possessedcnt)
                                    };
                                    MonsterSidePattern pattern = new MonsterSidePattern()
                                    {
                                        WerewolfAgent  = wolfAgent,
                                        PossessedAgent = posAgent,
                                    };
                                    MonsterSidePattern.Add(pattern);
                                }
                            }
                        }
                    }
                }
            }

            // 1狼1狂
            if (gameSetting.RoleNumMap[Role.WEREWOLF] == 1 && gameSetting.RoleNumMap[Role.POSSESSED] == 1)
            {
                for (int wolfAcnt = 1; wolfAcnt <= gameSetting.PlayerNum; wolfAcnt++)
                {
                    List <Agent> wolfAgent = new List <Agent>
                    {
                        Agent.GetAgent(wolfAcnt)
                    };
                    for (int possessedcnt = 1; possessedcnt <= gameSetting.PlayerNum; possessedcnt++)
                    {
                        if (possessedcnt != wolfAcnt)
                        {
                            List <Agent> posAgent = new List <Agent>
                            {
                                Agent.GetAgent(possessedcnt)
                            };
                            MonsterSidePattern pattern = new MonsterSidePattern()
                            {
                                WerewolfAgent  = wolfAgent,
                                PossessedAgent = posAgent,
                            };
                            MonsterSidePattern.Add(pattern);
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        //TODO 他編成対応
        /// <summary>
        /// 人外パターンの設定
        /// </summary>
        /// <param name="gameSetting"></param>
        private void SetMonsterSidePattern(GameSetting gameSetting)
        {
            MonsterSidePattern = new Dictionary <int, MonsterSidePattern>(5460);
            int cnt = 0;

            List <Agent> foxAgent = new List <Agent>();

            // 3狼1狂
            if (gameSetting.RoleNumMap[Role.WEREWOLF] == 3 && gameSetting.RoleNumMap[Role.POSSESSED] == 1)
            {
                for (int wolfAcnt = 1; wolfAcnt <= gameSetting.PlayerNum - 2; wolfAcnt++)
                {
                    for (int wolfBcnt = wolfAcnt + 1; wolfBcnt <= gameSetting.PlayerNum - 1; wolfBcnt++)
                    {
                        for (int wolfCcnt = wolfBcnt + 1; wolfCcnt <= gameSetting.PlayerNum; wolfCcnt++)
                        {
                            List <Agent> wolfAgent = new List <Agent>
                            {
                                Agent.GetAgent(wolfAcnt),
                                Agent.GetAgent(wolfBcnt),
                                Agent.GetAgent(wolfCcnt)
                            };

                            for (int possessedcnt = 1; possessedcnt <= gameSetting.PlayerNum; possessedcnt++)
                            {
                                if (possessedcnt != wolfAcnt && possessedcnt != wolfBcnt && possessedcnt != wolfCcnt)
                                {
                                    List <Agent> posAgent = new List <Agent>
                                    {
                                        Agent.GetAgent(possessedcnt)
                                    };

                                    MonsterSidePattern pattern = new MonsterSidePattern(wolfAgent, posAgent, foxAgent);
                                    MonsterSidePattern.Add(cnt++, pattern);
                                }
                            }
                        }
                    }
                }
            }

            // 1狼1狂
            if (gameSetting.RoleNumMap[Role.WEREWOLF] == 1 && gameSetting.RoleNumMap[Role.POSSESSED] == 1)
            {
                for (int wolfAcnt = 1; wolfAcnt <= gameSetting.PlayerNum; wolfAcnt++)
                {
                    List <Agent> wolfAgent = new List <Agent>
                    {
                        Agent.GetAgent(wolfAcnt)
                    };
                    for (int possessedcnt = 1; possessedcnt <= gameSetting.PlayerNum; possessedcnt++)
                    {
                        if (possessedcnt != wolfAcnt)
                        {
                            List <Agent> posAgent = new List <Agent>
                            {
                                Agent.GetAgent(possessedcnt)
                            };
                            MonsterSidePattern pattern = new MonsterSidePattern(wolfAgent, posAgent, foxAgent);
                            MonsterSidePattern.Add(cnt++, pattern);
                        }
                    }
                }
            }
        }