Ejemplo n.º 1
0
        public static int GetRandPersonIdByLevel(int dlevel)
        {
            RandomMaker randomMaker = new RandomMaker();
            foreach (PeopleConfig peopleConfig in ConfigData.PeopleDict.Values)
            {
                if (IsMonster(peopleConfig.Id))
                    continue;

                if (peopleConfig.Level >= dlevel - 1 && peopleConfig.Level <= dlevel + 1)
                {
                    randomMaker.Add(peopleConfig.Id, 1);
                }
            }

            return randomMaker.Process(1)[0];
        }
Ejemplo n.º 2
0
        private void CheckLevelInfo()
        {
            SoundManager.Play("System", "LevelUp.wav");

            int nowlevel = UserProfile.InfoBasic.Level + 1;
            Text = string.Format("恭喜你提升到{0}级", nowlevel);

            point = new int[8];
            for (int i = 0; i < 8; i++)
            {
                point[i] = 0;
            }

            RandomMaker maker = new RandomMaker();
            skillcommon = maker.Process(3);

            sindex = -1;
            stindex = 0;
        }
Ejemplo n.º 3
0
        public static Point GetMonsterNearPoint(Point pos, string type, bool goLeft)
        {
            int size = BattleManager.Instance.MemMap.CardSize;
            if (type == "side")
            {
                Point pa = new Point(pos.X, pos.Y - size);
                Point pb = new Point(pos.X, pos.Y + size);
                bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                bool pbavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pb.X, pb.Y);
                if (paavail && !pbavail)
                {
                    return pa;
                }
                if (!paavail && pbavail)
                {
                    return pb;
                }
                if (paavail)
                {
                    return MathTool.GetRandom(2) == 0 ? pa : pb;
                }
                return new Point(-1, -1);
            }
            if (type == "back") //击退
            {
                if (goLeft)
                {
                    Point pa = new Point(pos.X + size, pos.Y);
                    bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                    if (paavail)
                    {
                        return pa;
                    }
                }
                else
                {
                    Point pa = new Point(pos.X - size, pos.Y);
                    bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                    if (paavail)
                    {
                        return pa;
                    }
                }

                return new Point(-1, -1);
            }
            if (type == "come") //拉过来
            {
                if (goLeft)
                {
                    Point pa = new Point(pos.X - size, pos.Y);
                    bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                    if (paavail)
                    {
                        return pa;
                    }
                }
                else
                {
                    Point pa = new Point(pos.X + size, pos.Y);
                    bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                    if (paavail)
                    {
                        return pa;
                    }
                }

                return new Point(-1, -1);
            }
            if (type == "around") //随机
            {
                RandomMaker rm = new RandomMaker();
                int count = 0;
                for (int i = 0; i < 4; i++)
                {
                    int xoff = i > 1 ? 0 : i*2 - 1;
                    int yoff = i <2 ? 0 : i * 2 - 5;
                    Point pa = new Point(pos.X + xoff * size, pos.Y + yoff * size);
                    bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                    if (paavail)
                    {
                        rm.Add(i,1);
                        count++;
                    }
                }
                if (count > 0)
                {
                    int sel = rm.Process(1)[0];
                    return new Point(pos.X + (sel > 1 ? 0 : sel * 2 - 1) * size, pos.Y + (sel < 2 ? 0 : sel * 2 - 5) * size);
                }
            }
            if (type == "rand") //随机
            {
                int xoff = MathTool.GetRandom(BattleManager.Instance.MemMap.Cells.GetLength(0));
                int yoff = MathTool.GetRandom(BattleManager.Instance.MemMap.Cells.GetLength(1));
                Point pa = new Point(xoff * size, yoff * size);
                bool paavail = BattleManager.Instance.MemMap.IsMousePositionCanSummon(pa.X, pa.Y);
                if (paavail)
                {
                    return pa;
                }
            }
            return new Point(-1, -1);
        }