Esempio n. 1
0
        public void GenerateOneGroup()
        {
            try
            {
                MonsterGroup group = new MonsterGroup();
                if (this._map.Map.FixedGroup == 0)
                {
                    int groupSize = Utilities.Basic.Rand(1, this._maxMonsterPerGroup);
                    for (int i = 0; i <= groupSize - 1; i++)
                    {
                        Database.Records.MonsterLevelRecord monster = GetRandomMonster();
                        if (monster != null)
                        {
                            group.AddMonster(monster);
                        }
                    }
                }
                else
                {
                    foreach (var monster in this.PossibleMonsters)
                    {
                        group.AddMonster(monster);
                    }
                }

                group.ID = this._map.GetActorAvailableID;
                if (this._map.Emitters.Count > 0)
                {
                    group.CellID = this._map.Emitters[Utilities.Basic.Rand(0, this._map.Emitters.Count - 1)];
                }
                else
                {
                    group.CellID = this._map.RandomFreeCell().ID;
                }
                group.CreatePattern();
                this.GroupsOnMap.Add(group);
            }
            catch (Exception e)
            {
                //TODO
            }
        }
Esempio n. 2
0
        public void GenerateOneGroup()
        {
            try
            {
                MonsterGroup group = new MonsterGroup();
                if (this._map.Map.FixedGroup == 0)
                {
                    int groupSize = Utilities.Basic.Rand(1, this._maxMonsterPerGroup);
                    for (int i = 0; i <= groupSize - 1; i++)
                    {
                        Database.Records.MonsterLevelRecord monster = GetRandomMonster();
                        if (monster != null)
                        {
                            group.AddMonster(monster);
                        }
                    }
                }
                else
                {
                    foreach (var monster in this.PossibleMonsters)
                    {
                        group.AddMonster(monster);
                    }
                }

                group.ID = this._map.GetActorAvailableID;
                if (this._map.Emitters.Count > 0)
                {
                    group.CellID = this._map.Emitters[Utilities.Basic.Rand(0, this._map.Emitters.Count - 1)];
                }
                else
                {
                    group.CellID = this._map.RandomFreeCell().ID;
                }
                group.CreatePattern();
                this.GroupsOnMap.Add(group);
            }
            catch (Exception e)
            {
                //TODO
            }
        }
Esempio n. 3
0
 public void APIStartMonsterBattle(int battleCell, string pattern)
 {
     MonsterGroup group = new MonsterGroup()
     {
         CellID = battleCell,
     };
     foreach (var monster in pattern.Split('|'))
     {
         if (monster.Trim() != string.Empty)
         {
             var data = monster.Trim().Split(',');
             var m = MonsterHelper.GetMonsterTemplate(int.Parse(data[0])).GetLevel(int.Parse(data[1]));
             group.AddMonster(m);
         }
     }
     Handlers.GameHandler.StartMonstersBattle(this, group);
 }