//-----------------------------------------------------------------------

    /*!
     *  @brief		単発アクション[初回]があるか確認
     */
    //-----------------------------------------------------------------------
    public MasterDataEnemyActionParam GetActionFirstAttack()
    {
        if (m_BattleEnemy == null)
        {
            return(null);
        }


        MasterDataParamEnemy enemyParam = m_BattleEnemy.getMasterDataParamEnemy();

        if (enemyParam == null)
        {
            return(null);
        }


        //--------------------------------
        //	指定フェイズにアクションが設定されているか
        //--------------------------------
        if (enemyParam.act_first == 0)
        {
            return(null);
        }

        //		return MasterDataUtil.GetMasterDataEnemyActionParam( enemyParam.act_first );
        return(BattleParam.m_MasterDataCache.useEnemyActionParam((uint)enemyParam.act_first));
    }
Example #2
0
    //----------------------------------------------------------------------------
    /*!
		@brief	キャラ情報セットアップ:エネミーマスターデータ指定
		@param	MasterDataParamEnemy	cMasterData		エネミーマスター
	*/
    //----------------------------------------------------------------------------
    public bool CharaSetupFromParamEnemy(MasterDataParamEnemy cMasterData)
    {
        m_CharaMasterDataParam = BattleParam.m_MasterDataCache.useCharaParam(cMasterData.chara_id);
        m_bHasCharaMasterDataParam = (null != m_CharaMasterDataParam);

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

        m_CharaLevel = 1;
        m_CharaLBSLv = 0;
        m_CharaPow = cMasterData.status_pow;
        m_CharaDef = cMasterData.status_def;
        m_CharaHP = cMasterData.status_hp;
        m_CharaLimitBreak = 0;
        m_CharaPlusPow = 0;
        m_CharaPlusDef = 0;
        m_CharaPlusHP = 0;

        // @add Developer 2015/09/03 ver300
        // リンク用変数の初期化
        m_LinkParam.Setup();

        return true;
    }
Example #3
0
    public int[] getEnemyAbilityTurns()
    {
        int[] ret_val = null;

        MasterDataParamEnemy master_data_param_enemy = m_MasterDataParamEnemy;

        if (master_data_param_enemy != null)
        {
            const int FIXED_ABILITY_TURN = 0;   // 追加分でない敵特性のターン数(ターン経過してもこの値から変化しない)

            ret_val = new int[EnemyAbility.ENEMY_ABILITY_MAX];

            ret_val[0] = FIXED_ABILITY_TURN;
            ret_val[1] = FIXED_ABILITY_TURN;
            ret_val[2] = FIXED_ABILITY_TURN;
            ret_val[3] = FIXED_ABILITY_TURN;
            ret_val[4] = FIXED_ABILITY_TURN;
            ret_val[5] = FIXED_ABILITY_TURN;
            ret_val[6] = FIXED_ABILITY_TURN;
            ret_val[7] = FIXED_ABILITY_TURN;

            for (int idx = 0; idx < m_AdditionalEnemyAbilityIDs.Length; idx++)
            {
                ret_val[idx + EnemyAbility.ENEMY_ABILITY_DEFAULT_MAX] = m_AdditionalEnemyAbilityTurns[idx];
            }
        }

        return(ret_val);
    }
Example #4
0
    public uint[] getEnemyAbilitys()
    {
        uint[] ret_val = null;

        MasterDataParamEnemy master_data_param_enemy = m_MasterDataParamEnemy;

        if (master_data_param_enemy != null)
        {
            ret_val = new uint[EnemyAbility.ENEMY_ABILITY_MAX];

            ret_val[0] = master_data_param_enemy.ability1;
            ret_val[1] = master_data_param_enemy.ability2;
            ret_val[2] = master_data_param_enemy.ability3;
            ret_val[3] = master_data_param_enemy.ability4;
            ret_val[4] = master_data_param_enemy.ability5;
            ret_val[5] = master_data_param_enemy.ability6;
            ret_val[6] = master_data_param_enemy.ability7;
            ret_val[7] = master_data_param_enemy.ability8;

            for (int idx = 0; idx < m_AdditionalEnemyAbilityIDs.Length; idx++)
            {
                ret_val[idx + EnemyAbility.ENEMY_ABILITY_DEFAULT_MAX] = m_AdditionalEnemyAbilityIDs[idx];
            }
        }

        return(ret_val);
    }
Example #5
0
    private MasterDataParamEnemy searchEnemy(int enemy_id)
    {
        MasterDataParamEnemy ret_val = null;

        int index = searchEnemyIndex(enemy_id);

        ret_val = m_MasterDataParamEnemys[index];

        return(ret_val);
    }
Example #6
0
    private void initEnemy(int enemy_id)
    {
        if (m_BattleDispEnemy != null && m_MasterDataParamEnemys != null)
        {
            //MasterDataParamEnemy enemy_master = searchEnemy(enemy_id);
            int index = searchEnemyIndex(enemy_id);
            MasterDataParamEnemy enemy_master = m_MasterDataParamEnemys[index];

            if (enemy_master != null)
            {
                MasterDataParamChara chara_master = MasterFinder <MasterDataParamChara> .Instance.Find((int)enemy_master.chara_id);

                if (chara_master != null)
                {
                    MasterDataParamEnemy wrk_enemy_master = new MasterDataParamEnemy();
                    wrk_enemy_master.Copy(enemy_master); //元のマスターデータに影響が出ないようにコピーを作成
                    BattleEnemy battle_enemy = null;
                    {
                        battle_enemy = new BattleEnemy();
                        battle_enemy.setMasterData(wrk_enemy_master, chara_master);
                        battle_enemy.m_EnemyAttack        = enemy_master.status_pow;
                        battle_enemy.m_EnemyDefense       = enemy_master.status_def;
                        battle_enemy.m_EnemyHP            = enemy_master.status_hp;
                        battle_enemy.m_EnemyHPMax         = enemy_master.status_hp;
                        battle_enemy.m_EnemyDrop          = 0;
                        battle_enemy.m_StatusAilmentChara = new StatusAilmentChara(StatusAilmentChara.OwnerType.ENEMY);
                        battle_enemy.setAcquireDropUnit(false);
                    }
                    m_CurrentBattleEnemy   = battle_enemy;
                    m_CurrentEnemyDispInfo = m_EnemyDispInfos[index];

                    setInfoToInteface();
                    setInfoToWorkMaster();

                    m_BattleEnemys    = new BattleEnemy[1];
                    m_BattleEnemys[0] = battle_enemy;

                    m_BattleDispEnemy.instanceObject(m_BattleEnemys);

                    m_BattleDispEnemy.gameObject.SetLayerRecursively(LayerMask.NameToLayer("BATTLE")); // レイヤーを設定し直し

                    m_BattleDispEnemy.showTargetCursor(0);                                             // ターゲットカーソルを表示
                }
            }
            else
            {
                m_BattleDispEnemy.instanceObject(null);
            }
        }
    }
Example #7
0
    /// <summary>
    /// 敵マスターをサーチ(enemy_idぴったりのIDがない場合は近い値の物を取得)
    /// </summary>
    /// <param name="enemy_id"></param>
    /// <returns></returns>
    private int searchEnemyIndex(int enemy_id)
    {
        int ret_val = 0;

        if (m_MasterDataParamEnemys != null)
        {
            for (int idx = 0; idx < m_MasterDataParamEnemys.Length; idx++)
            {
                MasterDataParamEnemy enemy_master = m_MasterDataParamEnemys[idx];
                if (enemy_master != null && enemy_master.fix_id >= enemy_id)
                {
                    ret_val = idx;
                    break;
                }
            }
        }

        return(ret_val);
    }
Example #8
0
    //----------------------------------------------------------------------------

    /*!
     *  @brief	デフォルトコンストラクタ
     */
    //----------------------------------------------------------------------------
    public BattleEnemy()
    {
        m_EnemyID = 0;
        m_MasterDataParamEnemy = null; // 敵情報:敵マスターデータ
        m_MasterDataParamChara = null; // 敵情報:敵マスターデータ

        m_EnemyTurn          = 0;      // 敵情報:敵ターン
        m_EnemyHP            = 10;     // 敵情報:HP
        m_EnemyHPMax         = 10;     // 敵情報:HP最大
        m_EnemyAttack        = 10;     // 敵情報:攻撃力
        m_EnemyDefense       = 10;     // 敵情報:防御力
        m_EnemyDrop          = 0;      // 敵情報:撃破時ドロップ
        m_StatusAilmentChara = null;   // 敵情報:状態異常管理番号
        m_Attack             = true;   // ターン遅延がかかってから攻撃を行ったかどうか

        m_EnemyActionTableControl = new EnemyActionTableControl();
        m_EnemyActionTableControl.m_BattleEnemy = this;
        m_AdditionalEnemyAbilityIDs             = new uint[EnemyAbility.ENEMY_ABILITY_ADD_MAX];
        m_AdditionalEnemyAbilityTurns           = new int[EnemyAbility.ENEMY_ABILITY_ADD_MAX];
    }
Example #9
0
    private void setInfoToWorkMaster()
    {
        m_CallCount++;
        if (m_CurrentBattleEnemy != null && m_CurrentEnemyDispInfo != null)
        {
            MasterDataParamEnemy enemy_master = m_CurrentBattleEnemy.getMasterDataParamEnemy(); // このBattleEnemyの敵マスターは一時コピーなので書き換えてOK.

            enemy_master.pos_absolute = (m_CurrentEnemyDispInfo.m_IsUsePosition ? MasterDataDefineLabel.BoolType.ENABLE : MasterDataDefineLabel.BoolType.NONE);
            enemy_master.posx_offset  = m_CurrentEnemyDispInfo.m_PositionX;
            enemy_master.posy_offset  = m_CurrentEnemyDispInfo.m_PositionY;

            enemy_master.hp_gauge_type  = m_CurrentEnemyDispInfo.m_HpGaugeType;
            enemy_master.hp_posx_offset = m_CurrentEnemyDispInfo.m_HpGaugeX;
            enemy_master.hp_posy_offset = m_CurrentEnemyDispInfo.m_HpGaugeY;

            enemy_master.target_pos_absolute = (m_CurrentEnemyDispInfo.m_IsUseTargetPosition ? (int)MasterDataDefineLabel.BoolType.ENABLE : (int)MasterDataDefineLabel.BoolType.NONE);
            enemy_master.target_posx_offset  = m_CurrentEnemyDispInfo.m_TargetX;
            enemy_master.target_posy_offset  = m_CurrentEnemyDispInfo.m_TargetY;
        }
        m_CallCount--;
    }
Example #10
0
    private void initMasterData()
    {
        // sort
        if (m_MasterDataParamEnemys != null)
        {
            List <MasterDataParamEnemy> aaa = new List <MasterDataParamEnemy>(m_MasterDataParamEnemys);
            aaa.Sort((a, b) => (int)a.fix_id - (int)b.fix_id);
            m_MasterDataParamEnemys = aaa.ToArray();
        }

        // 位置補正情報を初期化
        if (m_MasterDataParamEnemys != null)
        {
            m_EnemyDispInfos = new EnemyDispInfo[m_MasterDataParamEnemys.Length];
            for (int idx = 0; idx < m_EnemyDispInfos.Length; idx++)
            {
                MasterDataParamEnemy enemy_master = m_MasterDataParamEnemys[idx];
                if (enemy_master != null)
                {
                    EnemyDispInfo disp_info = new EnemyDispInfo();
                    disp_info.m_OriginalMasterData = enemy_master;

                    disp_info.m_IsUsePosition = (enemy_master.pos_absolute == MasterDataDefineLabel.BoolType.ENABLE);
                    disp_info.m_PositionX     = enemy_master.posx_offset;
                    disp_info.m_PositionY     = enemy_master.posy_offset;

                    disp_info.m_HpGaugeType = enemy_master.hp_gauge_type;
                    disp_info.m_HpGaugeX    = enemy_master.hp_posx_offset;
                    disp_info.m_HpGaugeY    = enemy_master.hp_posy_offset;

                    disp_info.m_IsUseTargetPosition = (enemy_master.target_pos_absolute == (int)MasterDataDefineLabel.BoolType.ENABLE);
                    disp_info.m_TargetX             = enemy_master.target_posx_offset;
                    disp_info.m_TargetY             = enemy_master.target_posy_offset;

                    m_EnemyDispInfos[idx] = disp_info;
                }
            }
        }
    }
    /// <summary>
    /// 現在の条件を満たした敵行動テーブルを検索
    /// </summary>
    /// <param name="battle_total_turn"></param>
    /// <returns></returns>
    private MasterDataEnemyActionTable searchCurrentMasterDataEnemyActionTable(int battle_total_turn)
    {
        if (m_BattleEnemy == null)
        {
            return(null);
        }

        MasterDataParamEnemy enemy_param = m_BattleEnemy.getMasterDataParamEnemy();

        if (enemy_param == null)
        {
            return(null);
        }

        List <MasterDataEnemyActionTable> enemy_action_tables = new List <MasterDataEnemyActionTable>();

        {
            int[] table_id_array =
            {
                enemy_param.act_table1,
                enemy_param.act_table2,
                enemy_param.act_table3,
                enemy_param.act_table4,
                enemy_param.act_table5,
                enemy_param.act_table6,
                enemy_param.act_table7,
                enemy_param.act_table8
            };

            for (int idx = 0; idx < table_id_array.Length; idx++)
            {
                MasterDataEnemyActionTable enemy_action_table = BattleParam.m_MasterDataCache.useEnemyActionTable((uint)table_id_array[idx]);
                if (enemy_action_table != null)
                {
                    enemy_action_tables.Add(enemy_action_table);
                }
            }

            // 優先度、降順にソート
            enemy_action_tables.Sort((a, b) => b.timing_priority - a.timing_priority);
        }

        MasterDataEnemyActionTable ret_val = null;

        for (int priority_idx = 0; priority_idx < enemy_action_tables.Count; priority_idx++)
        {
            MasterDataEnemyActionTable enemy_action_table = enemy_action_tables[priority_idx];

            bool is_cond = true;
            for (int cond_idx = 0; cond_idx < enemy_action_table.Get_timing_type_count(); cond_idx++)
            {
                MasterDataDefineLabel.EnemyACTPatternSelectType timing_type = enemy_action_table.Get_timing_type(cond_idx);
                int timing_type_param = enemy_action_table.Get_timing_type_param(cond_idx);

                switch (timing_type)
                {
                case MasterDataDefineLabel.EnemyACTPatternSelectType.HP:
                    if (checkTimingHPRate(timing_type_param) == false)
                    {
                        is_cond = false;
                    }
                    break;

                case MasterDataDefineLabel.EnemyACTPatternSelectType.HP_UNDER:
                    if (checkTimingHPRateUnder(timing_type_param) == false)
                    {
                        is_cond = false;
                    }
                    break;

                case MasterDataDefineLabel.EnemyACTPatternSelectType.TURN:
                    if (checkTimingTotalTurn(battle_total_turn, timing_type_param) == false)
                    {
                        is_cond = false;
                    }
                    break;
                }

                if (is_cond == false)
                {
                    break;
                }
            }

            if (is_cond)
            {
                ret_val = enemy_action_table;
                break;
            }
        }

        return(ret_val);
    }
Example #12
0
    }                                           //!< ターゲットカーソル:位置オフセットY


    /// <summary>
    /// コピー
    /// </summary>
    /// <param name="cSrc"></param>
    public void Copy(MasterDataParamEnemy src)
    {
        base.Copy(src);

        timing_public = src.timing_public;
        chara_id      = src.chara_id;

        status_hp   = src.status_hp;
        status_pow  = src.status_pow;
        status_def  = src.status_def;
        status_turn = src.status_turn;

        acquire_money = src.acquire_money;
        acquire_exp   = src.acquire_exp;

        drop_unit_id = src.drop_unit_id;

        drop_unit_level = src.drop_unit_level;
        drop_unit_rate  = src.drop_unit_rate;
        drop_plus_pow   = src.drop_plus_pow;
        drop_plus_hp    = src.drop_plus_hp;
        drop_plus_none  = src.drop_plus_none;

        drop_money_value = src.drop_money_value;
        drop_money_rate  = src.drop_money_rate;

        act_table1 = src.act_table1;
        act_table2 = src.act_table2;
        act_table3 = src.act_table3;
        act_table4 = src.act_table4;
        act_table5 = src.act_table5;
        act_table6 = src.act_table6;
        act_table7 = src.act_table7;
        act_table8 = src.act_table8;

        act_first = src.act_first;
        act_dead  = src.act_dead;

        ability1 = src.ability1;
        ability2 = src.ability2;
        ability3 = src.ability3;
        ability4 = src.ability4;
        ability5 = src.ability5;
        ability6 = src.ability6;
        ability7 = src.ability7;
        ability8 = src.ability8;

        posz_value = src.posz_value;

        pos_absolute = src.pos_absolute;
        posx_offset  = src.posx_offset;
        posy_offset  = src.posy_offset;

        hp_gauge_type  = src.hp_gauge_type;
        hp_posx_offset = src.hp_posx_offset;
        hp_posy_offset = src.hp_posy_offset;

        target_pos_absolute = src.target_pos_absolute;
        target_posx_offset  = src.target_posx_offset;
        target_posy_offset  = src.target_posy_offset;
    }
Example #13
0
 public void setMasterData(MasterDataParamEnemy master_data_param_enemy, MasterDataParamChara master_data_param_chara)
 {
     m_EnemyID = (int)master_data_param_enemy.fix_id;
     m_MasterDataParamEnemy = master_data_param_enemy;
     m_MasterDataParamChara = master_data_param_chara;
 }
Example #14
0
    // Update is called once per frame
    void Update()
    {
        if (DebugOptionInGame.Instance == null)
        {
            return;
        }

        if (m_TestGameManager == null)
        {
            return;
        }

        switch (m_Status)
        {
        case eStatus.API_QUEST_START:
        {
            if (DebugOptionInGame.Instance.inGameDebugDO.m_UseAPI == true)
            {
                m_HelperIndex = RandManager.GetRand(0, (uint)(UserDataAdmin.Instance.m_StructHelperList.Length - 1));
                PacketStructFriend cHelper = null;
                if (UserDataAdmin.Instance.m_StructFriendList.Length > 0 &&
                    UserDataAdmin.Instance.m_StructFriendList[0] != null)
                {
                    cHelper = UserDataAdmin.Instance.m_StructFriendList[0];
                }
                else if (UserDataAdmin.Instance.m_StructHelperList.Length > 0)
                {
                    cHelper = UserDataAdmin.Instance.m_StructHelperList[m_HelperIndex];
                }
                {
                    ServerDataUtilSend.SendPacketAPI_Quest2Start(
                        DebugOptionInGame.Instance.inGameDebugDO.m_QuestId,
                        0,
                        cHelper.user_id,
                        cHelper.unit,
                        false,
                        UserDataAdmin.Instance.m_StructPlayer.unit_party_current,
                        0,
                        0,
                        null,
                        false
                        )
                    .setSuccessAction(_data =>
                        {
                            if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                            {
                                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                            }
                            SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = _data.GetResult <RecvQuest2Start>().result.quest;
                            m_Status = eStatus.DATA_CREATE;
                        })
                    .setErrorAction(data =>
                        {
                            Debug.LogErrorFormat("[TestGameMain] Quest2Start API Error [{0}] : QuestId = {1}", data.m_PacketCode.ToString(), DebugOptionInGame.Instance.inGameDebugDO.m_QuestId.ToString());
                            m_TestGameManager.Message_text = "API Error\r\n [" + data.m_PacketCode.ToString() + "]";
                        })
                    .SendStart();
                    m_Status = eStatus.NONE;
                }
            }
            else
            {
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                }
                {
                    MasterDataQuest2        masterDataQuest2 = MasterDataUtil.GetQuest2ParamFromID(DebugOptionInGame.Instance.inGameDebugDO.m_QuestId);
                    PacketStructQuest2Build cQuestBuild      = new PacketStructQuest2Build();
                    int floor_size = 2;
                    //----------------------------------------
                    // 最終的な構築情報を格納する領域を確保
                    //----------------------------------------
                    TemplateList <PacketStructQuest2BuildBattle> acQuestBuildBattle = new TemplateList <PacketStructQuest2BuildBattle>();
                    TemplateList <PacketStructQuest2BuildDrop>   acQuestBuildDrop   = new TemplateList <PacketStructQuest2BuildDrop>();
                    acQuestBuildBattle.Alloc(64);

                    int nFloorDataAccess = 0;
                    cQuestBuild.boss = new int[floor_size];

                    for (int i = 0; i < floor_size; i++)
                    {
                        nFloorDataAccess = (i - 1);
                        if (nFloorDataAccess < 0)
                        {
                            continue;
                        }
                        //----------------------------------------
                        //	0番目要素ダミーデータの入力
                        //----------------------------------------
                        PacketStructQuest2BuildBattle build_param_battle = new PacketStructQuest2BuildBattle();
                        if (build_param_battle != null)
                        {
                            build_param_battle.unique_id         = 0;
                            build_param_battle.enemy_list        = null;
                            build_param_battle.drop_list         = null;
                            build_param_battle.chain             = 0;
                            build_param_battle.chain_turn_offset = 0;
                            build_param_battle.bgm_id            = 0;

                            acQuestBuildBattle.Add(build_param_battle);
                        }

                        //----------------------------------------
                        // 戦闘情報を設定
                        //----------------------------------------
                        int battle_num = MasterDataUtil.GetQuest2BattleNum(masterDataQuest2.fix_id);
                        for (int j = 0; j < battle_num; j++)
                        {
                            uint enemy_group_id = MasterDataUtil.GetQuest2EnemyGroup(masterDataQuest2.fix_id, j);
                            if (enemy_group_id == 0)
                            {
                                continue;
                            }

                            MasterDataEnemyGroup acMasterGroupEnemy = ServerFogery_GetEnemyGroupFromID(enemy_group_id);
                            if (acMasterGroupEnemy == null)
                            {
                                Debug.LogError("EnemyGroup not found id = " + enemy_group_id);
                                continue;
                            }
                            CreateQuestBuildBattle(
                                i
                                , ref acQuestBuildBattle
                                , ref acQuestBuildDrop
                                , acMasterGroupEnemy
                                );
                        }
                        //----------------------------------------
                        // ボス戦闘情報を設定
                        //----------------------------------------
                        cQuestBuild.boss[i] = 0;
                        if (masterDataQuest2.boss_group_id > 0)
                        {
                            MasterDataEnemyGroup cBossEnemyGroup = ServerFogery_GetEnemyGroupFromID(masterDataQuest2.boss_group_id);
                            if (cBossEnemyGroup != null)
                            {
                                cQuestBuild.boss[i] = CreateQuestBuildBattle(
                                    i
                                    , ref acQuestBuildBattle
                                    , ref acQuestBuildDrop
                                    , cBossEnemyGroup
                                    );
                            }
                            else
                            {
                                Debug.LogError("EnemyGroup not found Boss id = " + masterDataQuest2.boss_group_id);
                            }
                        }
                    }

                    TemplateList <MasterDataParamEnemy>       e_param_list     = new TemplateList <MasterDataParamEnemy>();
                    TemplateList <MasterDataEnemyActionParam> e_act_param_list = new TemplateList <MasterDataEnemyActionParam>();
                    TemplateList <MasterDataEnemyActionTable> e_act_table_list = new TemplateList <MasterDataEnemyActionTable>();

                    for (int i = 0; i < acQuestBuildBattle.m_BufferSize; i++)
                    {
                        if (acQuestBuildBattle[i] == null)
                        {
                            continue;
                        }

                        if (acQuestBuildBattle[i].enemy_list == null)
                        {
                            continue;
                        }

                        for (int j = 0; j < acQuestBuildBattle[i].enemy_list.Length; j++)
                        {
                            if (acQuestBuildBattle[i].enemy_list[j] == 0)
                            {
                                continue;
                            }

                            MasterDataParamEnemy enemy_param = ServerForgery_GetEnemyParamFromID(acQuestBuildBattle[i].enemy_list[j]);
                            e_param_list.Add(enemy_param);

                            int[] table_id = { enemy_param.act_table1,
                                               enemy_param.act_table2,
                                               enemy_param.act_table3,
                                               enemy_param.act_table4,
                                               enemy_param.act_table5,
                                               enemy_param.act_table6,
                                               enemy_param.act_table7,
                                               enemy_param.act_table8 };

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

                                MasterDataEnemyActionTable table = ServerFogery_GetEnemyActionTable(table_id[k]);
                                e_act_table_list.Add(table);

                                int[] action_id = { table.action_param_id1,
                                                    table.action_param_id2,
                                                    table.action_param_id3,
                                                    table.action_param_id4,
                                                    table.action_param_id5,
                                                    table.action_param_id6,
                                                    table.action_param_id7,
                                                    table.action_param_id8 };

                                for (int l = 0; l < action_id.Length; l++)
                                {
                                    e_act_param_list.Add(GetEnemyActionParam(action_id[l]));
                                }
                            }
                        }
                    }


                    //----------------------------------------
                    // 構築した動的要素を配列化して受け渡し
                    //----------------------------------------
                    cQuestBuild.list_drop       = acQuestBuildDrop.ToArray();
                    cQuestBuild.list_battle     = acQuestBuildBattle.ToArray();
                    cQuestBuild.list_e_param    = e_param_list.ToArray();
                    cQuestBuild.list_e_actparam = e_act_param_list.ToArray();
                    cQuestBuild.list_e_acttable = e_act_table_list.ToArray();

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = cQuestBuild;
                }
                m_Status = eStatus.DATA_CREATE;
            }
        }
        break;

        case eStatus.DATA_CREATE:
        {
            {
                MasterDataQuest2 masterDataQuest = MasterDataUtil.GetQuest2ParamFromID(DebugOptionInGame.Instance.inGameDebugDO.m_QuestId);
                //----------------------------------------
                // ダミーパラメータを設定
                //----------------------------------------
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2 == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2 = new SceneGoesParamToQuest2();
                }
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestAreaID    = masterDataQuest.area_id;
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestMissionID = masterDataQuest.fix_id;
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_QuestRandSeed  = RandManager.GetRand();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_IsUsedAutoPlay = false;

                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param = new UserDataUnitParam();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param = new UserDataUnitParam();

                if (DebugOptionInGame.Instance.inGameDebugDO.m_DebugParty == false &&
                    UserDataAdmin.Instance != null &&
                    UserDataAdmin.Instance.m_StructHelperList.IsNullOrEmpty() != true &&
                    UserDataAdmin.Instance.m_StructPartyAssign.IsNullOrEmpty() != true)
                {
                    PacketStructFriend cHelper      = UserDataAdmin.Instance.m_StructHelperList[m_HelperIndex];
                    int nPartyCurrent               = UserDataAdmin.Instance.m_StructPlayer.unit_party_current;
                    PacketStructUnit[] acUnitStruct =
                    {
                        UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][0]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][1]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][2]
                        , UserDataAdmin.Instance.m_StructPartyAssign[nPartyCurrent][3]
                        , cHelper.unit
                    };
                    UserDataUnitParam[] acUnitParam =
                    {
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param,
                        SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param,
                    };
                    for (int i = 0; i < acUnitStruct.Length; i++)
                    {
                        if (acUnitStruct[i] != null)
                        {
                            acUnitParam[i].m_UnitDataID            = acUnitStruct[i].id;
                            acUnitParam[i].m_UnitParamLevel        = (int)acUnitStruct[i].level;
                            acUnitParam[i].m_UnitParamEXP          = (int)acUnitStruct[i].exp;
                            acUnitParam[i].m_UnitParamUniqueID     = acUnitStruct[i].unique_id;
                            acUnitParam[i].m_UnitParamLimitBreakLV = (int)acUnitStruct[i].limitbreak_lv;
                            acUnitParam[i].m_UnitParamLimitOverLV  = (int)acUnitStruct[i].limitover_lv;
                            acUnitParam[i].m_UnitParamPlusPow      = (int)acUnitStruct[i].add_pow;
                            acUnitParam[i].m_UnitParamPlusHP       = (int)acUnitStruct[i].add_hp;
                        }
                    }
                }
                else
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara0_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara1_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara2_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara3_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitDataID     = DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara4_id;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara0_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara1_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara2_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara3_level;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamLevel = (int)DebugOptionInGame.Instance.inGameDebugDO.m_MasterDataDefaultParty.party_chara4_level;

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamEXP = 100;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamEXP = 100;

                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara0Param.m_UnitParamUniqueID = 1;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara1Param.m_UnitParamUniqueID = 2;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara2Param.m_UnitParamUniqueID = 3;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara3Param.m_UnitParamUniqueID = 4;
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2.m_PartyChara4Param.m_UnitParamUniqueID = 5;
                }

                LocalSaveManager.Instance.SaveFuncGoesToQuest2Start(SceneGoesParam.Instance.m_SceneGoesParamToQuest2);
                LocalSaveManager.Instance.SaveFuncGoesToQuest2Restore(null);
                DebugOptionInGame.Instance.m_Quest2Build = SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild;
                SceneCommon.Instance.ChangeScene(SceneType.SceneQuest2);
            }
            m_Status = eStatus.NONE;
        }
        break;

        case eStatus.DATA_RESTORE:
        {
            {
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2        = LocalSaveManager.Instance.LoadFuncGoesToQuest2Start();
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Restore = LocalSaveManager.Instance.LoadFuncGoesToQuest2Restore();
                if (SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build == null)
                {
                    SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build = new SceneGoesParamToQuest2Build();
                }
                SceneGoesParam.Instance.m_SceneGoesParamToQuest2Build.m_QuestBuild = DebugOptionInGame.Instance.m_Quest2Build;
                SceneCommon.Instance.ChangeScene(SceneType.SceneQuest2);
            }
            m_Status = eStatus.NONE;
        }
        break;

        default:
            break;
        }
    }
Example #15
0
    public void setupEnemyAbilityInfo(BattleEnemy enemy)
    {
        //--------------------------------
        // エネミーマスターを取得
        //--------------------------------
        MasterDataParamEnemy enemyMaster = enemy.getMasterDataParamEnemy();

        if (enemyMaster == null)
        {
            return;
        }

        AddAbilityInfo(GameTextUtil.GetText("battle_infotext2"), -1);

        // 特性を配列化
        uint[] enemyAbility        = enemy.getEnemyAbilitys();
        int[]  enemy_ability_turns = enemy.getEnemyAbilityTurns();

        //--------------------------------
        // 所持特性を全チェック
        //--------------------------------
        bool is_write = false;

        for (int num = 0; num < enemyAbility.Length; ++num)
        {
            if (enemyAbility[num] == 0)
            {
                continue;
            }

            // 特性マスターを取得
            MasterDataEnemyAbility abilityMaster = MasterDataUtil.GetEnemyAbilityParamFromID((int)enemyAbility[num]);
            if (abilityMaster == null)
            {
                continue;
            }

            // 表示文を取得
            int enemy_ability_turn = enemy_ability_turns[num];
            if (abilityMaster.name != "")
            {
                AddAbilityInfo(abilityMaster.name, enemy_ability_turn);
                enemy_ability_turn = 0;
            }

            if (abilityMaster.detail != "")
            {
                AddAbilityInfo(abilityMaster.detail, enemy_ability_turn);
            }

            is_write = true;
        }

        if (is_write)
        {
            // 何か敵特性があるときは、状態異常表示の前に空行がある
            AddAbilityInfo("", -1);
        }
        else
        {
            AddAbilityInfo("-", -1);
        }
    }
Example #16
0
    public void OnUiEvent(string event_name)
    {
        if (m_Phase != Phase.UPDATE)
        {
            return;
        }

        if (m_CallCount > 0)
        {
            return;
        }

        switch (event_name)
        {
        case "InputFieldEnemyID":
        case "ButtonEnemyIDRight":
        case "ButtonEnemyIDLeft":
        {
            int enemy_id = int.Parse(m_InputFieldEnemyId.text);
            int index    = searchEnemyIndex(enemy_id);

            switch (event_name)
            {
            case "ButtonEnemyIDRight":
                index++;
                break;

            case "ButtonEnemyIDLeft":
                index--;
                break;
            }

            index    = (index + m_MasterDataParamEnemys.Length) % m_MasterDataParamEnemys.Length;
            enemy_id = (int)m_MasterDataParamEnemys[index].fix_id;
            m_InputFieldEnemyId.text = enemy_id.ToString();
            initEnemy(enemy_id);
            //updateWorkEnemyMaster();
        }
        break;

        case "InputFieldPosX":
        case "InputFieldPosY":
        case "ButtonPosUp":
        case "ButtonPosDown":
        case "ButtonPosLeft":
        case "ButtonPosRight":
        {
            float fx = float.Parse(m_InputFieldPosX.text);
            float fy = float.Parse(m_InputFieldPosY.text);

            int x = (int)(fx * 1000.1f);
            int y = (int)(fy * 1000.1f);

            switch (event_name)
            {
            case "ButtonPosUp":
                y++;
                break;

            case "ButtonPosDown":
                y--;
                break;

            case "ButtonPosLeft":
                x--;
                break;

            case "ButtonPosRight":
                x++;
                break;
            }

            fx = x / 1000.0f;
            fy = y / 1000.0f;

            m_InputFieldPosX.text = fx.ToString();
            m_InputFieldPosY.text = fy.ToString();
            updateFromInterface();
        }
        break;

        case "InputFieldHpX":
        case "InputFieldHpY":
        case "ButtonHpUp":
        case "ButtonHpDown":
        case "ButtonHpLeft":
        case "ButtonHpRight":
        {
            float fx = float.Parse(m_InputFieldHpX.text);
            float fy = float.Parse(m_InputFieldHpY.text);

            int x = (int)(fx * 1000.1f);
            int y = (int)(fy * 1000.1f);

            switch (event_name)
            {
            case "ButtonHpUp":
                y++;
                break;

            case "ButtonHpDown":
                y--;
                break;

            case "ButtonHpLeft":
                x--;
                break;

            case "ButtonHpRight":
                x++;
                break;
            }

            fx = x / 1000.0f;
            fy = y / 1000.0f;

            m_InputFieldHpX.text = fx.ToString();
            m_InputFieldHpY.text = fy.ToString();
            updateFromInterface();
        }
        break;

        case "InputFieldTgtX":
        case "InputFieldTgtY":
        case "ButtonTgtUp":
        case "ButtonTgtDown":
        case "ButtonTgtLeft":
        case "ButtonTgtRight":
        {
            float fx = float.Parse(m_InputFieldTgtX.text);
            float fy = float.Parse(m_InputFieldTgtY.text);

            int x = (int)(fx * 1000.1f);
            int y = (int)(fy * 1000.1f);

            switch (event_name)
            {
            case "ButtonTgtUp":
                y++;
                break;

            case "ButtonTgtDown":
                y--;
                break;

            case "ButtonTgtLeft":
                x--;
                break;

            case "ButtonTgtRight":
                x++;
                break;
            }

            fx = x / 1000.0f;
            fy = y / 1000.0f;

            m_InputFieldTgtX.text = fx.ToString();
            m_InputFieldTgtY.text = fy.ToString();
            updateFromInterface();
        }
        break;

        case "TogglePos":
        case "DropdownHp":
        case "ToggleTgt":
            updateFromInterface();
            break;

        case "ButtonPosReset":
            if (m_CurrentEnemyDispInfo != null)
            {
                MasterDataParamEnemy enemy_master = m_CurrentEnemyDispInfo.m_OriginalMasterData;        // 元のマスターデータ
                m_CurrentEnemyDispInfo.m_IsUsePosition = (enemy_master.pos_absolute == MasterDataDefineLabel.BoolType.ENABLE);
                m_CurrentEnemyDispInfo.m_PositionX     = enemy_master.posx_offset;
                m_CurrentEnemyDispInfo.m_PositionY     = enemy_master.posy_offset;
                setInfoToInteface();

                updateFromInterface();
            }
            break;

        case "ButtonHpReset":
            if (m_CurrentEnemyDispInfo != null)
            {
                MasterDataParamEnemy enemy_master = m_CurrentEnemyDispInfo.m_OriginalMasterData;        // 元のマスターデータ
                m_CurrentEnemyDispInfo.m_HpGaugeType = enemy_master.hp_gauge_type;
                m_CurrentEnemyDispInfo.m_HpGaugeX    = enemy_master.hp_posx_offset;
                m_CurrentEnemyDispInfo.m_HpGaugeY    = enemy_master.hp_posy_offset;
                setInfoToInteface();

                updateFromInterface();
            }
            break;

        case "ButtonTgtReset":
            if (m_CurrentEnemyDispInfo != null)
            {
                MasterDataParamEnemy enemy_master = m_CurrentEnemyDispInfo.m_OriginalMasterData;        // 元のマスターデータ
                m_CurrentEnemyDispInfo.m_IsUseTargetPosition = (enemy_master.target_pos_absolute == (int)MasterDataDefineLabel.BoolType.ENABLE);
                m_CurrentEnemyDispInfo.m_TargetX             = enemy_master.target_posx_offset;
                m_CurrentEnemyDispInfo.m_TargetY             = enemy_master.target_posy_offset;
                setInfoToInteface();

                updateFromInterface();
            }
            break;
        }
    }
Example #17
0
    // マスターデータを取得(同時にキャッシュもされます)
    public T use(uint id)
    {
        if (id == 0)
        {
            return(null);
        }

        if (m_Dictionary == null)
        {
            m_Dictionary = new Dictionary <uint, T>();
        }

        if (m_Dictionary.ContainsKey(id))
        {
            return(m_Dictionary[id]);
        }

        T master_data = null;

#if BUILD_TYPE_DEBUG
        // デバッグ用の一時的なマスターデータがあればそこから取得
        if (m_DebugAllData != null)
        {
            for (int idx = 0; idx < m_DebugAllData.Length; idx++)
            {
                T wrk_master_data = m_DebugAllData[idx];
                if (wrk_master_data != null &&
                    wrk_master_data.fix_id == id
                    )
                {
                    master_data = wrk_master_data;
                    break;
                }
            }

            m_Dictionary[id] = master_data;
            return(master_data);
        }
#endif

        if (typeof(T) == typeof(MasterDataParamEnemy) ||
            typeof(T) == typeof(MasterDataEnemyActionTable) ||
            typeof(T) == typeof(MasterDataEnemyActionParam)
            )
        {
            // クエストのたびにサーバからもらうもの
            //敵のマスターデータのうち MasterDataParamEnemy・MasterDataEnemyActionTable・MasterDataEnemyActionParam は PacketStructQuestBuildから毎回取得しているようです(おそらくチート対策)
            if (BattleParam.m_QuestBuild != null
                )
            {
                if (typeof(T) == typeof(MasterDataParamEnemy) &&
                    BattleParam.m_QuestBuild.list_e_param != null
                    )
                {
                    for (int idx = 0; idx < BattleParam.m_QuestBuild.list_e_param.Length; idx++)
                    {
                        MasterDataParamEnemy wrk_master_data = BattleParam.m_QuestBuild.list_e_param[idx];
                        if (wrk_master_data != null &&
                            wrk_master_data.fix_id == id
                            )
                        {
                            master_data = wrk_master_data as T;
                            break;
                        }
                    }
                }
                else
                if (typeof(T) == typeof(MasterDataEnemyActionTable) &&
                    BattleParam.m_QuestBuild.list_e_acttable != null
                    )
                {
                    for (int idx = 0; idx < BattleParam.m_QuestBuild.list_e_acttable.Length; idx++)
                    {
                        MasterDataEnemyActionTable wrk_master_data = BattleParam.m_QuestBuild.list_e_acttable[idx];
                        if (wrk_master_data != null &&
                            wrk_master_data.fix_id == id
                            )
                        {
                            master_data = wrk_master_data as T;
                            break;
                        }
                    }
                }
                else
                if (typeof(T) == typeof(MasterDataEnemyActionParam) &&
                    BattleParam.m_QuestBuild.list_e_actparam != null
                    )
                {
                    for (int idx = 0; idx < BattleParam.m_QuestBuild.list_e_actparam.Length; idx++)
                    {
                        MasterDataEnemyActionParam wrk_master_data = BattleParam.m_QuestBuild.list_e_actparam[idx];
                        if (wrk_master_data != null &&
                            wrk_master_data.fix_id == id
                            )
                        {
                            master_data = wrk_master_data as T;
                            break;
                        }
                    }
                }
            }

#if BUILD_TYPE_DEBUG && USE_LOCAL_ENEMY_MASTER
            if (master_data == null)
            {
                master_data = _getMasterData(id);
            }
#endif //USE_LOCAL_ENEMY_MASTER
        }
        else
        {
            master_data = _getMasterData(id);
        }

        m_Dictionary[id] = master_data;

        return(master_data);
    }
Example #18
0
    static private int CreateQuestBuildBattle(
        int nFloor
        , ref TemplateList <ServerDataDefine.PacketStructQuest2BuildBattle> rcBattleList
        , ref TemplateList <ServerDataDefine.PacketStructQuest2BuildDrop> rcDropList
        , MasterDataEnemyGroup cEnemyGroup)
    {
        if (cEnemyGroup == null)
        {
            return(0);
        }

        //----------------------------------------
        // グループに内包されるエネミー一覧を生成
        //----------------------------------------
        TemplateList <MasterDataParamEnemy> cEnemyList = new TemplateList <MasterDataParamEnemy>();
        MasterDataParamEnemy cEnemyData1 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_1);
        MasterDataParamEnemy cEnemyData2 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_2);
        MasterDataParamEnemy cEnemyData3 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_3);
        MasterDataParamEnemy cEnemyData4 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_4);
        MasterDataParamEnemy cEnemyData5 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_5);
        MasterDataParamEnemy cEnemyData6 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_6);
        MasterDataParamEnemy cEnemyData7 = BattleParam.m_MasterDataCache.useEnemyParam(cEnemyGroup.enemy_id_7);

        if (cEnemyData1 != null)
        {
            cEnemyList.Add(cEnemyData1);
        }
        if (cEnemyData2 != null)
        {
            cEnemyList.Add(cEnemyData2);
        }
        if (cEnemyData3 != null)
        {
            cEnemyList.Add(cEnemyData3);
        }
        if (cEnemyData4 != null)
        {
            cEnemyList.Add(cEnemyData4);
        }
        if (cEnemyData5 != null)
        {
            cEnemyList.Add(cEnemyData5);
        }
        if (cEnemyData6 != null)
        {
            cEnemyList.Add(cEnemyData6);
        }
        if (cEnemyData7 != null)
        {
            cEnemyList.Add(cEnemyData7);
        }


        //----------------------------------------
        // グループ内のエネミーリストから実際に出現するエネミーを並べる
        //----------------------------------------
        TemplateList <int> cEnemyFixAccessList = new TemplateList <int>();

        ServerDataDefine.PacketStructQuest2BuildBattle cBattle = new ServerDataDefine.PacketStructQuest2BuildBattle();
        if (cEnemyGroup.fix == MasterDataDefineLabel.BoolType.ENABLE)
        {
            //----------------------------------------
            // 完全固定で並べる場合
            //----------------------------------------
            cEnemyFixAccessList.Alloc(cEnemyList.m_BufferSize);
            for (int i = 0; i < cEnemyList.m_BufferSize; i++)
            {
                cEnemyFixAccessList.Add(i);
            }
        }
        else
        {
            //----------------------------------------
            // ランダムで並べる場合
            //----------------------------------------
            int nTotalEnemyCt = (int)RandManager.GetRand((uint)cEnemyGroup.num_min, (uint)cEnemyGroup.num_max);
            cEnemyFixAccessList.Alloc(nTotalEnemyCt);
            for (int i = 0; i < nTotalEnemyCt; i++)
            {
                int nEnemyListAccess = (int)RandManager.GetRand(0, (uint)cEnemyList.m_BufferSize);
                cEnemyFixAccessList.Add(nEnemyListAccess);
            }
        }

        //----------------------------------------
        // ドロップ判定
        //----------------------------------------
        cBattle.floor      = nFloor;
        cBattle.enemy_list = new uint[cEnemyFixAccessList.m_BufferSize];
        cBattle.drop_list  = new int[cEnemyFixAccessList.m_BufferSize];
        bool bDropFixed = false;

        for (int i = 0; i < cEnemyFixAccessList.m_BufferSize; i++)
        {
            //----------------------------------------
            // 基本情報入力
            //----------------------------------------
            cBattle.enemy_list[i] = cEnemyList[cEnemyFixAccessList[i]].fix_id;
            cBattle.drop_list[i]  = 0;

#if BUILD_TYPE_DEBUG
            Debug.Log("EnemyBattle - " + cEnemyList[cEnemyFixAccessList[i]].fix_id);
#endif
            //----------------------------------------
            // ドロップ判定
            //----------------------------------------
            if (bDropFixed == true)
            {
                continue;
            }
            MasterDataParamEnemy cEnemyFixParam = cEnemyList[cEnemyFixAccessList[i]];
            uint unDropRand = RandManager.GetRand(0, 10000);
            if (cEnemyFixParam.drop_unit_rate < unDropRand)
            {
                //----------------------------------------
                // ドロップ確定!
                // パラメータを保持しておく
                //----------------------------------------
                ServerDataDefine.PacketStructQuest2BuildDrop cDropData = new ServerDataDefine.PacketStructQuest2BuildDrop();
                cDropData.item_id = (int)cEnemyFixParam.drop_unit_id;
                if (cDropData.item_id == 0)
                {
                    cDropData.setKindType(ServerDataDefine.PacketStructQuest2BuildDrop.KindType.NONE);
                }
                else
                {
                    cDropData.setKindType(ServerDataDefine.PacketStructQuest2BuildDrop.KindType.UNIT);
                }
                cDropData.plus_hp   = 0;
                cDropData.plus_pow  = 0;
                cDropData.unique_id = (rcDropList.m_BufferSize + 1);
                cDropData.floor     = nFloor;

                rcDropList.Add(cDropData);

                cBattle.drop_list[i] = cDropData.unique_id;

                bDropFixed = true;
            }
        }

        //----------------------------------------
        // 戦闘連鎖があるなら連鎖も加味
        //----------------------------------------
        if (cEnemyGroup.chain_id > 0)
        {
            MasterDataEnemyGroup cChainEnemyGroup = BattleParam.m_MasterDataCache.useEnemyGroup(cEnemyGroup.chain_id);
            cBattle.chain = CreateQuestBuildBattle(nFloor, ref rcBattleList, ref rcDropList, cChainEnemyGroup);
        }

        //----------------------------------------
        // 情報を加算して管理番号を返す
        //----------------------------------------
        cBattle.unique_id = rcBattleList.m_BufferSize + 1;
        rcBattleList.Add(cBattle);


        return(cBattle.unique_id);
    }
Example #19
0
    private void update_sub2(ref Vector2 enemy_size)
    {
        // 表示位置調整

        // 敵パーティが画面内に収まらなかったら遠くに表示して収まるようにする
        float z_offset = 0.0f;
        {
            // 表示可能領域サイズを計算
            Vector2 enemy_area_size;
            {
                // 敵表示領域の原点(中央下)(スクリーン座標系)
                Vector3 area_base_2d = m_Camera.WorldToScreenPoint(gameObject.transform.localPosition + m_Camera.transform.position);

                // 画面右上位置(ワールド座標系。この座標はステータスバーなどを考慮した表示領域の右上の座標)
                Vector3 top_right_world = BattleSceneManager.Instance.m_TopRightAnchor.transform.position;
                // 画面右上位置(スクリーン座標系)
                Vector3 top_right_2d = m_Camera.WorldToScreenPoint(top_right_world);

                enemy_area_size    = top_right_2d - area_base_2d;
                enemy_area_size   *= 1.0f / 128.0f / m_Canvas.scaleFactor; // 敵グループサイズに単位を合わせる.
                enemy_area_size   *= 0.95f;                                // 画面端ぎりぎりまで表示されないように少し狭める.
                enemy_area_size.x *= 2.0f;
            }

            // 敵グループサイズが表示可能領域をどれくらい上回っているか判定
            float scale_x = enemy_size.x / enemy_area_size.x;
            float scale_y = enemy_size.y / enemy_area_size.y;

            float scale = Mathf.Max(scale_x, scale_y);
            if (scale > 1.0f)
            {
                float enemy_base_z = gameObject.transform.localPosition.z;
                float new_z        = enemy_base_z * scale;
                z_offset = new_z - enemy_base_z;
            }
        }

        float x = enemy_size.x * -0.5f;

        for (int idx = 0; idx < m_EnemyObjectViewControls.Length; idx++)
        {
            BattleEnemyObjectViewControl battle_enemy_object_view_control = m_EnemyObjectViewControls[idx];
            if (battle_enemy_object_view_control != null)
            {
                MasterDataParamEnemy enemy_master = m_BattleEnemys[idx].getMasterDataParamEnemy();

                Vector3 offset           = battle_enemy_object_view_control.getEnemyDispOffset();
                float   Z_OFFSET_SCALE_Y = gameObject.transform.localPosition.y / gameObject.transform.localPosition.z; // 敵表示の大きさ補正をすると敵の表示位置が下に移動してしまうのを抑制するための値.
                offset.y += z_offset * Z_OFFSET_SCALE_Y;
                offset.z += z_offset;
                if (m_BattleEnemys[idx].getMasterDataParamEnemy().pos_absolute != MasterDataDefineLabel.BoolType.ENABLE)
                {
                    // 位置指定がされていない場合は左から並べる
                    float enemy_width = battle_enemy_object_view_control.getCharaWidth();
                    battle_enemy_object_view_control.gameObject.transform.localPosition = new Vector3(x + enemy_width * 0.5f, 0.0f, 0.0f) + offset;

                    x += enemy_width;
                }
                else
                {
                    // 位置指定がされている場合はその位置に出す
                    Vector3 pos = new Vector3(enemy_master.posx_offset, enemy_master.posy_offset, enemy_master.posz_value) / 128.0f;
                    battle_enemy_object_view_control.gameObject.transform.localPosition = pos + offset;
                }

                // カメラへ向くように補正(左右方向を補正)
                {
                    battle_enemy_object_view_control.gameObject.transform.up = gameObject.transform.up;
                    Vector3 forward = m_Camera.transform.position + gameObject.transform.up * battle_enemy_object_view_control.gameObject.transform.localPosition.y - battle_enemy_object_view_control.gameObject.transform.position;
                    battle_enemy_object_view_control.gameObject.transform.forward = -forward.normalized;
                }

                if (enemy_master != null)
                {
                    // HPゲージ表示位置
                    {
                        battle_enemy_object_view_control.setHpGaugeType(enemy_master.hp_gauge_type);
                        Vector2 hp_offset = new Vector2(enemy_master.hp_posx_offset, enemy_master.hp_posy_offset) / 128.0f;
                        battle_enemy_object_view_control.setHpGaugeOffest(hp_offset);
                    }

                    // ターゲットカーソル位置
                    {
                        Vector2 target_offset = Vector2.zero;
                        if (enemy_master.target_pos_absolute == (int)MasterDataDefineLabel.BoolType.ENABLE)
                        {
                            target_offset = new Vector2(enemy_master.target_posx_offset, enemy_master.target_posy_offset) / 128.0f;
                        }
                        battle_enemy_object_view_control.setTargetCursorOffset(target_offset);
                    }
                }
            }
        }
    }