HackyAI: Refactor and remove duplicated logic.
This commit is contained in:
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
if (waterState == Water.NotChecked)
|
||||
{
|
||||
if (ai.EnoughWaterToBuildNaval())
|
||||
if (ai.IsAreaAvailable<BaseProvider>(ai.Info.MaxBaseRadius, ai.Info.WaterTerrainTypes))
|
||||
waterState = Water.EnoughWater;
|
||||
else
|
||||
{
|
||||
@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
// Only consider building this if there is enough water inside the base perimeter and there are close enough adjacent buildings
|
||||
if (waterState == Water.EnoughWater && ai.Info.NewProductionCashThreshold > 0
|
||||
&& playerResources.Resources > ai.Info.NewProductionCashThreshold
|
||||
&& ai.CloseEnoughToWater())
|
||||
&& ai.IsAreaAvailable<GivesBuildableArea>(ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes))
|
||||
{
|
||||
var navalproduction = GetProducibleBuilding(ai.Info.BuildingCommonNames.NavalProduction, buildableThings);
|
||||
if (navalproduction != null && HasSufficientPowerForActor(navalproduction))
|
||||
@@ -309,7 +309,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
// and any structure providing buildable area close enough to that water.
|
||||
// TODO: Extend this check to cover any naval structure, not just production.
|
||||
if (ai.Info.BuildingCommonNames.NavalProduction.Contains(name)
|
||||
&& (waterState == Water.NotEnoughWater || !ai.CloseEnoughToWater()))
|
||||
&& (waterState == Water.NotEnoughWater || !ai.IsAreaAvailable<GivesBuildableArea>(ai.Info.CheckForWaterRadius, ai.Info.WaterTerrainTypes)))
|
||||
continue;
|
||||
|
||||
// Will this put us into low power?
|
||||
|
||||
Reference in New Issue
Block a user