예제 #1
0
    //----------------------------------------------------------------------------
    //	@brief		状態異常処理
    //----------------------------------------------------------------------------
    public void SkillUpdate_StatusAilment(BattleSkillActivity activity, int nAtk, BattleSceneUtil.MultiInt nHPMax, BattleEnemy[] enemy_param)
    {
        if (activity == null ||
            activity.m_SkillParamTarget == null ||
            activity.m_statusAilment == null)
        {
            return;
        }


        bool clearOnAttack         = true;
        int  statusAilment_data_id = 0;
        MasterDataStatusAilmentParam statusAilmentParam = null;
        BattleSkillTarget            cBattleTarget      = null;
        BattleSceneManager           battleMgr          = BattleSceneManager.Instance;

        if (battleMgr == null)
        {
            return;
        }


        //	発行された状態異常を全て処理する
        for (int j = 0; j < activity.m_statusAilment.Length; j++)
        {
            statusAilment_data_id = activity.m_statusAilment[j];
            if (statusAilment_data_id == 0)
            {
                continue;
            }


            statusAilmentParam = BattleParam.m_MasterDataCache.useAilmentParam((uint)statusAilment_data_id);
            if (statusAilmentParam == null)
            {
                Debug.LogError("statusAilment Param not found.");
                continue;
            }

            //	遅延のスキルは全員の効果がきれるまで再度この効果をかけることが出来ない
            if (statusAilmentParam.category == MasterDataDefineLabel.AilmentType.FEAR)
            {
                for (int k = 0; k < enemy_param.Length; k++)
                {
                    if (enemy_param[k] == null)
                    {
                        continue;
                    }

                    if (enemy_param[k].isDead() == true)
                    {
                        continue;
                    }

                    if (enemy_param[k].getAttackFlag() == true)
                    {
                        continue;
                    }

                    clearOnAttack = false;
                }
            }

            //	誰かがまだ攻撃をしていない
            if (clearOnAttack == false)
            {
                continue;
            }


            //	状態異常に設定されたターゲットをみて処理
            switch (activity.m_statusAilment_target)
            {
            case MasterDataDefineLabel.TargetType.NONE:
            default:
                break;

            case MasterDataDefineLabel.TargetType.FRIEND:
            case MasterDataDefineLabel.TargetType.SELF:
                //----------------------------------------
                //	プレイヤー側状態異常処理
                //----------------------------------------
            {
                GlobalDefine.PartyCharaIndex target_player = GlobalDefine.PartyCharaIndex.MAX;
                BattleParam.m_PlayerParty.m_Ailments.AddStatusAilmentToPlayerParty(target_player, statusAilment_data_id, nAtk, nHPMax);
            }
            break;

            case MasterDataDefineLabel.TargetType.OTHER:
                //----------------------------------------
                //	敵単体(スキル側で指定されたターゲット)
                //----------------------------------------
            {
                bool ailmentAddResult = false;

                for (int i = 0; i < activity.m_SkillParamTarget.Length; i++)
                {
                    cBattleTarget = activity.m_SkillParamTarget[i];
                    if (cBattleTarget == null)
                    {
                        continue;
                    }

                    BattleEnemy enemyParam = enemy_param[cBattleTarget.m_TargetNum];
                    if (enemyParam == null)
                    {
                        continue;
                    }

                    if (enemyParam.isDead() == true)
                    {
                        continue;
                    }


                    // 状態異常処理
                    // @change Developer 2016/02/23 v330 毒[最大HP割合]対応
                    ailmentAddResult = enemyParam.m_StatusAilmentChara.AddStatusAilment(statusAilment_data_id, nAtk, enemyParam.m_EnemyHPMax, enemyParam.getMasterDataParamChara());

                    // NEXTのターンを加算(特殊処理)
                    // 上限数以上の場合、遅延効果が発動しないように修正		@20150512 Developer
                    if (statusAilmentParam.category == MasterDataDefineLabel.AilmentType.FEAR &&
                        ailmentAddResult == true)
                    {
                        int nTurn = (int)RandManager.GetRand((uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MIN(),
                                                             (uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MAX());
                        enemyParam.AddTurn(nTurn);
                    }
                }
            }
            break;

            case MasterDataDefineLabel.TargetType.ENEMY:
            case MasterDataDefineLabel.TargetType.ENE_N_1:
            case MasterDataDefineLabel.TargetType.ENE_1N_1:
            case MasterDataDefineLabel.TargetType.ENE_R_N:
            case MasterDataDefineLabel.TargetType.ENE_1_N:
                //----------------------------------------
                //	敵全体
                //----------------------------------------
            {
                BattleEnemy enemyParam       = null;
                bool        ailmentAddResult = false;

                for (int k = 0; k < enemy_param.Length; k++)
                {
                    enemyParam = enemy_param[k];
                    if (enemyParam == null)
                    {
                        continue;
                    }

                    if (enemyParam.isDead() == true)
                    {
                        continue;
                    }


                    // 状態異常処理
                    // @change Developer 2016/02/23 v330 毒[最大HP割合]対応
                    ailmentAddResult = enemyParam.m_StatusAilmentChara.AddStatusAilment(statusAilment_data_id, nAtk, enemyParam.m_EnemyHPMax, enemyParam.getMasterDataParamChara());

                    // NEXTのターンを加算(特殊処理)
                    // 上限数以上の場合、遅延効果が発動しないように修正		@20150512 Developer
                    if (statusAilmentParam.category == MasterDataDefineLabel.AilmentType.FEAR &&
                        ailmentAddResult == true)
                    {
                        int nTurn = (int)RandManager.GetRand((uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MIN(),
                                                             (uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MAX());
                        enemyParam.AddTurn(nTurn);
                    }
                }
            }
            break;

            case MasterDataDefineLabel.TargetType.ALL:
                //----------------------------------------
                //	全員
                //----------------------------------------
            {
                //	プレイヤー側状態異常処理
                GlobalDefine.PartyCharaIndex target_player = GlobalDefine.PartyCharaIndex.MAX;
                BattleParam.m_PlayerParty.m_Ailments.AddStatusAilmentToPlayerParty(target_player, statusAilment_data_id, nAtk, nHPMax);

                BattleEnemy enemyParam       = null;
                bool        ailmentAddResult = false;

                //	敵全体
                for (int k = 0; k < enemy_param.Length; k++)
                {
                    enemyParam = enemy_param[k];
                    if (enemyParam == null)
                    {
                        continue;
                    }

                    if (enemyParam.isDead() == true)
                    {
                        continue;
                    }


                    // 状態異常処理
                    // @change Developer 2016/02/23 v330 毒[最大HP割合]対応
                    ailmentAddResult = enemyParam.m_StatusAilmentChara.AddStatusAilment(statusAilment_data_id, nAtk, enemyParam.m_EnemyHPMax, enemyParam.getMasterDataParamChara());

                    // NEXTのターンを加算(特殊処理)
                    // 上限数以上の場合、遅延効果が発動しないように修正		@20150512 Developer
                    if (statusAilmentParam.category == MasterDataDefineLabel.AilmentType.FEAR &&
                        ailmentAddResult == true)
                    {
                        int nTurn = (int)RandManager.GetRand((uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MIN(),
                                                             (uint)statusAilmentParam.Get_ABSTATE_LATE_TURN_MAX());
                        enemyParam.AddTurn(nTurn);
                    }
                }
            }
            break;
            }
        }
    }