コード例 #1
0
ファイル: BattleManager.cs プロジェクト: tiance7/XianCard
    //使用技能卡
    internal void UseSkillCard(CardInstance cardInstance, CardTemplate template, int targetInstId = 0)
    {
        _battleModel.effectStat = new EffectStatistics();

        Debug.Log("card used:" + cardInstance.tplId);
        int iCost = template.iCost;

        if (-1 == iCost)
        {
            iCost = _battleModel.curCost;
        }

        _battleModel.ReduceCost(iCost);
        _battleModel.effectStat.consumeCost += (uint)iCost;

        HandleCardEffect(cardInstance, template.nEffectId, targetInstId);

        _battleModel.roundStat.lstUsedCard.Add(cardInstance.Clone());
        _battleModel.battleStat.useCardCount += 1;

        //处理卡牌去向
        if (template.bExhaust)
        {
            //消耗
            _battleModel.ExhaustHandCard(cardInstance);
        }
        else
        {
            switch (template.nType)
            {
            case CardType.ATTACK:
            case CardType.SKILL:
                _battleModel.MoveHandCardToUsed(cardInstance);
                break;

            case CardType.FORMATION:
                _battleModel.ConsumeHandCard(cardInstance);
                break;

            default:
                Debug.LogError("unhandle card type:" + template.nType);
                break;
            }
        }
    }