Exemple #1
0
        public static DungeonData FromConfig(DisassemblygirlDungeonConfig config)
        {
            DungeonData dungeon = new DungeonData();

            dungeon.id         = config.id;
            dungeon.name       = config.name;
            dungeon.resourceID = config.resourceID;
            dungeon.audioID    = config.audioID;
            dungeon.directorID = config.directorID;

            IList <int> monsterGroupIDs = new List <int>();

            foreach (string groupID in config.monsterGroups.Split('|'))
            {
                monsterGroupIDs.Add(int.Parse(groupID));
            }

            dungeon.monsterGroups = new List <MonsterGroupData>(monsterGroupIDs.Count);

            // Generate Monsters By GroupID
            foreach (int groupID in monsterGroupIDs)
            {
                MonsterGroupData group = MonsterGroupData.FromConfig(ConfigMgr.GetInstance().DisassemblygirlMonstergroup.GetConfigById(groupID));

                dungeon.monsterGroups.Add(group);
            }

            return(dungeon);
        }
Exemple #2
0
        public bool ActiveMonsterGroup()
        {
            if (HasMonsterGroup())
            {
                groupCounter++;

                currentGroup = monsterGroups[0];

                monsterGroups.RemoveAt(0);

                return(true);
            }

            return(false);
        }
Exemple #3
0
        public static MonsterGroupData FromConfig(DisassemblygirlMonstergroupConfig config)
        {
            Action <IList <int> > RandomShuffle = (IList <int> input) =>
            {
                Random random = new Random();

                int currentIndex = 0;
                int tempValue    = 0;

                for (int index = 0; index < input.Count; index++)
                {
                    currentIndex                   = random.Next(0, input.Count - index);
                    tempValue                      = input[currentIndex];
                    input[currentIndex]            = input[input.Count - 1 - index];
                    input[input.Count - 1 - index] = tempValue;
                }
            };

            Func <string, IList <MonsterData> > WrapperMonsters = (string monsters) =>
            {
                IList <MonsterData> monsterDatas = new List <MonsterData>();

                if (monsters == "0")
                {
                    return(monsterDatas);
                }

                IList <int> sourceIds = new List <int>();

                foreach (string monsterConfig in monsters.Split('|'))
                {
                    string[] parameters = monsterConfig.Split(':');

                    for (int index = 0, length = int.Parse(parameters[1]); index < length; index++)
                    {
                        sourceIds.Add(int.Parse(parameters[0]));
                    }
                }

                RandomShuffle(sourceIds);

                foreach (int monsterID in sourceIds)
                {
                    MonsterData monster = MonsterData.FromConfig(ConfigMgr.GetInstance().DisassemblygirlMonster.GetConfigById(monsterID));
                    monsterDatas.Add(monster);
                }

                return(monsterDatas);
            };

            MonsterGroupData group = new MonsterGroupData();

            group.id            = config.id;
            group.jointInterval = config.joinInterval;
            group.joinCount     = config.joinCount;
            group.isBoss        = config.isBoss == 0 ? false : true;

            group.monstersA = WrapperMonsters(config.monstersA);
            group.monstersB = WrapperMonsters(config.monstersB);
            group.monstersC = WrapperMonsters(config.monstersC);
            group.monstersD = WrapperMonsters(config.monstersD);
            group.monstersE = WrapperMonsters(config.monstersE);

            if (config.boss != 0)
            {
                group.boss        = MonsterData.FromConfig(ConfigMgr.GetInstance().DisassemblygirlMonster.GetConfigById(config.boss));
                group.boss.isBoss = true;
            }

            return(group);
        }