private void GeneratePlayers() { //TODO: currently generate random player names for now, should be provided by user on new game for (var i = 1; i <= _legionConfig.PlayersCount; i++) { _playersRepository.Players.Add(new Player { Id = i, Money = 5000, Name = NamesGenerator.Generate() }); } _playersRepository.UserPlayer = _playersRepository.Players[1]; _playersRepository.ChaosPlayer = _playersRepository.Players[_playersRepository.Players.Count - 1]; }
private City GenerateCity(Player owner) { var city = new City(); city.Name = NamesGenerator.Generate(); do { //city.X = GlobalUtils.Rand(config.WorldWidth - 50) + 20; // X=Rnd(590)+20 //city.Y = GlobalUtils.Rand(config.WorldHeight - 52) + 20; // Y=Rnd(460)+20 city.X = GlobalUtils.Rand(_legionConfig.WorldWidth); city.Y = GlobalUtils.Rand(_legionConfig.WorldHeight); } while (!IsCityPositionAvailable(city.X, city.Y)); city.Population = GlobalUtils.Rand(900) + 10; city.Owner = owner; city.BobId = 8 + (city.Owner != null ? city.Owner.Id : 0) * 2; if (city.Population > 700) { city.BobId++; city.WallType = GlobalUtils.Rand(2) + 1; } else { city.WallType = GlobalUtils.Rand(1); } city.Tax = GlobalUtils.Rand(25); city.Morale = GlobalUtils.Rand(100); //TEREN[X+4,Y+4] //city.TerrainType = terrainManager.GetTerrain(city.X + 4, city.Y + 4); //if (city.TerrainType == 7) city.TerrainType = 1; city.X += 8; city.Y += 8; city.Craziness = GlobalUtils.Rand(10) + 5; city.DaysToGetInfo = 30; _citiesHelper.UpdatePriceModificators(city); var buildings = GenerateBuildings(); city.Buildings = buildings; return(city); }
public Adventure Create(int id, int level) { if (_userAdventures.Count >= MaxAdventures) { return(null); } var adventure = new Adventure(); adventure.Id = id; //PRZYGODY(NR,P_X)=ARMIA(A,0,TNOGI)-70 adventure.Y = GlobalUtils.Rand(9) + 1; adventure.Direction = null; adventure.Level = level; switch (id) { case 1: { // kopalnia adventure.Price = 20 * level; adventure.Terrain = 8; adventure.AddReward(RewardType.Money, level * 10000); } break; case 2: { // kurhan adventure.Price = GlobalUtils.Rand(20 * level); adventure.Terrain = 9; adventure.RelatedPerson = NamesGenerator.Generate(); adventure.AddReward(RewardType.Money, level * 100); /* * adventures.AddReward(RewardType.Weapon, weapon); * Repeat * BRON=Rnd(MX_WEAPON) * BTYP=BRON(BRON,B_TYP) * Until BRON(BRON,B_CENA)>=1000 and BRON(BRON,BCENA)<100+LEVEL*1000 and BTYP<>5 and BTYP<>8 and BTYP<>13 and BTYP<>14 and BTYP<16 * PRZYGODY(NR,P_BRON)=BRON */ } break; case 3: { // bandyci adventure.Price = 0; adventure.AddReward(RewardType.Money, 4000 + GlobalUtils.Rand(2000) + level * 100); } break; case 4: { // córa adventure.Price = 0; adventure.RelatedPerson = NamesGenerator.Generate(); /* * adventure.AddReward(RewardType.City, city.Id); * Repeat : MIASTO=Rnd(49) : Until MIASTA(MIASTO,0,M_CZYJE)<>1 */ } break; default: break; } _userAdventures.Add(adventure); return(adventure); }