public void Init(Classificator.TribeEnum tribe) { // Nature by default Bitmap tribeGif = FormsResources.Nature; switch (tribe) { case Classificator.TribeEnum.Romans: tribeGif = FormsResources.Romans; break; case Classificator.TribeEnum.Teutons: tribeGif = FormsResources.Teutons; break; case Classificator.TribeEnum.Gauls: tribeGif = FormsResources.Gauls; break; //case Classificator.TribeEnum.Nature: // tribeGif = FormsResources.Nature; // break; case Classificator.TribeEnum.Natars: tribeGif = FormsResources.Natars; break; case Classificator.TribeEnum.Egyptians: tribeGif = FormsResources.Egyptians; break; case Classificator.TribeEnum.Huns: tribeGif = FormsResources.Huns; break; } for (int i = 0; i < 10; i++) { pictureBoxes[i].Image = tribeGif.Clone( new Rectangle(i * 19, 0, 16, 16), System.Drawing.Imaging.PixelFormat.Format24bppRgb ); } // Hero display pictureBoxes[10].Image = FormsResources.Specials.Clone( new Rectangle(2 * 19, 0, 16, 16), System.Drawing.Imaging.PixelFormat.Format24bppRgb ); }
private void SetTribe(Account acc, Classificator.TribeEnum tribe) => acc.AccInfo.Tribe = tribe;
public static int GetMerchantsSpeed(Classificator.TribeEnum tribe) => MerchantSpeed[(int)tribe];
public void Init(Classificator.TribeEnum tribe) { troopsDisplayUc1.Init(tribe); }
public static int GetMerchantsSpeed(Classificator.TribeEnum tribe) { return(MerchantSpeed[(int)tribe]); }
public static (Classificator.TribeEnum, List <Prerequisite>) GetBuildingPrerequisites(Classificator.BuildingEnum building) { Classificator.TribeEnum tribe = Classificator.TribeEnum.Any; var ret = new List <Prerequisite>(); switch (building) { case Classificator.BuildingEnum.Woodcutter: case Classificator.BuildingEnum.ClayPit: case Classificator.BuildingEnum.IronMine: case Classificator.BuildingEnum.Cropland: break; case Classificator.BuildingEnum.Sawmill: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Woodcutter, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.Brickyard: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.ClayPit, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.IronFoundry: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.IronMine, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.GrainMill: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Cropland, Level = 5 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.Bakery: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Cropland, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.GrainMill, Level = 5 }); break; case Classificator.BuildingEnum.Warehouse: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 1 }); break; case Classificator.BuildingEnum.Granary: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 1 }); break; case Classificator.BuildingEnum.Blacksmith: //DOESN'T EXIST ANYMORE tribe = Classificator.TribeEnum.Nature; //Just a dirty hack, since user can't be Nature, he can't build Blacksmith break; case Classificator.BuildingEnum.Smithy: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 3 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Academy, Level = 1 }); break; case Classificator.BuildingEnum.TournamentSquare: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 15 }); break; case Classificator.BuildingEnum.MainBuilding: break; case Classificator.BuildingEnum.RallyPoint: break; case Classificator.BuildingEnum.Marketplace: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Warehouse, Level = 1 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Granary, Level = 1 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 3 }); break; case Classificator.BuildingEnum.Embassy: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 1 }); break; case Classificator.BuildingEnum.Barracks: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 3 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 1 }); break; case Classificator.BuildingEnum.Stable: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Smithy, Level = 3 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Academy, Level = 5 }); break; case Classificator.BuildingEnum.Workshop: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Academy, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.Academy: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 3 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Barracks, Level = 3 }); break; case Classificator.BuildingEnum.Cranny: break; case Classificator.BuildingEnum.TownHall: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Academy, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 10 }); break; case Classificator.BuildingEnum.Residence: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); //no palace! break; case Classificator.BuildingEnum.Palace: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); //no residence! ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Embassy, Level = 1 }); break; case Classificator.BuildingEnum.Treasury: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 10 }); break; case Classificator.BuildingEnum.TradeOffice: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Stable, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Marketplace, Level = 20 }); break; case Classificator.BuildingEnum.GreatBarracks: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Barracks, Level = 20 }); //not capital! break; case Classificator.BuildingEnum.GreatStable: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Stable, Level = 20 }); //not capital break; case Classificator.BuildingEnum.CityWall: tribe = Classificator.TribeEnum.Romans; break; case Classificator.BuildingEnum.EarthWall: tribe = Classificator.TribeEnum.Teutons; break; case Classificator.BuildingEnum.Palisade: tribe = Classificator.TribeEnum.Gauls; break; case Classificator.BuildingEnum.StonemasonsLodge: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); //capital break; case Classificator.BuildingEnum.Brewery: tribe = Classificator.TribeEnum.Teutons; ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Granary, Level = 20 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 10 }); break; case Classificator.BuildingEnum.Trapper: tribe = Classificator.TribeEnum.Gauls; ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 1 }); break; case Classificator.BuildingEnum.HerosMansion: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 3 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 1 }); break; case Classificator.BuildingEnum.GreatWarehouse: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 10 }); //art/ww vill break; case Classificator.BuildingEnum.GreatGranary: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 10 }); //art/ww vill break; case Classificator.BuildingEnum.WW: //ww vill tribe = Classificator.TribeEnum.Nature; //Just a dirty hack, since user can't be Nature, he can't constuct WW. break; case Classificator.BuildingEnum.HorseDrinkingTrough: ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.RallyPoint, Level = 10 }); ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.Stable, Level = 20 }); tribe = Classificator.TribeEnum.Romans; break; case Classificator.BuildingEnum.StoneWall: tribe = Classificator.TribeEnum.Egyptians; break; case Classificator.BuildingEnum.MakeshiftWall: tribe = Classificator.TribeEnum.Huns; break; case Classificator.BuildingEnum.CommandCenter: //no res/palace tribe = Classificator.TribeEnum.Huns; ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.MainBuilding, Level = 5 }); break; case Classificator.BuildingEnum.Waterworks: tribe = Classificator.TribeEnum.Egyptians; ret.Add(new Prerequisite() { Building = Classificator.BuildingEnum.HerosMansion, Level = 10 }); break; default: break; } return(tribe, ret); }
public static bool BuildingRequirementsAreMet(Classificator.BuildingEnum building, Village vill, Classificator.TribeEnum tribe) //check if user can construct this building { bool exists = (vill.Build.Buildings.FirstOrDefault(x => x.Type == building) != null); //there is already a building of this type in the vill if (exists) { //check cranny/warehouse/grannary/trapper/GG/GW switch (building) { case Classificator.BuildingEnum.Warehouse: return(BuildingIsOnLevel(Classificator.BuildingEnum.Warehouse, 20, vill)); case Classificator.BuildingEnum.Granary: return(BuildingIsOnLevel(Classificator.BuildingEnum.Granary, 20, vill)); case Classificator.BuildingEnum.GreatWarehouse: return(BuildingIsOnLevel(Classificator.BuildingEnum.GreatWarehouse, 20, vill)); case Classificator.BuildingEnum.GreatGranary: return(BuildingIsOnLevel(Classificator.BuildingEnum.GreatGranary, 20, vill)); case Classificator.BuildingEnum.Trapper: return(BuildingIsOnLevel(Classificator.BuildingEnum.Trapper, 20, vill)); case Classificator.BuildingEnum.Cranny: return(BuildingIsOnLevel(Classificator.BuildingEnum.Cranny, 10, vill)); default: return(false); } } //check for prerequisites for this building (var ReqTribe, var Prerequisites) = GetBuildingPrerequisites(building); if (ReqTribe != Classificator.TribeEnum.Any && ReqTribe != tribe) { return(false); } //if we either already have this building OR is on our build task list, requirements are met. foreach (var prerequisite in Prerequisites) { if (!vill.Build.Buildings.Any(x => x.Level >= prerequisite.Level && x.Type == prerequisite.Building) && !vill.Build.Tasks.Any(x => x.Level >= prerequisite.Level && x.Building == prerequisite.Building)) { return(false); } } return(true); }