Beispiel #1
0
        private void GenerateArmies()
        {
            for (var i = 1; i < _playersRepository.Players.Count - 1; i++)
            {
                var owner = _playersRepository.Players[i];

                var xg = GlobalUtils.Rand(_legionConfig.WorldWidth - 200) + 100;
                var yg = GlobalUtils.Rand(_legionConfig.WorldHeight - 200) + 100;

                for (var k = 0; k <= 2; k++)
                {
                    var army = _armiesRepository.CreateArmy(owner, 10);
                    army.X = xg + GlobalUtils.Rand(200) - 100;
                    army.Y = yg + GlobalUtils.Rand(200) - 100;
                }
            }

            var ownArmy = _armiesRepository.CreateArmy(_playersRepository.UserPlayer, 5);

            ownArmy.X    = GlobalUtils.Rand(_legionConfig.WorldWidth) + 20;
            ownArmy.Y    = GlobalUtils.Rand(_legionConfig.WorldHeight) + 10;
            ownArmy.Food = 100;
        }
 private void ProcessRecruiting(City city)
 {
     // NOTE: some old game saves have cities which belongs to owner with id == zero
     if (city.Owner != null && !city.Owner.IsUserControlled && city.Owner.Id > 0)
     {
         if (city.Owner.Money > 10000 && GlobalUtils.Rand(3) == 1 && city.DaysToSetNewRecruiters == 0)
         {
             // TODO: set upper limit for player's legion count // For I=20 To 39
             city.Owner.Money           -= 10000;
             city.DaysToSetNewRecruiters = 20 + GlobalUtils.Rand(10);
             var army = _armiesRepository.CreateArmy(city.Owner, 10);
             army.X = city.X;
             army.Y = city.Y;
         }
     }
 }