示例#1
0
        public List <Box> CreateBox()
        {
            int total     = m_players.Count + 2;
            int itemCount = 0;

            List <ItemInfo> infos = null;

            if (CurrentTurnTotalDamage > 0)
            {
                itemCount = m_random.Next(1, 3);
                if (m_tempBox.Count + itemCount > total)
                {
                    itemCount = total - m_tempBox.Count;
                }
                if (itemCount > 0)
                {
                    DropInventory.BoxDrop(m_roomType, ref infos);
                }
            }

            int ghostCount = GetDiedPlayerCount();
            int propCount  = 0;

            if (ghostCount > 0)
            {
                propCount = m_random.Next(ghostCount);
            }
            if (m_tempBox.Count + itemCount + propCount > total)
            {
                propCount = total - m_tempBox.Count - itemCount;
            }
            if (propCount > 0)
            {
                //add:未开始,战斗掉落
                //MapMgr.GetRandomFightPropByCount(m_map.Info.ID, propCount, list);
            }

            List <Box> box = new List <Box>();

            if (infos != null)
            {
                for (int i = 0; i < m_tempPoints.Count; i++)
                {
                    int   index = m_random.Next(m_tempPoints.Count);
                    Point p     = m_tempPoints[index];
                    m_tempPoints[index] = m_tempPoints[i];
                    m_tempPoints[i]     = p;
                }
                int count = Math.Min(infos.Count, m_tempPoints.Count);
                for (int i = 0; i < count; i++)
                {
                    //在BeginNextTurn中一起发给客户端
                    box.Add(AddBox(infos[i], m_tempPoints[i], false));
                }
            }

            m_tempPoints.Clear();
            return(box);
        }