コード例 #1
0
    public static PFTable.CardEffect.EType GetCardEffectType(int cardEffectId)
    {
        PFTable.CardEffect cardEffect = PFTable.GetCardEffect(cardEffectId);
        if (cardEffect != null)
        {
            return(cardEffect.CardEffectType);
        }

        return(PFTable.CardEffect.EType.Invalid);
    }
コード例 #2
0
    private void OnUseCard(APFCharacterController srcCharCtrl, PFTable.Card srcCard, APFCharacterController target_clickedChar)
    {
        if (srcCharCtrl != null && srcCard != null)
        {
            EGameResult gameResult = EGameResult.InProgress;

            PFTable.ECardActiveType cardActiveType = PFCardTable.GetCardActiveType(srcCard.uid);
            //if (cardActiveType == PFTable.ECardActiveType.Instant)
            {
                List <APFCharacterController> targetList = GetTargetList(srcCard, target_clickedChar);

                int damage = PFSkill.GetDamage(srcCharCtrl, srcCard.uid);

                for (int i = 0; i < targetList.Count; ++i)
                {
                    targetList[i].OnBeAttacked(damage);

                    srcCharCtrl.OnUseCard_AfterApplyDmg(srcCard, targetList[i]);

                    if (targetList[i].GetHP() <= PFConst.HP_Min)
                    {
                        gameResult = OnCharacterDead(targetList[i]);
                    }
                }
            }



            int[] cardEffectIdList = srcCard.CardEffectIdList;
            if (cardEffectIdList != null)
            {
                for (int i = 0; i < cardEffectIdList.Length; ++i)
                {
                    //PFTable.CardEffect.EType cardEffectType = PFCardEffectTable.GetCardEffectType(cardEffectIdList[i]);
                    //if (cardEffectType == PFTable.CardEffect.EType.DecreaseHP)
                    //{

                    //}

                    int effectId = cardEffectIdList[i];



                    PFTable.Damage effect_Damage = PFTable.GetEffect_Damage(effectId);
                    if (effect_Damage != null)
                    {
                        if (effect_Damage.ActuationTiming == PFTable.EActuationTiming.Instant)
                        {
                            DoDamage(srcCharCtrl, effectId, target_clickedChar);
                            //StartCoroutine(DoDamage(srcCharCtrl, effectId, target_clickedChar));

                            /*
                             * if (targetList[j].GetHP() <= PFConst.HP_Min)
                             * {
                             *  gameResult = OnCharacterDead(targetList[j]);
                             * }
                             */
                        }
                        else
                        {
                            srcCharCtrl.PendingEffect_DamageList.Add(effectId);
                        }
                    }

                    PFTable.AddAtkRate addAtkRate = PFTable.GetAddAtkRate(effectId);
                    if (addAtkRate != null)
                    {
                        //addAtkRate.Amount
                        //addAtkRate.TargetType
                        if (addAtkRate.ActuationTiming == PFTable.EActuationTiming.Instant)
                        {
                        }
                    }



                    PFTable.CardEffect cardEffect = PFTable.GetCardEffect(effectId);
                    if (cardEffect != null)
                    {
                        if (cardEffect.CardEffectType == PFTable.CardEffect.EType.DecreaseHP)
                        {
                            //cardEffect.Amount
                        }
                    }
                }
            }



            if (gameResult == EGameResult.InProgress)
            {
                PFTable.CharacterType srcCharType = PFCharacterTable.GetCharacterType(srcCharCtrl.CharacterTableId);
                if (srcCharType == PFTable.CharacterType.Monster)
                {
                    int remainCost = srcCharCtrl.GetCost();
                    if (remainCost <= 0)
                    {
                        TurnEnd(srcCharCtrl);
                    }
                }
            }
            else if (gameResult == EGameResult.Victory)
            {
                GameOverUI.Title_UILabel.text = PFConst.StrGameResultVictory;
                GameOverUI.gameObject.SetActive(true);
            }
            else if (gameResult == EGameResult.Defeat)
            {
                GameOverUI.Title_UILabel.text = PFConst.StrGameResultDefeat;
                GameOverUI.gameObject.SetActive(true);
            }
        }
    }