Example #1
0
    public void EditAllCardLimitDict(int cardID, int changeValue) // 更改某卡牌上限数量
    {
        if (changeValue > 0)
        {
            if (!CardUnlockInfos[cardID])
            {
                CardUnlockInfos[cardID] = true;
            }
        }

        foreach (KeyValuePair <int, BuildInfo> kv in PlayerBuildInfos)
        {
            SortedDictionary <int, BuildCards.CardSelectInfo> csis = kv.Value.M_BuildCards.CardSelectInfos;
            int remainChange = changeValue;
            if (csis[cardID].CardSelectUpperLimit + changeValue >= 0)
            {
                csis[cardID].CardSelectUpperLimit += changeValue;

                if (csis[cardID].CardSelectUpperLimit < csis[cardID].CardSelectCount)
                {
                    csis[cardID].CardSelectCount = csis[cardID].CardSelectUpperLimit;
                }
            }
            else // 如果本身的上限不够扣,则扣掉该系列卡牌的其他牌的上限
            {
                remainChange += csis[cardID].CardSelectUpperLimit;
                csis[cardID].CardSelectUpperLimit = 0;
                List <int> series = AllCards.GetCardSeries(cardID);
                foreach (int i in series)
                {
                    if (csis[i].CardSelectUpperLimit + remainChange >= 0)
                    {
                        csis[i].CardSelectUpperLimit += remainChange;
                        if (csis[i].CardSelectUpperLimit < csis[i].CardSelectCount)
                        {
                            csis[i].CardSelectCount = csis[i].CardSelectUpperLimit;
                        }

                        break;
                    }
                    else
                    {
                        remainChange += csis[i].CardSelectUpperLimit;
                        csis[i].CardSelectUpperLimit = 0;
                        csis[i].CardSelectCount      = 0;
                    }
                }
            }
        }

        int baseCardID = AllCards.GetCardBaseCardID(cardID);

        Base_CardLimitDict[baseCardID] += changeValue;

        InfoRefresh?.Invoke();
    }
Example #2
0
        public override bool IsTrigger(ExecutorInfo executorInfo, ExecutorInfo se_ExecutorInfo)
        {
            BattlePlayer player      = (BattlePlayer)Player;
            bool         playerCheck = false;

            switch (TriggerRange)
            {
            case SideEffectExecute.TriggerRange.SelfPlayer:
                if (executorInfo.ClientId == se_ExecutorInfo.ClientId)
                {
                    playerCheck = true;
                }
                break;

            case SideEffectExecute.TriggerRange.EnemyPlayer:
                if (executorInfo.ClientId != se_ExecutorInfo.ClientId)
                {
                    playerCheck = true;
                }
                break;

            case SideEffectExecute.TriggerRange.OnePlayer:
                playerCheck = true;
                break;

            case SideEffectExecute.TriggerRange.One:
                playerCheck = true;
                break;
            }

            int        cardID       = M_SideEffectParam.GetParam_ConstInt("CardID");
            List <int> cardIDSeries = AllCards.GetCardSeries(cardID);

            if (playerCheck && cardIDSeries.Contains(executorInfo.CardId))
            {
                executorInfo.MechId = se_ExecutorInfo.MechId;
                return(true);
            }
            else
            {
                return(false);
            }
        }