Exemple #1
0
 public NavyTask_Takeover(AILayer_Navy navyLayer, Fortress fortress) : base(navyLayer)
 {
     base.TargetGuid       = fortress.GUID;
     this.FortressPosition = fortress.WorldPosition;
     base.Behavior         = new NavyBehavior_Interception();
     base.Behavior.Initialize();
 }
    public NavyTask_Interception(AILayer_Navy navyLayer) : base(navyLayer)
    {
        base.Behavior = new NavyBehavior_Interception();
        base.Behavior.Initialize();
        IGameService service = Services.GetService <IGameService>();

        this.worldPositionService = service.Game.Services.GetService <IWorldPositionningService>();
        this.aiDataRepository     = AIScheduler.Services.GetService <IAIDataRepositoryAIHelper>();
        this.visibilityService    = service.Game.Services.GetService <IVisibilityService>();
    }
    public NavyTask_FillFortress(AILayer_Navy navyLayer, NavyFortress fortress) : base(navyLayer)
    {
        base.TargetGuid   = fortress.Garrison.GUID;
        this.NavyFortress = fortress;
        base.Behavior     = new NavyBehavior_Reinforcement();
        base.Behavior.Initialize();
        IGameService service = Services.GetService <IGameService>();

        this.worldPositionService = service.Game.Services.GetService <IWorldPositionningService>();
    }
    public NavyTasks_Blitz(AILayer_Navy navyLayer, City city) : base(navyLayer)
    {
        this.Target     = city;
        base.TargetGuid = city.GUID;
        base.Behavior   = new NavyBehavior_Blitz();
        base.Behavior.Initialize();
        IGameService service = Services.GetService <IGameService>();

        this.worldPositionService = service.Game.Services.GetService <IWorldPositionningService>();
    }
Exemple #5
0
    public NavyFortress(AILayer_Navy navyLayer, Fortress fortress)
    {
        this.Fortress  = fortress;
        base.Garrison  = fortress;
        this.navyLayer = navyLayer;
        IGameService service = Services.GetService <IGameService>();

        this.worldPositionService  = service.Game.Services.GetService <IWorldPositionningService>();
        this.WantToKeepArmyFitness = new HeuristicValue(0f);
        this.lastcheckTime         = 0.0;
    }
    private void ComputeWantedMilitaryUnitCount()
    {
        float propertyValue = base.AIEntity.Empire.GetPropertyValue(SimulationProperties.ArmyUnitSlot);

        this.LandRecruiter.WantedUnitCount.Reset();
        this.NavalRecruiter.WantedUnitCount.Reset();
        DepartmentOfTheInterior agency = base.AIEntity.Empire.GetAgency <DepartmentOfTheInterior>();

        if (agency != null)
        {
            HeuristicValue heuristicValue = new HeuristicValue(0f);
            heuristicValue.Add((float)agency.Cities.Count, "Number of city", new object[0]);
            heuristicValue.Multiply(1.2f, "constant", new object[0]);
            this.LandRecruiter.WantedUnitCount.Add(heuristicValue, "1.2f per owned land region", new object[0]);
            HeuristicValue heuristicValue2 = new HeuristicValue(0f);
            heuristicValue2.Add((float)agency.OccupiedFortresses.Count, "Number of fortress", new object[0]);
            heuristicValue2.Multiply(0.5f, "constant", new object[0]);
            this.NavalRecruiter.WantedUnitCount.Add(heuristicValue2, "Half per owned fortresses", new object[0]);
        }
        MajorEmpire majorEmpire = base.AIEntity.Empire as MajorEmpire;

        if (majorEmpire != null)
        {
            HeuristicValue heuristicValue3 = new HeuristicValue(0f);
            heuristicValue3.Add((float)majorEmpire.ConvertedVillages.Count, "Number of village", new object[0]);
            heuristicValue3.Multiply(0.5f, "constant", new object[0]);
            this.LandRecruiter.WantedUnitCount.Add(heuristicValue3, "Half per converted village", new object[0]);
        }
        DepartmentOfForeignAffairs agency2 = base.AIEntity.Empire.GetAgency <DepartmentOfForeignAffairs>();

        if (agency2 != null)
        {
            HeuristicValue heuristicValue4 = new HeuristicValue(0f);
            heuristicValue4.Add((float)agency.Cities.Count, "Number of city", new object[0]);
            heuristicValue4.Multiply((float)agency2.CountNumberOfWar(), "Number of war", new object[0]);
            heuristicValue4.Multiply(0.5f, "constant", new object[0]);
            this.LandRecruiter.WantedUnitCount.Add(heuristicValue4, "Half per city per war.", new object[0]);
        }
        AILayer_Navy layer = base.AIEntity.GetLayer <AILayer_Navy>();

        if (layer != null)
        {
            this.NavalRecruiter.WantedUnitCount.Add(layer.WantedArmies(), "Navy wanted army count", new object[0]);
        }
        AILayer_Colonization layer2 = base.AIEntity.GetLayer <AILayer_Colonization>();

        if (layer2 != null)
        {
            this.LandRecruiter.WantedUnitCount.Add((float)(layer2.WantedNewCity / 2), "Half per wanted region", new object[0]);
        }
        if (this.LandRecruiter.WantedUnitCount == 0f)
        {
            this.LandRecruiter.WantedUnitCount.Add(1f, "avoid 0", new object[0]);
        }
        if (this.NavalRecruiter.WantedUnitCount == 0f)
        {
            this.NavalRecruiter.WantedUnitCount.Add(1f, "avoid 0", new object[0]);
        }
        this.LandRecruiter.WantedUnitCount.Multiply(propertyValue, "Army size", new object[0]);
        this.NavalRecruiter.WantedUnitCount.Multiply(propertyValue, "Army size", new object[0]);
        float propertyValue2 = base.AIEntity.Empire.GetPropertyValue(SimulationProperties.GameSpeedMultiplier);

        if ((float)this.endTurnService.Turn < 30f * propertyValue2)
        {
            this.LandRecruiter.WantedUnitCount.Multiply(0.3f, "Early game factor", new object[0]);
            this.NavalRecruiter.WantedUnitCount.Multiply(0.3f, "Early game factor", new object[0]);
        }
    }
Exemple #7
0
 public NavyCommander(AILayer_Navy navyLayer)
 {
     this.NavyArmies     = new List <NavyArmy>();
     this.NavyFortresses = new List <NavyFortress>();
     this.navyLayer      = navyLayer;
 }
Exemple #8
0
 public NavyArmy(AILayer_Navy navyLayer)
 {
     this.navyLayer     = navyLayer;
     this.Opportunities = new List <BehaviorOpportunity>();
 }