Пример #1
0
    public override void UpdateRole()
    {
        base.Role = BaseNavyArmy.ArmyRole.Forteress;
        this.WantToKeepArmyFitness.Reset();
        NavyRegionData navyRegionData = base.Commander.RegionData as NavyRegionData;

        this.WantToKeepArmyFitness.Add(0.3f, "constant", new object[0]);
        if (navyRegionData.NumberOfWaterEnemy > 0)
        {
            HeuristicValue heuristicValue = new HeuristicValue(0f);
            heuristicValue.Add((float)navyRegionData.NumberOfWaterEnemy, "Number of enemy water region around.", new object[0]);
            heuristicValue.Multiply(0.1f, "boost constant", new object[0]);
            heuristicValue.Min(0.5f, "Avoid too big factor!", new object[0]);
            this.WantToKeepArmyFitness.Boost(heuristicValue, "Water region owned by enemy around.", new object[0]);
        }
        if (navyRegionData.NumberOfEnemyCityOnTheBorder > 0)
        {
            this.WantToKeepArmyFitness.Boost(0.2f, "Enemy city in the region.", new object[0]);
        }
        if (navyRegionData.EnemyNavalPower > 0f)
        {
            this.WantToKeepArmyFitness.Boost(0.9f, "Enemy roaming in the region.", new object[0]);
        }
        MajorEmpire occupant = this.Fortress.Occupant;

        if (occupant != null && !AILayer_Military.AreaIsSave(this.Fortress.WorldPosition, 10, occupant.GetAgency <DepartmentOfForeignAffairs>(), true))
        {
            this.WantToKeepArmyFitness.Boost(0.9f, "Enemy roaming in the region.", new object[0]);
        }
    }