Beispiel #1
0
        /// <summary>
        /// 手札から指定したカードを除外する
        /// </summary>
        /// <param name="num"></param>
        void ExcludeFromHands(int num)
        {
            int tmp = BitCalculation.GetNthBit(hands, num);

            hands          &= ~tmp;
            exclusionCards |= tmp;
        }
Beispiel #2
0
        /// <summary>
        /// 山札からランダムなカードを除外する
        /// </summary>
        /// <param name="num"></param>
        void ExcludeFromDeck(int num)
        {
            int i;
            int count = 0;

            while (count != num)
            {
                if (deck == 0)
                {
                    ReturnDeckFromDiscards();
                }

                i               = BitCalculation.GetNthBit(deck, UnityEngine.Random.Range(0, BitCalculation.BitCount(deck)));
                deck           &= ~i;
                exclusionCards |= i;
                count++;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 除外カードを指定数山札に戻す(ランダム)
        /// </summary>
        /// <param name="amount"></param>
        void ReturnDeckFromExclusionCards(int amount)
        {
            if (exclusionCards == 0)
            {
                return;
            }
            Debug.Log("山札:" + System.Convert.ToString(deck, 2));
            int i = BitCalculation.GetNthBit(exclusionCards, UnityEngine.Random.Range(0, BitCalculation.BitCount(exclusionCards)));

            while (amount-- > 0 && exclusionCards != 0)
            {
                exclusionCards &= ~i;
                deck           |= i;

                i = BitCalculation.GetNthBit(exclusionCards, UnityEngine.Random.Range(0, BitCalculation.BitCount(exclusionCards)));
            }

            Debug.Log("山札:" + System.Convert.ToString(deck, 2));
        }
Beispiel #4
0
        /// <summary>
        /// 山札から規定数のカードを手札に加える(ランダム)
        /// </summary>
        void DrawCards()
        {
            int i;
            int count = 0;

            while (count != players[0].Information.Chara.Imagination)
            {
                if (players[0].Information.Deck == 0)
                {
                    ReturnDeckFromDiscards();
                }

                i = BitCalculation.GetNthBit(players[0].Information.Deck, Random.Range(0, BitCalculation.BitCount(players[0].Information.Deck)));
                players[0].Information.Deck  &= ~i;
                players[0].Information.Hands |= i;
                CardOperation.Instance.SetCardInfo(count, players[0].Information.Chara.GetCard(BitCalculation.CheckWhichBitIsOn(i)));
                count++;
            }
            CardOperation.Instance.NumberOfHands = count;
            Debug.Log("山札:" + System.Convert.ToString(players[0].Information.Deck, 2));
            Debug.Log("手札:" + System.Convert.ToString(players[0].Information.Hands, 2));
        }