void SetupUtitlityEngine() { myEngine = new UtilityEngine <BaseBuilding>(); // Multiple Use UtilityConsideration NumberOfFoodBuildings = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 60), FoodProductionBuildingsCount, -1, 1, 0, 1, 1); UtilityConsideration HaveTierOneResources = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), HaveTeirOneRequirments, 1, 1, 0, 1, 0); UtilityConsideration HaveTierTwoResources = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), HaveTeirTwoRequirments, 1, 1, 0, 1, 0); UtilityConsideration HaveTierThreeResources = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), HaveTeirThreeRequirments, 1, 1, 0, 1, 0); UtilityConsideration HaveTierFourResources = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), HaveTeirFourRequirments, 1, 1, 0, 1, 0); UtilityConsideration NumOfEnemyUnits = new UtilityConsideration(UtilityConsideration.CurveTypes.Log, new Vector2(0, 100), NumEnemyUnits, 1, 1, 0, 10, 1); UtilityConsideration OurMilitary = new UtilityConsideration(UtilityConsideration.CurveTypes.Trigonometric, new Vector2(0, 100), OurMilitaryCount, -1.3f, 1, 0.25f, 4, 1); UtilityConsideration GoldAmount = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 50), GetGoldCount, -1, 1, 0, 1, 1); #region Teir 1 // Farm UtilityConsideration NumberOfFarms = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumFarms, -1, 1, 0, 1, 1); UtilityConsideration NumberOfFarmRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetFarmRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> FarmAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Farm], NumberOfFarms, NumberOfFarmRequirements, HaveTierOneResources); myEngine.Actions.Add(FarmAction); // Fishery UtilityConsideration NumberOfFisherys = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumFisherys, -1, 1, 0, 1, 1); UtilityConsideration NumberOfFisheryRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumFisheryRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> FisheryAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Fishery], NumberOfFisherys, NumberOfFisheryRequirments, NumberOfFoodBuildings, HaveTierOneResources); myEngine.Actions.Add(FisheryAction); // MineGold UtilityConsideration NumberOfMineGolds = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumMineGolds, -1, 1, 0, 1, 0); UtilityAction <BaseBuilding> MineGoldAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.MineGold], NumberOfMineGolds, GoldAmount, HaveTierOneResources); myEngine.Actions.Add(MineGoldAction); // MineIron UtilityConsideration NumberOfMineIrons = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumMineIrons, -1, 1, 0, 1, 0); UtilityConsideration NumberOfMineIronRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumMineIronRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> MineIronAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.MineIron], NumberOfMineIrons, NumberOfMineIronRequirments, HaveTierOneResources); myEngine.Actions.Add(MineIronAction); // Orchard UtilityConsideration NumberOfOrchards = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumOrchards, -1, 1, 0, 1, 0); UtilityConsideration NumberOfOrchardRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumOrchardRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> OrchardAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Orchard], NumberOfOrchards, NumberOfOrchardRequirments, NumberOfFoodBuildings, HaveTierOneResources); myEngine.Actions.Add(OrchardAction); // Pasture UtilityConsideration NumberOfPastures = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumPastures, -1, 1, 0, 1, 0); UtilityConsideration NumberOfPastureRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumPastureRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> PastureAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Pasture], NumberOfPastures, NumberOfPastureRequirments, HaveTierOneResources); myEngine.Actions.Add(PastureAction); // Plantation UtilityConsideration NumberOfPlantations = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumPlantations, -1, 1, 0, 1, 0); UtilityConsideration NumberOfPlantationRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumPlantationRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> PlantationAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Plantation], NumberOfPlantations, NumberOfPlantationRequirments, HaveTierOneResources); myEngine.Actions.Add(PlantationAction); // Quarry UtilityConsideration NumberOfQuarrys = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumQuarrys, -1, 1, 0, 1, 0); UtilityConsideration NumberOfQuarryRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumQuarryRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> QuarryAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Quarry], NumberOfQuarrys, NumberOfQuarryRequirments, HaveTierOneResources); myEngine.Actions.Add(QuarryAction); // Sawmill UtilityConsideration NumberOfSawmills = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumSawmills, -1, 1, 0, 1, 0); UtilityConsideration NumberOfSawmillRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumSawmillRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> SawmillAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Sawmill], NumberOfSawmills, NumberOfSawmillRequirments, HaveTierOneResources); myEngine.Actions.Add(SawmillAction); // WaterWell UtilityConsideration NumberOfWaterWells = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumWaterWells, -1, 1, 0, 1, 0); UtilityConsideration NumberOfWaterWellRequirments = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumWaterWellRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> WaterWellAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.WaterWell], NumberOfWaterWells, NumberOfWaterWellRequirments, NumberOfFoodBuildings, HaveTierOneResources); myEngine.Actions.Add(WaterWellAction); #endregion #region Tier 2 // Butcher UtilityConsideration NumberOfButchers = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumButchers, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> ButcherAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Butcher], NumberOfButchers, NumberOfFoodBuildings, HaveTierTwoResources); myEngine.Actions.Add(ButcherAction); // Carpenter UtilityConsideration NumberOfCarpenters = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumCarpenters, -1, 1, 0, 1, 1); UtilityConsideration NumberOfCarpenterRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetCarpenterRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> CarpenterAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Carpenter], NumberOfCarpenters, NumberOfCarpenterRequirements, HaveTierTwoResources); myEngine.Actions.Add(CarpenterAction); // House UtilityConsideration NeedHouseConsideration = new UtilityConsideration(UtilityConsideration.CurveTypes.Polynomial, new Vector2(0, 20), NeedHouse, -1, 1, 0, 4, 1); UtilityAction <BaseBuilding> HouseAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.House], NeedHouseConsideration, HaveTierTwoResources); myEngine.Actions.Add(HouseAction); // Mill UtilityConsideration NumberOfMills = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumMills, -1, 1, 0, 1, 1); UtilityConsideration NumberOfMillRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetMillRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> MillAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Mill], NumberOfMills, NumberOfMillRequirements, HaveTierTwoResources); myEngine.Actions.Add(MillAction); // Tailor UtilityConsideration NumberOfTailors = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumTailors, -1, 1, 0, 1, 1); UtilityConsideration NumberOfTailorRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetTailorRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> TailorAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Tailor], NumberOfTailors, NumberOfTailorRequirements, HaveTierTwoResources); myEngine.Actions.Add(TailorAction); // Tanner UtilityConsideration NumberOfTanners = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumTanners, -1, 1, 0, 1, 1); UtilityConsideration NumberOfTannerRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetTannerRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> TannerAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Tanner], NumberOfTanners, NumberOfTannerRequirements, HaveTierTwoResources); myEngine.Actions.Add(TannerAction); // Winery UtilityConsideration NumberOfWinerys = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumWinerys, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> WineryAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Winery], NumberOfWinerys, NumberOfFoodBuildings, HaveTierTwoResources); myEngine.Actions.Add(WineryAction); #endregion #region Tier 3 // Armoursmith UtilityConsideration NumberOfArmoursmiths = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumArmoursmiths, -1, 1, 0, 1, 1); UtilityConsideration NumberOfArmoursmithRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetArmoursmithRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> ArmoursmithAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Armoursmith], NumberOfArmoursmiths, NumberOfArmoursmithRequirements, HaveTierThreeResources); myEngine.Actions.Add(ArmoursmithAction); // Bakery UtilityConsideration NumberOfBakerys = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetNumBakerys, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> BakeryAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Bakery], NumberOfBakerys, HaveTierThreeResources); myEngine.Actions.Add(BakeryAction); // Fletcher UtilityConsideration NumberOfFletchers = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumFletchers, -1, 1, 0, 1, 1); UtilityConsideration NumberOfFletcherRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetFletcherRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> FletcherAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Fletcher], NumberOfFletchers, NumberOfFletcherRequirements, HaveTierThreeResources); myEngine.Actions.Add(FletcherAction); // Typography UtilityConsideration NumberOfTypographys = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumTypographys, -1, 1, 0, 1, 1); UtilityConsideration NumberOfTypographyRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetTypographyRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> TypographyAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Typography], NumberOfTypographys, NumberOfTypographyRequirements, HaveTierThreeResources); myEngine.Actions.Add(TypographyAction); // Villa UtilityConsideration NeedVillaConsideration = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 5), NeedVilla, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> VillaAction = new UtilityAction <BaseBuilding>(2, GlobalAttributes.Global.Buildings[(int)Buildings.Villa], NeedVillaConsideration, HaveTierThreeResources); myEngine.Actions.Add(VillaAction); // Warehouse UtilityConsideration NeedWarehouse = new UtilityConsideration(UtilityConsideration.CurveTypes.Polynomial, new Vector2(0, 100), CurrentStorageSpace, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> WarehouseAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Warehouse], NeedWarehouse, HaveTierThreeResources); myEngine.Actions.Add(WarehouseAction); // Weaponsmith UtilityConsideration NumberOfWeaponsmiths = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumWeaponsmiths, -1, 1, 0, 1, 1); UtilityConsideration NumberOfWeaponsmithRequirements = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 1), GetWeaponsmithRequirements, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> WeaponsmithAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Weaponsmith], NumberOfWeaponsmiths, NumberOfWeaponsmithRequirements, HaveTierThreeResources); myEngine.Actions.Add(WeaponsmithAction); #endregion #region Tier 4 // BarracksArcher UtilityConsideration NumOfBarracksArchers = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumBarracksArcher, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> BarracksArcherAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.BarracksArcher], NumOfBarracksArchers, NumOfEnemyUnits, OurMilitary, HaveTierFourResources); myEngine.Actions.Add(BarracksArcherAction); // BarracksSoldier UtilityConsideration NumOfBarracksSoldiers = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumBarracksSoldier, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> BarracksSoldierAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.BarracksArcher], NumOfBarracksSoldiers, NumOfEnemyUnits, OurMilitary, HaveTierFourResources); myEngine.Actions.Add(BarracksSoldierAction); // Library UtilityConsideration NumLibrarys = new UtilityConsideration(UtilityConsideration.CurveTypes.Log, new Vector2(0, 10), GetNumLibrarys, 1, 2, 0.5f, 10, 1); UtilityConsideration NumOfEnemyUnitsInverse = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 100), NumEnemyUnits, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> LibraryAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Library], NumLibrarys, NumOfEnemyUnitsInverse, HaveTierFourResources); myEngine.Actions.Add(LibraryAction); // Market UtilityConsideration NumMarkets = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumMarkets, -1, 1, 0, 1, 1); UtilityAction <BaseBuilding> MarketAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Market], NumMarkets, GoldAmount, HaveTierFourResources); myEngine.Actions.Add(MarketAction); // Workshop UtilityConsideration NumOfWorkshops = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 10), GetNumWorkshops, -1, 1, 0, 1, 1); UtilityConsideration EnemyBuildingCount = new UtilityConsideration(UtilityConsideration.CurveTypes.Linear, new Vector2(0, 20), GetEnemyBuildingsCount, 1, 1, 0, 1, 0); UtilityAction <BaseBuilding> WorkshopAction = new UtilityAction <BaseBuilding>(1, GlobalAttributes.Global.Buildings[(int)Buildings.Workshop], NumOfWorkshops, EnemyBuildingCount, HaveTierFourResources); myEngine.Actions.Add(WorkshopAction); #endregion }