private static void SetupRandomizedGroupsByIDs(LG_PopulateArea area, Dictionary <int, float> enemyIDs)
        {
            if (enemyIDs == null || enemyIDs.Count < 1)
            {
                LoggerWrapper.Log("No enemy population tweaks, aborting setup...");
                return;
            }

            HashSet <pAvailableEnemyTypes> validTypes;

            validTypes = GetValidGroups(enemyIDs);


            Dictionary <pAvailableEnemyTypes, float> weightedGroups = SetupWeighting(validTypes, enemyIDs);

            pAvailableEnemyTypes dataGroup = weightedGroups.RandomElementByWeight(e => e.Value).Key;


            LoggerWrapper.Log(dataGroup.ToString(), LogLevel.Debug);

            if (!enemyIDs.ContainsKey((int)dataGroup.enemyID))
            {
                return;
            }

            area.m_groupPlacement.groupData.Difficulty = dataGroup.difficulty;
            area.m_groupPlacement.groupData.Type       = GetValidGroupTypeFromRole(dataGroup.role);



            foreach (EnemyGroupCompositionData enemyGroupCompositionData in area.m_groupPlacement.groupData.Roles)
            {
                eEnemyRole role = dataGroup.role;
                EnsureValidRole(area.m_groupPlacement.groupData.Type, area.m_groupPlacement.groupData.Difficulty, ref role);
                enemyGroupCompositionData.Role = role;
            }


            LoggerWrapper.Log($"Setting enemyDataGroup: Diff:{area.m_groupPlacement.groupData.Difficulty} Role:{area.m_groupPlacement.groupData.Type} Type:{dataGroup.role}", LogLevel.Debug);
        }
Beispiel #2
0
        public static void SetupData(EnemyPopulationDataBlock __instance)
        {
            if (enemyTypes == null)
            {
                enemyTypes = new List <pAvailableEnemyTypes>();
            }

            foreach (Il2CppSystem.Collections.Generic.List <EnemyRoleData> data in __instance.m_enemyDataPerRoleAndDiff.Values)
            {
                foreach (EnemyRoleData data1 in data)
                {
                    if (!validRoles.Contains(data1.Role))
                    {
                        continue;
                    }
                    pAvailableEnemyTypes enemyData = new pAvailableEnemyTypes(
                        data1.Enemy, data1.Cost, data1.Difficulty, data1.Role, data1.Weight);
                    enemyTypes.Add(enemyData);

                    LoggerWrapper.Log(enemyData.ToString());
                }
            }
        }