Exemplo n.º 1
0
        private void DoSelectNpcsFromPool()
        {
            //new shit, build flocks etc....
            var level        = MissionTarget.MyZoneMissionInProgress.MissionLevel; //mission level starts from 0
            var selectedRace = MissionTarget.MyZoneMissionInProgress.selectedRace;

            for (var i = 0; i < MissionTarget.MyTarget.Quantity; i++)
            {
                IRobotTemplateRelation npcTemplateRelation;

                var indyChance = FastRandom.NextDouble();
                if (indyChance > 0.15)
                {
                    //select from the mission's
                    npcTemplateRelation = _robotTemplateRelations.GetRandomByMissionLevelAndRaceID(level, selectedRace);
                    Logger.DebugInfo($" selected by race {npcTemplateRelation.EntityDefault.Name}");
                }
                else
                {
                    //somekind of saturation 15%
                    npcTemplateRelation = level == 0 ? _robotTemplateRelations.GetRandomDummyDecoyOthers() :
                                          _robotTemplateRelations.GetRandomIndustrialNpc(level);

                    Logger.DebugInfo($" selected as indy {npcTemplateRelation.EntityDefault.Name}");
                }

                var builder = CreateFlockConfigurationBuilder()
                              .With(c =>
                {
                    c.EntityDefault    = npcTemplateRelation.EntityDefault;
                    c.FlockMemberCount = 1;
                });

                var config = builder.Build();
                CreateAndAddFlock(config);
            }
        }
 public static IRobotTemplateRelation GetRandomDummyDecoyOthers(this IRobotTemplateRelations relations)
 {
     return(relations.GetRandomIndustrialNpc(0));
 }