public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ContextObject as AIPlayer_MajorEmpire; if (aiplayer_MajorEmpire == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiplayer_MajorEmpire.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } Diagnostics.Assert(base.ParentGroup != null); this.netEmpireMoneyAgent = (base.ParentGroup.GetAgent("NetEmpireMoney") as SimulationNormalizedAgent); Diagnostics.Assert(this.netEmpireMoneyAgent != null); this.departmentOfScience = this.empire.GetAgency <DepartmentOfScience>(); IGameService service = Services.GetService <IGameService>(); this.game = (service.Game as global::Game); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.empire, this); }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); Diagnostics.Assert(base.ParentGroup != null && base.ParentGroup.Parent != null); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ParentGroup.Parent.ContextObject as AIPlayer_MajorEmpire; Diagnostics.Assert(aiplayer_MajorEmpire != null); this.Empire = aiplayer_MajorEmpire.MajorEmpire; if (this.Empire == null) { Diagnostics.LogError("The agent's parent context object is not an empire"); return; } this.EmpireWhichReceives = (base.ParentGroup.ContextObject as global::Empire); if (this.EmpireWhichReceives == null) { Diagnostics.LogError("The agent context object is not an empire"); return; } this.aiEntityEmpire = aiplayer_MajorEmpire.GetEntity <AIEntity_Empire>(); if (this.aiEntityEmpire == null) { Diagnostics.LogError("The AIPlayer has no ai entity empire."); return; } InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.aiEntityEmpire.Empire, this); }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); City city = base.ContextObject as City; if (city == null) { Diagnostics.LogError("The agent context object is not a city"); return; } Diagnostics.Assert(city.Empire != null); this.departmentOfTheTreasury = city.Empire.GetAgency <DepartmentOfTheTreasury>(); Diagnostics.Assert(this.departmentOfTheTreasury != null); DepartmentOfIndustry agency = city.Empire.GetAgency <DepartmentOfIndustry>(); Diagnostics.Assert(agency != null); this.aiPlayer = (base.ParentGroup.Parent.ContextObject as AIPlayer_MajorEmpire); if (this.aiPlayer == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.constructionQueue = agency.GetConstructionQueue(city); Diagnostics.Assert(this.constructionQueue != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(city.Empire, this); }
public override IEnumerator Initialize(AIEntity aiEntity) { yield return(base.Initialize(aiEntity)); IGameService gameService = Services.GetService <IGameService>(); this.seasonService = new WeakReference <ISeasonService>(gameService.Game.Services.GetService <ISeasonService>()); this.aiParameterDatabase = Databases.GetDatabase <AIParameterDatatableElement>(false); this.aiParameterConverterDatabase = Databases.GetDatabase <AIParameterConverter>(false); this.aiLayerAttitude = base.AIEntity.GetLayer <AILayer_Attitude>(); Diagnostics.Assert(this.aiLayerAttitude != null); this.personalityHelper = AIScheduler.Services.GetService <IPersonalityAIHelper>(); Diagnostics.Assert(this.personalityHelper != null); IDatabase <SeasonEffectDefinition> seasonEffectDefinitions = Databases.GetDatabase <SeasonEffectDefinition>(false); foreach (SeasonEffectDefinition seasonEffectDefinition in seasonEffectDefinitions) { this.InitializeAIEvaluableElement(seasonEffectDefinition); } InterpreterContext interpreterContext = new InterpreterContext(base.AIEntity.Empire.SimulationObject); interpreterContext.Register("Empire", base.AIEntity.Empire); this.elementEvaluator = new ElementEvaluator <SeasonEffect, InterpreterContext>(this, interpreterContext); this.elementEvaluator.ContextWeightDelegate = new ElementEvaluator <SeasonEffect, InterpreterContext> .ContextWeightFunc(this.DecisionParameterContextModifier); base.AIEntity.RegisterPass(AIEntity.Passes.CreateLocalNeeds.ToString(), "AILayer_Altar_CreateLocalNeedsPass", new AIEntity.AIAction(this.CreateLocalNeeds), this, new StaticString[] { "LayerAmasEmpire_CreateLocalNeedsPass" }); base.AIEntity.RegisterPass(AIEntity.Passes.EvaluateNeeds.ToString(), "AILayer_Altar_EvaluateNeedsPass", new AIEntity.AIAction(this.EvaluateNeeds), this, new StaticString[0]); base.AIEntity.RegisterPass(AIEntity.Passes.ExecuteNeeds.ToString(), "AILayer_Altar_ExecuteNeedsPass", new AIEntity.AIAction(this.ExecuteNeeds), this, new StaticString[0]); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(base.AIEntity.Empire, this); yield break; }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiPlayer = base.ContextObject as AIPlayer_MajorEmpire; if (aiPlayer == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiPlayer.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } Diagnostics.Assert(this.empire != null); this.departmentOfTheInterior = this.empire.GetAgency <DepartmentOfTheInterior>(); Diagnostics.Assert(this.departmentOfTheInterior != null); this.departmentOfTheTreasury = this.empire.GetAgency <DepartmentOfTheTreasury>(); Diagnostics.Assert(this.departmentOfTheTreasury != null); DepartmentOfIndustry agency = this.empire.GetAgency <DepartmentOfIndustry>(); Diagnostics.Assert(agency != null); DepartmentOfIndustry.ConstructibleElement[] availableConstructibleElements = ((IConstructibleElementDatabase)agency).GetAvailableConstructibleElements(new StaticString[] { DistrictImprovementDefinition.ReadOnlyCategory }); Diagnostics.Assert(availableConstructibleElements != null); this.districtImprovement = Array.Find <DepartmentOfIndustry.ConstructibleElement>(availableConstructibleElements, (DepartmentOfIndustry.ConstructibleElement element) => element.Name == aiPlayer.AIData_Faction.DistrictImprovement); Diagnostics.Assert(this.districtImprovement != null && this.districtImprovement.Costs != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.empire, this); }
protected internal override void Initialize(AIEntity aiEntity) { base.Initialize(aiEntity); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(base.Empire, this); this.departmentOfEducation = base.Empire.GetAgency <DepartmentOfEducation>(); this.constructibleElementHelper = AIScheduler.Services.GetService <IConstructibleElementAIHelper>(); this.synchronousJobRepository = AIScheduler.Services.GetService <ISynchronousJobRepositoryAIHelper>(); }
public override IEnumerator Initialize(AIEntity aiEntity) { yield return(base.Initialize(aiEntity)); base.AIEntity.RegisterPass(AIEntity.Passes.CreateLocalNeeds.ToString(), "AILayer_AccountManager_CreateLocalNeedsPass", new AIEntity.AIAction(this.CreateLocalNeeds), this, new StaticString[] { "AILayer_Economy_CreateLocalNeeds_ParseEvaluableMessage" }); base.AIEntity.RegisterPass(AIEntity.Passes.ExecuteNeeds.ToString(), "AILayer_AccountManager_ExecuteNeedsPass", new AIEntity.AIAction(this.ExecuteNeeds), this, new StaticString[0]); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(base.AIEntity.Empire, this); yield break; }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ContextObject as AIPlayer_MajorEmpire; if (aiplayer_MajorEmpire == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiplayer_MajorEmpire.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } this.aiEntityEmpire = aiplayer_MajorEmpire.GetEntity <AIEntity_Empire>(); Diagnostics.Assert(this.aiEntityEmpire != null); Diagnostics.Assert(base.ParentGroup != null); this.netEmpireMoneyAgent = (base.ParentGroup.GetAgent("NetEmpireMoney") as SimulationNormalizedAgent); Diagnostics.Assert(this.netEmpireMoneyAgent != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.aiEntityEmpire.Empire, this); }
public override IEnumerator Initialize(AIEntity aiEntity) { yield return(base.Initialize(aiEntity)); this.navyLayer = base.AIEntity.GetLayer <AILayer_Navy>(); this.endTurnService = Services.GetService <IEndTurnService>(); base.AIEntity.RegisterPass(AIEntity.Passes.CreateLocalNeeds.ToString(), "AILayer_UnitRecruitment_CreateLocalNeedsPass", new AIEntity.AIAction(this.CreateLocalNeeds), this, new StaticString[] { "AILayerArmyRecruitment_CreateLocalNeedsPass" }); base.AIEntity.RegisterPass(AIEntity.Passes.EvaluateNeeds.ToString(), "AILayer_UnitRecruitment_EvaluateNeedPass", new AIEntity.AIAction(this.CreateLocalNeeds), this, new StaticString[0]); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(base.AIEntity.Empire, this); this.LandRecruiter = new Recruiter(); this.LandRecruiter.AIEntity = base.AIEntity; this.LandRecruiter.UnitDesignFilter = new Func <UnitDesign, bool>(this.UnitDesignFilter_LandMilitaryUnit); this.LandRecruiter.Initialize(); this.NavalRecruiter = new Recruiter(); this.NavalRecruiter.AIEntity = base.AIEntity; this.NavalRecruiter.UnitDesignFilter = new Func <UnitDesign, bool>(this.UnitDesignFilter_NavyMilitaryUnit); this.NavalRecruiter.Initialize(); this.VictoryLayer = base.AIEntity.GetLayer <AILayer_Victory>(); this.ColonizationLayer = base.AIEntity.GetLayer <AILayer_Colonization>(); yield break; }
public virtual IEnumerator Load() { InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.AIEntity.Empire, this); yield break; }