示例#1
0
        private Tech AISelectPartialTech(StrategicAI ai)
        {
            Tech tech1 = (Tech)null;

            if (AIResearchFramework.AIGetResearchingTech(ai) == null)
            {
                List <Tech> techList = AIResearchFramework.AISelectAvailableTechs(ai, new AIResearchModes?(), new TechFamilies?());
                if (techList.Count > 0)
                {
                    int num = 0;
                    foreach (Tech tech2 in techList)
                    {
                        int techProgress = AIResearchFramework.AIGetTechProgress(ai, tech2);
                        if (techProgress > num)
                        {
                            num   = techProgress;
                            tech1 = tech2;
                        }
                    }
                }
            }
            if (this._log != null && tech1 != null)
            {
                this._log.Print(string.Format("Resuming {0}", (object)tech1.Id));
            }
            return(tech1);
        }
示例#2
0
        private Tech AISelectDefaultTechPass(
            StrategicAI ai,
            AIResearchModes?mode,
            TechFamilies?family)
        {
            List <Tech> list = AIResearchFramework.AISelectAvailableTechs(ai, mode, family).OrderBy <Tech, int>((Func <Tech, int>)(x => AIResearchFramework.AICalcTechCost(ai, x))).ToList <Tech>();

            if (list.Count > 0)
            {
                list.Insert(0, list[0]);
            }
            if (this._log != null)
            {
                this._log.Print(string.Format(" {0} prospects: ", mode.HasValue ? (object)string.Format("{0}/{1}", (object)AIResearchFramework.AIGetResearchModeSymbol(mode.Value), (object)ai.Game.GameDatabase.GetAIInfo(ai.Player.ID).Stance.ToString()) : (object)"ALL"));
                foreach (Tech tech in list)
                {
                    int num = AIResearchFramework.AICalcTechCost(ai, tech);
                    this._log.Print(string.Format("{0} ({1}); ", (object)tech.Id, (object)num));
                }
            }
            return(AIResearchFramework.AISelectFavoriteTech(ai, (IList <Tech>)list));
        }