Ejemplo n.º 1
0
    public int execKonjoHP()
    {
        int ret_val = 0;

        if (m_KonjoHP > 0 &&
            m_EnemyHP <= 0
            )
        {
            uint[] enemy_abilitys = getEnemyAbilitys();
            if (enemy_abilitys != null)
            {
                for (int idx = 0; idx < enemy_abilitys.Length; idx++)
                {
                    MasterDataEnemyAbility master_data_enemy_ability = BattleParam.m_MasterDataCache.useEnemyAbility(enemy_abilitys[idx]);
                    if (master_data_enemy_ability != null &&
                        master_data_enemy_ability.category == MasterDataDefineLabel.EnemyAbilityType.KONJO
                        )
                    {
                        float triger_hp_rate = InGameUtilBattle.GetDBRevisionValue(master_data_enemy_ability.Get_KONJO_TRIGER_HP_RATE());
                        if (triger_hp_rate > 0)
                        {
                            int triger_hp = (int)InGameUtilBattle.AvoidErrorMultiple(m_EnemyHPMax, triger_hp_rate);
                            if (triger_hp < 1)
                            {
                                triger_hp = 1;
                            }

                            if (m_KonjoHP >= triger_hp)
                            {
                                float keep_hp_rate = InGameUtilBattle.GetDBRevisionValue(master_data_enemy_ability.Get_KONJO_KEEP_HP_RATE());
                                int   keep_hp      = (int)InGameUtilBattle.AvoidErrorMultiple(m_EnemyHPMax, keep_hp_rate);
                                if (keep_hp < 1)
                                {
                                    keep_hp = 1;
                                }

                                // 発動条件を満たした中で一番残HPが多いものを採用
                                if (keep_hp > ret_val)
                                {
                                    ret_val = keep_hp;
                                }
                            }
                        }
                    }
                }
            }

            //根性発動
            if (ret_val > 0)
            {
                SetHP(ret_val);
            }
        }

        m_KonjoHP = 0;

        return(ret_val);
    }
Ejemplo n.º 2
0
    //-----------------------------------------------------------------------

    /*!
     *  @brief		HPの指定割合以下
     */
    //-----------------------------------------------------------------------
    private bool checkTimingHPRateUnder(int check_hp)
    {
        //--------------------------------
        // HP割合をみる
        //--------------------------------
        float fRate    = (float)InGameUtilBattle.GetDBRevisionValue(check_hp);
        int   nEnemyHP = (int)InGameUtilBattle.AvoidErrorMultiple(m_BattleEnemy.m_EnemyHPMax, fRate);

        //--------------------------------
        //	指定割合"以下"でない物は通さない
        //--------------------------------
        if (m_BattleEnemy.m_EnemyHP > nEnemyHP)
        {
            return(false);
        }

        return(true);
    }
Ejemplo n.º 3
0
    //----------------------------------------------------------------------------

    /*!
     *          @brief		リンクシステム:属性ボーナス:キャラマスター指定
     *          @param[in]	MasterDataParamChara	(cCharaMaster)	キャラマスター
     *          @param[in]	int						(nLevel)		ユニットレベル
     *          @param[in]	int						(nLoLevel)		限界突破レベル
     *          @param[in]	int						(nBonusType)	ボーナスタイプ
     *          @return		int						(nResult)		[+加算値]
     *          @note		HPとATKのボーナス値		※引数でまとめて受け取った方がいいかも
     */
    //----------------------------------------------------------------------------
    static public int GetLinkUnitBonusElement(MasterDataParamChara cCharaMaster, int nLevel, uint nLoLevel, CharaUtil.VALUE nBonusType)
    {
        MasterDataLinkSystem[] acLinkMaster = MasterFinder <MasterDataLinkSystem> .Instance.GetAll();

        int nResult = 0;

        //--------------------------------
        // エラーチェック
        //--------------------------------
        if (acLinkMaster == null ||
            cCharaMaster == null)
        {
            Debug.LogError("MasterDataLinkSystem or MasterDataParamChara Is None!");
            return(nResult);
        }

        int nLimitOverCost = (int)CharaLimitOver.GetParam(nLoLevel, cCharaMaster.limit_over_type, (int)CharaLimitOver.EGET.ePARAM_COST);

        //--------------------------------
        // 基礎値
        //--------------------------------
        float fBaseValue = 1.0f;
        float fCostValue = InGameUtilBattle.AvoidErrorMultiple((float)cCharaMaster.party_cost + nLimitOverCost, RATE_COST);
        float fRareValue = ((int)cCharaMaster.rare + 1) * ((int)cCharaMaster.rare + 1);


        fBaseValue += fCostValue + fRareValue;


        //--------------------------------
        // 属性値
        //--------------------------------
        int   nLinkNum   = 0;
        float fElemValue = 0.0f;


        // ボーナス定義の確定
        for (int num = 0; num < LINK_BONUS_KIND; ++num)
        {
            // ボーナス定義の属性と、リンクユニットの属性が等しい場合
            if (acLinkMaster[num].elem == cCharaMaster.element)
            {
                nLinkNum = num;
                break;
            }
        }

        // ボーナス値の種類による分岐
        switch (nBonusType)
        {
        case CharaUtil.VALUE.POW: fElemValue = InGameUtilBattle.GetDBRevisionValue((float)acLinkMaster[nLinkNum].atk); break;

        case CharaUtil.VALUE.HP: fElemValue = InGameUtilBattle.GetDBRevisionValue((float)acLinkMaster[nLinkNum].hp); break;
        }


        //--------------------------------
        // レベル補正
        //--------------------------------
        float fLevelCorrection = 1.0f;
        float fLevelValue      = InGameUtilBattle.AvoidErrorMultiple((float)nLevel, RATE_LEVEL);


        fLevelCorrection += fLevelValue;


        //--------------------------------
        // 最終結果:属性ボーナス値(基礎値 × 属性値 × Lv補正)※端数切捨て
        //--------------------------------
        float fWork = 0.0f;

        fWork   = InGameUtilBattle.AvoidErrorMultiple(fBaseValue, fElemValue);
        fWork   = InGameUtilBattle.AvoidErrorMultiple(fWork, fLevelCorrection);
        nResult = (int)fWork;

        return(nResult);
    }
Ejemplo n.º 4
0
    //----------------------------------------------------------------------------
    /*!
		@brief	キャラ情報セットアップ:マスターデータ指定
		@param	MasterDataParamChara	cMasterData		キャラマスター
		@param	int						nLevel			キャラレベル
		@param	int						lbsLv			リミットブレイクスキルレベル
		@param	int						nPlusPow		プラス値:攻撃
		@param	int						nPlusHP			プラス値:体力
		@param	int						nLOLevel		プラス値:限界突破値
		@note
	*/
    //----------------------------------------------------------------------------
    public bool CharaSetupFromParam(MasterDataParamChara cMasterData, int nLevel, int lbsLv, int nPlusPow, int nPlusHP, int nLOLevel)
    {
        m_CharaMasterDataParam = cMasterData;
        m_bHasCharaMasterDataParam = (null != m_CharaMasterDataParam);

        if (m_CharaMasterDataParam == null)
        {
            Debug.LogError("CharaSetup Error! - InstanceNone!! ");
            return false;
        }

        // @change Developer 2015/09/03 ver300
        #region ==== 通常処理 ====
        int nPlusValuePow = 0;
        int nPlusValueHP = 0;

        m_CharaLevel = nLevel;
        m_CharaLBSLv = lbsLv;

        float fLimitOverHP = 0;
        float fLimitOverATK = 0;

        #region ==== スキルレベルまるめ処理 ====
        MasterDataSkillLimitBreak cSkillLimitBreak = BattleParam.m_MasterDataCache.useSkillLimitBreak(cMasterData.skill_limitbreak);
        if (cSkillLimitBreak != null)
        {
            if (lbsLv > cSkillLimitBreak.level_max)
            {
                m_CharaLBSLv = cSkillLimitBreak.level_max;
            }
        }
        #endregion

        #region ==== リミットオーバーまるめ処理 ====
        MasterDataLimitOver _masterMainLO = MasterFinder<MasterDataLimitOver>.Instance.Find((int)cMasterData.limit_over_type);
        if (_masterMainLO != null)
        {
            if (nLOLevel > _masterMainLO.limit_over_max)
            {
                nLOLevel = _masterMainLO.limit_over_max;
            }
        }
        #endregion

        m_CharaPow = CharaUtil.GetStatusValue(m_CharaMasterDataParam, nLevel, CharaUtil.VALUE.POW);
        m_CharaDef = CharaUtil.GetStatusValue(m_CharaMasterDataParam, nLevel, CharaUtil.VALUE.DEF);
        m_CharaHP = CharaUtil.GetStatusValue(m_CharaMasterDataParam, nLevel, CharaUtil.VALUE.HP);
        m_CharaLimitBreak = 0;
        m_CharaPlusPow = nPlusPow;
        m_CharaPlusDef = 0;
        m_CharaPlusHP = nPlusHP;
        m_CharaLimitOver = nLOLevel;
        m_CharaCharm = CharaLimitOver.GetParamCharm((uint)nLOLevel, cMasterData.limit_over_type);
        // レベルMAXなら限界突破の値を追加

        float fLimitOverAddHp = CharaLimitOver.GetParam((uint)nLOLevel, cMasterData.limit_over_type, (int)CharaLimitOver.EGET.ePARAM_HP);
        float fLimitOverAddAtk = CharaLimitOver.GetParam((uint)nLOLevel, cMasterData.limit_over_type, (int)CharaLimitOver.EGET.ePARAM_ATK);


        fLimitOverHP = m_CharaHP * (fLimitOverAddHp / 100);
        fLimitOverATK = m_CharaPow * (fLimitOverAddAtk / 100);

        // プラス値を算出
        nPlusValuePow = m_CharaPlusPow * GlobalDefine.PLUS_RATE_POW;
        nPlusValueHP = m_CharaPlusHP * GlobalDefine.PLUS_RATE_HP;
        #endregion

        // @add Developer 2015/09/03 ver300
        #region ==== リンクシステム処理 ====
        int nElemValuePow = 0;
        int nElemValueHP = 0;
        int nRaceValuePow = 0;
        int nRaceValueHP = 0;
        int nLinkPlusValuePow = 0;
        int nLinkPlusValueHP = 0;
        double nLinkCharm = 0;
        // リンク中の場合
        //MasterDataParamChara cLinkCharaMaster = BattleParam.m_MasterDataCache.useCharaParam(m_LinkParam.m_CharaID);
        MasterDataParamChara cLinkCharaMaster = m_LinkParam.m_cCharaMasterDataParam;
        if (cLinkCharaMaster != null)
        {
            float fWork = 0.0f;

            // 属性ボーナスを加算
            nElemValuePow = CharaLinkUtil.GetLinkUnitBonusElement(cLinkCharaMaster, m_LinkParam.m_CharaLv, (uint)m_LinkParam.m_CharaLOLevel, CharaUtil.VALUE.POW);
            nElemValueHP = CharaLinkUtil.GetLinkUnitBonusElement(cLinkCharaMaster, m_LinkParam.m_CharaLv, (uint)m_LinkParam.m_CharaLOLevel, CharaUtil.VALUE.HP);

            // 種族ボーナス:攻撃力の+%値を算出
            fWork = CharaLinkUtil.GetLinkUnitBonusRace(cLinkCharaMaster, cLinkCharaMaster.kind, CharaUtil.VALUE.POW);           // %値取得(メイン)
            fWork += CharaLinkUtil.GetLinkUnitBonusRace(cLinkCharaMaster, cLinkCharaMaster.sub_kind, CharaUtil.VALUE.POW);          // %値取得(サブ)
            fWork = InGameUtilBattle.GetDBRevisionValue(fWork);                                                                 // 数値変換
            nRaceValuePow = (int)InGameUtilBattle.AvoidErrorMultiple((float)m_CharaPow, fWork);                                         // 増加量

            // 種族ボーナス:体力の実値を取得
            nRaceValueHP = (int)CharaLinkUtil.GetLinkUnitBonusRace(cLinkCharaMaster, cLinkCharaMaster.kind, CharaUtil.VALUE.HP);        // 実値取得(メイン)
            nRaceValueHP += (int)CharaLinkUtil.GetLinkUnitBonusRace(cLinkCharaMaster, cLinkCharaMaster.sub_kind, CharaUtil.VALUE.HP);       // 実値取得(サブ)

            // +値の算出
            nLinkPlusValuePow = CharaLinkUtil.GetLinkUnitBonusPlus(m_LinkParam.m_CharaPlusPow, CharaUtil.VALUE.POW);
            nLinkPlusValueHP = CharaLinkUtil.GetLinkUnitBonusPlus(m_LinkParam.m_CharaPlusHP, CharaUtil.VALUE.HP);
            nLinkCharm = CharaLimitOver.GetParamCharm((uint)m_LinkParam.m_CharaLOLevel, cLinkCharaMaster.limit_over_type);
        }
        else
        {
            // リンク用変数の初期化
            m_LinkParam.Setup();
        }
        #endregion

#if BUILD_TYPE_DEBUG
        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "キャラ基本情報"
            + "[" + cMasterData.name + "]"
            + " FixID:" + cMasterData.fix_id
            + " DrawID:" + cMasterData.draw_id
            + " LV:" + m_CharaLevel.ToString()
            + " SkillLV:" + m_CharaLBSLv.ToString()
            + " LimOverLv:" + m_CharaLimitOver.ToString()
            + " PlusPow:" + m_CharaPlusPow.ToString()
            + " PlusHp:" + m_CharaPlusHP.ToString()
            + " 属性:" + cMasterData.element.ToString()
            + " 種族1:" + cMasterData.kind.ToString()
            + " 種族2:" + cMasterData.sub_kind.ToString()
        );

        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "  HP(" + (m_CharaHP + nPlusValueHP + nElemValueHP + nRaceValueHP + nLinkPlusValueHP + (int)fLimitOverHP).ToString() + ")"
            + " = LV(" + m_CharaHP.ToString() + ")"
            + " + PlusHP(" + nPlusValueHP.ToString() + ")"
            + " + LinkElem(" + nElemValueHP.ToString() + ")"
            + " + LinkRace(" + nRaceValueHP.ToString() + ")"
            + " + LinkPlus(" + nLinkPlusValueHP.ToString() + ")"
            + " + LimitOver(" + ((int)fLimitOverHP).ToString() + ")"
            );
        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "  POW(" + (m_CharaPow + nPlusValuePow + nElemValuePow + nRaceValuePow + nLinkPlusValuePow + (int)fLimitOverATK).ToString() + ")"
            + " = LV(" + m_CharaPow.ToString() + ")"
            + " + PlusPow(" + nPlusValuePow.ToString() + ")"
            + " + LinkElem(" + nElemValuePow.ToString() + ")"
            + " + LinkRace(" + nRaceValuePow.ToString() + ")"
            + " + LinkPlus(" + nLinkPlusValuePow.ToString() + ")"
            + " + LimitOver(" + ((int)fLimitOverATK).ToString() + ")"
            );

        const int ADD_SKILL_COUNT_LIMIT = 50;	// スキル連結数の上限

        if (cMasterData.skill_leader != 0)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "   リーダースキル(fixid:" + cMasterData.skill_leader.ToString(), false);
            MasterDataSkillLeader master_data = BattleParam.m_MasterDataCache.useSkillLeader(cMasterData.skill_leader);
            if (master_data == null)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
            }
            else
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
            }
        }

        if (cMasterData.skill_limitbreak != 0)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "   リミブレスキル(fixid:" + cMasterData.skill_limitbreak.ToString(), false);
            MasterDataSkillLimitBreak master_data = BattleParam.m_MasterDataCache.useSkillLimitBreak(cMasterData.skill_limitbreak);
            if (master_data == null)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
            }
            else
            {
                int loop_limit = ADD_SKILL_COUNT_LIMIT;
                int add_fix_id = master_data.add_fix_id;
                while (add_fix_id != 0)
                {
                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + "+" + add_fix_id.ToString(), false);
                    MasterDataSkillLimitBreak add_master_data = BattleParam.m_MasterDataCache.useSkillLimitBreak((uint)add_fix_id);
                    if (add_master_data == null)
                    {
                        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
                        break;
                    }

                    add_fix_id = add_master_data.add_fix_id;
                    loop_limit--;
                    if (loop_limit <= 0)
                    {
                        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(無限ループ))");
                    }
                }

                DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
            }
        }

        if (cMasterData.skill_active0 != 0)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "   ノーマルスキル1(fixid:" + cMasterData.skill_active0.ToString(), false);
            MasterDataSkillActive master_data = BattleParam.m_MasterDataCache.useSkillActive(cMasterData.skill_active0);
            if (master_data == null)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
            }
            else
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
            }
        }

        if (cMasterData.skill_active1 != 0)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "   ノーマルスキル2(fixid:" + cMasterData.skill_active1.ToString(), false);
            MasterDataSkillActive master_data = BattleParam.m_MasterDataCache.useSkillActive(cMasterData.skill_active1);
            if (master_data == null)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
            }
            else
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
            }
        }

        if (cMasterData.skill_passive != 0)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "   パッシブスキル(fixid:" + cMasterData.skill_passive.ToString(), false);
            MasterDataSkillPassive master_data = BattleParam.m_MasterDataCache.useSkillPassive(cMasterData.skill_passive);
            if (master_data == null)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
            }
            else
            {
                int loop_limit = ADD_SKILL_COUNT_LIMIT;
                int add_fix_id = master_data.add_fix_id;
                while (add_fix_id != 0)
                {
                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + "+" + add_fix_id.ToString(), false);
                    MasterDataSkillPassive add_master_data = BattleParam.m_MasterDataCache.useSkillPassive((uint)add_fix_id);
                    if (add_master_data == null)
                    {
                        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
                        break;
                    }

                    add_fix_id = add_master_data.add_fix_id;
                    loop_limit--;
                    if (loop_limit <= 0)
                    {
                        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(無限ループ))");
                    }
                }

                DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
            }
        }

        if (cLinkCharaMaster != null)
        {
            DebugBattleLog.writeText(DebugBattleLog.StrOpe + " リンクキャラ"
                + "[" + cLinkCharaMaster.name + "]"
                + " FixID:" + cLinkCharaMaster.fix_id
                + " DrawID:" + cLinkCharaMaster.draw_id
                + " LV:" + m_LinkParam.m_CharaLv.ToString()
                + " LimOverLv:" + m_LinkParam.m_CharaLOLevel.ToString()
                + " PlusPow:" + m_LinkParam.m_CharaPlusPow.ToString()
                + " PlusHp:" + m_LinkParam.m_CharaPlusHP.ToString()
                + " LinkPoint:" + m_LinkParam.m_CharaLinkPoint.ToString()
            );

            if (cLinkCharaMaster.link_skill_active != 0)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "    リンクスキル(fixid:" + cLinkCharaMaster.link_skill_active.ToString(), false);
                MasterDataSkillActive master_data = BattleParam.m_MasterDataCache.useSkillActive(cLinkCharaMaster.link_skill_active);
                if (master_data == null)
                {
                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
                }
                else
                {
                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
                }
            }

            if (cLinkCharaMaster.link_skill_passive != 0)
            {
                DebugBattleLog.writeText(DebugBattleLog.StrOpe + "    リンクパッシブスキル(fixid:" + cLinkCharaMaster.link_skill_passive.ToString(), false);
                MasterDataSkillPassive master_data = BattleParam.m_MasterDataCache.useSkillPassive(cLinkCharaMaster.link_skill_passive);
                if (master_data == null)
                {
                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
                }
                else
                {
                    int loop_limit = ADD_SKILL_COUNT_LIMIT;
                    int add_fix_id = master_data.add_fix_id;
                    while (add_fix_id != 0)
                    {
                        DebugBattleLog.writeText(DebugBattleLog.StrOpe + "+" + add_fix_id.ToString(), false);
                        MasterDataSkillPassive add_master_data = BattleParam.m_MasterDataCache.useSkillPassive((uint)add_fix_id);
                        if (add_master_data == null)
                        {
                            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(存在しないfix_id))");
                            break;
                        }

                        add_fix_id = add_master_data.add_fix_id;
                        loop_limit--;
                        if (loop_limit <= 0)
                        {
                            DebugBattleLog.writeText(DebugBattleLog.StrOpe + "ERROR!(無限ループ))");
                        }
                    }

                    DebugBattleLog.writeText(DebugBattleLog.StrOpe + ")[" + master_data.name + "]" + master_data.detail);
                }
            }
        }
#endif //BUILD_TYPE_DEBUG


        // 攻撃力、体力の増加値を加算
        m_CharaPow += nPlusValuePow + nElemValuePow + nRaceValuePow + nLinkPlusValuePow + (int)fLimitOverATK;
        m_CharaHP += nPlusValueHP + nElemValueHP + nRaceValueHP + nLinkPlusValueHP + (int)fLimitOverHP;
        m_CharaCharm += nLinkCharm;

        if (m_CharaPow > GlobalDefine.VALUE_MAX_POW)
        {
            m_CharaPow = GlobalDefine.VALUE_MAX_POW;
        }

        if (m_CharaHP > GlobalDefine.VALUE_MAX_HP)
        {
            m_CharaHP = GlobalDefine.VALUE_MAX_HP;
        }

        return true;
    }