Esempio n. 1
0
    public void RemoveAssist(DataUnitParam _assist)
    {
        if (_assist.chara_id != chara_id)
        {
            Debug.LogError("not equal chara_id");
            return;
        }
        if (_assist.unit != "assist")
        {
            Debug.LogError("not unit type is assist");
            return;
        }
        if (_assist.assist_set == false)
        {
            Debug.LogError("not set");
        }

        hp_max -= _assist.hp_max;
        hp      = Math.Min(hp, hp_max);

        str   -= _assist.str;
        magic -= _assist.magic;
        heal  -= _assist.heal;
        luck  -= _assist.luck;
        _assist.assist_set = false;
    }
Esempio n. 2
0
    public void Show(DataUnitParam _dataChara, MasterCharaParam _masterChara, List <MasterCardParam> _master_card_list, List <MasterCharaCardParam> _chara_card_list, List <MasterCardSymbolParam> _symbol_list)
    {
        m_imgIcon.sprite    = SpriteManager.Instance.Get(string.Format(Defines.STR_FORMAT_FACEICON, _masterChara.chara_id));
        m_txtCharaName.text = _masterChara.name;
        m_txtHP.text        = _dataChara.hp_max.ToString();
        m_txtSTR.text       = _dataChara.str.ToString();
        m_txtMAG.text       = _dataChara.magic.ToString();
        m_txtHEAL.text      = _dataChara.heal.ToString();
        m_txtFood.text      = _dataChara.food.ToString();

        m_barTension.SetValueCurrent(_dataChara.tension);

        Card[] arr = m_goCardRoot.GetComponentsInChildren <Card>();
        foreach (Card c in arr)
        {
            GameObject.Destroy(c.gameObject);
        }

        foreach (MasterCharaCardParam p in _chara_card_list.FindAll(p => p.chara_id == _masterChara.chara_id))
        {
            //Debug.Log(p.card_id);
            Card c = PrefabManager.Instance.MakeScript <Card>(m_prefCard, m_goCardRoot);

            DataCardParam data_card = new DataCardParam();

            data_card.Copy(_master_card_list.Find(a => a.card_id == p.card_id), _masterChara.chara_id, 0);
            c.Initialize(data_card, _symbol_list);
        }
    }
Esempio n. 3
0
        public override void OnEnter()
        {
            base.OnEnter();

            MasterItemParam masterItem = DataManagerGame.Instance.masterItem.list.Find(p => p.item_id == item_id.Value);

            if (chara_id.Value != 0)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == chara_id.Value && p.unit == "chara");

                DataManagerGame.Instance.dataUnit.AddAssist(unit_chara, "item", masterItem.name, chara_id.Value, item_type_sub.Value, param.Value, turn.Value);
            }
            else
            {
                foreach (DataUnitParam unit in DataManagerGame.Instance.dataUnit.list.FindAll(p => p.unit == "chara"))
                {
                    DataManagerGame.Instance.dataUnit.AddAssist(unit, "item", masterItem.name, unit.chara_id, item_type_sub.Value, param.Value, turn.Value);
                }
            }
            GameMain.Instance.battleMain.HpRefresh();
            GameMain.Instance.CharaRefresh();


            Finish();
        }
Esempio n. 4
0
    public void ShowList()
    {
        m_goCharaListRoot.SetActive(true);

        CharaIcon[] arr = m_goCharaListContents.GetComponentsInChildren <CharaIcon>();
        foreach (CharaIcon c in arr)
        {
            if (m_prefCharaIcon != c.gameObject)
            {
                GameObject.Destroy(c.gameObject);
            }
        }
        icon_list.Clear();


        foreach (MasterCharaParam p in DMCamp.Instance.masterChara.list.FindAll(p => p.unit == "chara"))
        {
            DataUnitParam unit = DMCamp.Instance.dataUnitCamp.list.Find(a => a.chara_id == p.chara_id);

            if (unit != null)
            {
                CharaIcon icon = PrefabManager.Instance.MakeScript <CharaIcon>(m_prefCharaIcon, m_goCharaListContents);
                icon.Initialize(p);

                icon.OnClickIcon.AddListener((CharaIcon _icon) =>
                {
                    OnListCharaId.Invoke(_icon.m_masterChara.chara_id);
                });
                icon_list.Add(icon);
            }
        }
    }
Esempio n. 5
0
 public void Initialize(DataUnitParam _data, MasterSkillParam _skill, string _target_tag, MasterWeaponParam _weapon)
 {
     m_data         = _data;
     m_skill        = _skill;
     m_strTargetTag = _target_tag;
     m_weapon       = _weapon;
     Destroy(gameObject, 0.5f);
 }
Esempio n. 6
0
        public override void OnEnter()
        {
            base.OnEnter();

            DataCardParam player_card = simulator.dataCard.list.Find(p => p.card_serial == player_card_serial.Value);
            DataCardParam enemy_card  = simulator.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);

            player_card.status = (int)DataCard.STATUS.REMOVE;

            card_play_count.Value += 1;
            mp.Value += player_card.power;
            if (30 < mp.Value)
            {
                mp.Value = 30;
            }
            DataCard.Offset(player_card, enemy_card);

            DataUnitParam player_unit = simulator.dataUnit.list.Find(p => p.chara_id == player_card.chara_id && p.unit == "chara");
            DataUnitParam enemy_unit  = simulator.dataUnit.list.Find(p => p.unit == "enemy");

            player_unit.Attack_Sim(player_unit.str, 1001, player_card, enemy_unit);

            if (enemy_unit.hp <= 0)
            {
                Fsm.Event("win");
                return;
            }
            else
            {
                enemy_unit.Attack_Sim(enemy_unit.str, 1001, enemy_card, player_unit);
            }

            if (player_unit.hp <= 0)
            {
                Fsm.Event("dead");
                return;
            }

            player_unit.Attack_Sim(player_unit.magic, 3001, player_card, enemy_unit);

            if (enemy_unit.hp <= 0)
            {
                Fsm.Event("win");
                return;
            }
            else
            {
                enemy_unit.Attack_Sim(enemy_unit.magic, 3001, enemy_card, player_unit);
            }

            if (player_unit.hp <= 0)
            {
                Fsm.Event("dead");
                return;
            }

            Finish();
        }
Esempio n. 7
0
    public void Initialize(DataUnitParam _data, MasterCharaParam _masterCharaParam)
    {
        unit_param = _data;

        master_chara      = _masterCharaParam;
        m_imgChara.sprite = SpriteManager.Instance.Get(string.Format("chara{0:000}01_00_faceicon", master_chara.chara_id));

        Refresh();
    }
Esempio n. 8
0
    public void Initialize(DataUnit _dataUnit, MasterChara _masterChara)
    {
        DataUnitParam left  = _dataUnit.list.Find(p => p.unit == "chara" && p.position == "left");
        DataUnitParam right = _dataUnit.list.Find(p => p.unit == "chara" && p.position == "right");

        //DataUnitParam back = _dataUnit.list.Find(p => p.unit == "chara" && p.position == "back");

        area_chara_left.Initialize(left, _masterChara.list.Find(p => p.chara_id == left.chara_id));
        area_chara_right.Initialize(right, _masterChara.list.Find(p => p.chara_id == right.chara_id));
    }
Esempio n. 9
0
    public DataUnitParam BuildLevel(int _iLevel, int _iTension)
    {
        DataUnitParam ret = new DataUnitParam();

        ret.chara_id = chara_id;
        ret.unit     = "chara";

        BuildLevel(ret, _iLevel, _iTension);

        return(ret);
    }
Esempio n. 10
0
    public void Damage(DataUnitParam _attack, MasterSkillParam _skill, MasterWeaponParam _weapon)
    {
        int damage = _attack.CalcDamage(dataUnitParam, _skill, _weapon);

        dataUnitParam.hp -= damage;

        DamageNum script = PrefabManager.Instance.MakeScript <DamageNum>(GameMain.Instance.m_prefDamageNum, m_enemyBody.gameObject);

        script.Initialize(damage, true);
        script.transform.parent = script.transform.parent.parent.parent;
    }
Esempio n. 11
0
        private void exchange(int _iCharaIdA, int _iCharaIdB)
        {
            DataUnitParam unit_a = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == _iCharaIdA && p.unit == "chara");
            DataUnitParam unit_b = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == _iCharaIdB && p.unit == "chara");

            string chara_a_position = unit_a.position;
            string chara_b_position = unit_b.position;

            unit_a.position = chara_b_position;
            unit_b.position = chara_a_position;
        }
Esempio n. 12
0
 public void Attack_Sim(int _iAttack, int _iSymbolId, DataCardParam _card, DataUnitParam _target)
 {
     for (int i = 0; i < 6; i++)
     {
         if (_card.GetSymbolId(i) == _iSymbolId)
         {
             _target.hp -= _iAttack;
         }
     }
     return;
 }
Esempio n. 13
0
        private void OnDamageFinished()
        {
            DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                              p.unit == "enemy");

            Debug.Log(enemy.hp);
            enemy.hp -= damage.Value;

            battleMain.HpRefresh();

            Finish();
        }
Esempio n. 14
0
    public int CalcDamage(DataUnitParam _target, MasterSkillParam _skill, MasterWeaponParam _weapon)
    {
        int use_attack = attack;

        if (_weapon != null)
        {
            //Debug.Log(_weapon.weapon_type);
            if (_weapon.weapon_type == "hammer")
            {
                use_attack /= 2;
            }
            else if (_weapon.weapon_type == "dagger")
            {
                use_attack = use_attack + use_attack / 2;
            }
            else
            {
            }
        }
        //Debug.Log(string.Format("{0}:{1}", attack, use_attack));

        float base_damage = (use_attack * 3 - _target.def) * 0.717f;

        //Debug.Log(base_damage);

        if (base_damage < 1.0f)
        {
            base_damage = 1.0f;
        }

        float skill_rate = 1.0f;

        if (_skill != null)
        {
            skill_rate = _skill.param * 0.01f;
        }

        float[] rand_rate_table = { 0.98f, 0.99f, 1.00f, 1.01f, 1.02f };
        //int[] rand_add_table = { 0,1,2,3,4 };
        int[] rand_add_table = { 0, 1, 1, 2, 2 };

        int index_rand_rate = UtilRand.GetRand(rand_rate_table.Length);
        int index_rand_add  = UtilRand.GetRand(rand_add_table.Length);

        float fRet = (base_damage * skill_rate * rand_rate_table[index_rand_rate]) + rand_add_table[index_rand_add];

        if (fRet < 1.0f)
        {
            fRet = 1.0f;
        }
        return((int)fRet);
    }
Esempio n. 15
0
        public override void OnEnter()
        {
            base.OnEnter();
            DataCardParam player_card = simulator.dataCard.list.Find(p => p.card_serial == player_card_serial.Value);

            Debug.Log(player_card.chara_id);
            DataUnitParam battle_chara = simulator.dataUnit.list.Find(p => p.chara_id == player_card.chara_id && p.unit == "chara");

            List <DataUnitParam> back_chara_list = simulator.dataUnit.list.FindAll(p => p.unit == "chara" && p.position == "back");

            bool bChangeMember = false;

            foreach (DataUnitParam back_unit in back_chara_list)
            {
                // 選手交代
                if (0 < back_unit.hp)
                {
                    back_unit.position    = battle_chara.position;
                    battle_chara.position = "back";
                    foreach (DataCardParam card in simulator.dataCard.list.FindAll(p => p.chara_id == back_unit.chara_id))
                    {
                        card.status = (int)DataCard.STATUS.REMOVE;
                    }
                    bChangeMember = true;
                }
            }
            if (bChangeMember)
            {
                Debug.Log("メンバー交代");
                //GameMain.Instance.panelStatus.Initialize(simulator.dataUnit, simulator.masterChara);
            }
            else
            {
            }

            foreach (DataCardParam card in simulator.dataCard.list.FindAll(p => p.chara_id == battle_chara.chara_id))
            {
                card.status = (int)DataCard.STATUS.NOTUSE;
            }

            if (simulator.dataUnit.IsAliveParty())
            {
                //Fsm.Event("dead");
                Finish();
            }
            else
            {
                Fsm.Event("gameover");
            }
        }
Esempio n. 16
0
    public void Initialize(DataUnitParam _unit, MasterCharaParam _master)
    {
        dataUnit    = _unit;
        masterChara = _master;

        m_imgFaceicon.sprite = SpriteManager.Instance.Get(string.Format(Defines.STR_FORMAT_FACEICON, masterChara.chara_id));
        m_txtName.text       = masterChara.name;
        m_txtLevel.text      = string.Format("Lv{0}", _unit.level);
        m_txtHP.text         = dataUnit.hp_max.ToString();
        m_txtStr.text        = dataUnit.str.ToString();
        m_txtMagic.text      = dataUnit.magic.ToString();
        m_txtHeal.text       = dataUnit.heal.ToString();
        m_txtFood.text       = dataUnit.food.ToString();
    }
Esempio n. 17
0
    public void Show(List <DataUnitParam> _unit_list, List <MasterCharaParam> _master_chara_list)
    {
        m_assistList.gameObject.SetActive(false);

        DataUnitParam        left      = _unit_list.Find(p => p.unit == "chara" && p.position == "left");
        DataUnitParam        right     = _unit_list.Find(p => p.unit == "chara" && p.position == "right");
        List <DataUnitParam> back_list = _unit_list.FindAll(p => p.unit == "chara" && p.position == "back");

        chara_left.Initialize(left, _master_chara_list.Find(p => p.chara_id == left.chara_id), _unit_list);
        chara_right.Initialize(right, _master_chara_list.Find(p => p.chara_id == right.chara_id), _unit_list);

        chara_back1.Initialize(back_list[0], _master_chara_list.Find(p => p.chara_id == back_list[0].chara_id), _unit_list);

        // ここプログラムとしてはおかしい
        if (2 <= back_list.Count)
        {
            chara_back2.Initialize(back_list[1], _master_chara_list.Find(p => p.chara_id == back_list[1].chara_id), _unit_list);
        }
        else
        {
            chara_back2.gameObject.SetActive(false);
        }

        chara_left.OnClick.RemoveAllListeners();
        chara_right.OnClick.RemoveAllListeners();
        chara_back1.OnClick.RemoveAllListeners();
        chara_back2.OnClick.RemoveAllListeners();
        chara_left.OnClick.AddListener((int _iCharaId) =>
        {
            m_assistList.gameObject.SetActive(true);
            m_assistList.Show(_iCharaId);
        });
        chara_right.OnClick.AddListener((int _iCharaId) =>
        {
            m_assistList.gameObject.SetActive(true);
            m_assistList.Show(_iCharaId);
        });
        chara_back1.OnClick.AddListener((int _iCharaId) =>
        {
            m_assistList.gameObject.SetActive(true);
            m_assistList.Show(_iCharaId);
        });
        chara_back2.OnClick.AddListener((int _iCharaId) =>
        {
            m_assistList.gameObject.SetActive(true);
            m_assistList.Show(_iCharaId);
        });
    }
Esempio n. 18
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (item_type_sub.Value == "hp")
            {
                if (chara_id.Value == 0)
                {
                    foreach (DataUnitParam unit in DataManagerGame.Instance.dataUnit.list.FindAll(p => p.unit == "chara"))
                    {
                        unit.HpHeal(param.Value);
                    }
                }
                else
                {
                    DataUnitParam unit = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "chara" && p.chara_id == chara_id.Value);
                    unit.HpHeal(param.Value);
                }
                GameMain.Instance.battleMain.HpRefresh();
                GameMain.Instance.CharaRefresh();
            }
            else if (item_type_sub.Value == "mp")
            {
                DataManagerGame.Instance.MpHeal(param.Value);
            }
            else if (item_type_sub.Value == "tension")
            {
                if (chara_id.Value == 0)
                {
                    foreach (DataUnitParam unit in DataManagerGame.Instance.dataUnit.list.FindAll(p => p.unit == "chara"))
                    {
                        DataManagerGame.Instance.dataUnit.AddTension(unit.chara_id, param.Value, DataManagerGame.Instance.masterChara.list);
                    }
                }
                else
                {
                    DataUnitParam unit = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "chara" && p.chara_id == chara_id.Value);
                    DataManagerGame.Instance.dataUnit.AddTension(unit.chara_id, param.Value, DataManagerGame.Instance.masterChara.list);
                }
                GameMain.Instance.CharaRefresh();
            }
            else
            {
                Debug.LogError(item_type_sub.Value);
            }

            Finish();
        }
Esempio n. 19
0
        public override void OnEnter()
        {
            base.OnEnter();

            List <MasterStageCardParam> appear_card = simulator.masterStageCard.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == wave.Value);

            if (appear_card.Count == 0)
            {
                appear_card = simulator.masterStageCard.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == 0);
            }

            int[] item_prob = new int[appear_card.Count];
            //Debug.Log(appear_card.Count);
            for (int i = 0; i < appear_card.Count; i++)
            {
                item_prob[i] = appear_card[i].prob;
            }

            int index = UtilRand.GetIndex(item_prob);

            DataUnitParam left_chara = simulator.dataUnit.list.Find(p => p.unit == "chara" && p.position == "left");

            DataCardParam add_card = new DataCardParam();
            // tempシリアルを配布
            //add_card.card_id = appear_card[index].card_id;
            //add_card.chara_id = left_chara.chara_id;
            //Debug.Log(add_card.chara_id);


            MasterCardParam master = simulator.masterCard.list.Find(p => p.card_id == appear_card[index].card_id);

            if (master == null)
            {
            }


            // シリアルはAddNewCardで設定し直し
            add_card.Copy(master, left_chara.chara_id, 0);

            simulator.dataCard.AddNewCard(add_card, DataCard.STATUS.DECK);
            Finish();
        }
Esempio n. 20
0
        public override void OnEnter()
        {
            base.OnEnter();

            DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");

            if (enemy.hp <= 0)
            {
                battleMain.m_animReciverEnemy.OnDeadFinished.AddListener(() =>
                {
                    Fsm.Event("win");
                });
                battleMain.m_animEnemy.SetTrigger("down");
                battleMain.m_animEnemy.SetBool("damage", false);
            }
            else
            {
                battleMain.m_animEnemy.SetBool("damage", false);
                Finish();
            }
        }
Esempio n. 21
0
        private void create_enemy(int _enemy_chara_id)
        {
            simulator.dataUnit.list.RemoveAll(p => p.unit == "enemy");
            MasterCharaParam master_enemy = simulator.masterChara.list.Find(p => p.chara_id == _enemy_chara_id);
            DataUnitParam    enemy        = DataUnit.MakeUnit(master_enemy, 1, "enemy", 60);

            simulator.dataUnit.list.Add(enemy);

            //Debug.LogError(_enemy_chara_id);

            simulator.dataCardEnemy.list.Clear();
            int iSerial = 1;

            foreach (MasterCharaCardParam cc in simulator.masterCharaCard.list.FindAll(p => p.chara_id == _enemy_chara_id))
            {
                DataCardParam   add         = new DataCardParam();
                MasterCardParam master_card = simulator.masterCard.list.Find(p => p.card_id == cc.card_id);
                add.Copy(master_card, _enemy_chara_id, iSerial);
                simulator.dataCardEnemy.list.Add(add);
                iSerial += 1;
            }
        }
Esempio n. 22
0
    public void BuildAssist(DataUnitParam _assist)
    {
        if (_assist.chara_id != chara_id)
        {
            Debug.LogError("not equal chara_id");
        }
        if (_assist.unit != "assist")
        {
            Debug.LogError("not unit type is assist");
        }

        if (_assist.assist_set == false)
        {
            // 最大値が増える場合はhpも増やす
            hp_max += _assist.hp_max;
            if (0 < _assist.hp_max)
            {
                // HPの最大値につられて増えるのは生きてる時だけ
                if (0 < hp)
                {
                    hp += _assist.hp_max;
                }
            }
            else if (_assist.hp_max < 0)
            {
                if (hp_max < hp)
                {
                    hp = hp_max;
                }
            }

            str   += _assist.str;
            magic += _assist.magic;
            heal  += _assist.heal;
            luck  += _assist.luck;
            _assist.assist_set = true;
        }
    }
Esempio n. 23
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (select_card_serial.Value != 0)
            {
                DataCardParam card       = DataManagerGame.Instance.dataCard.list.Find(p => p.card_serial == select_card_serial.Value);
                DataUnitParam play_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == card.chara_id && p.unit == "chara" && 0 < p.hp);

                //Debug.Log((DataCard.STATUS)card.status);
                //Debug.Log(play_chara);
                if (play_chara != null)
                {
                    card.status = (int)DataCard.STATUS.REMOVE;
                }
                else
                {
                    if (card.status != (int)DataCard.STATUS.NOTUSE)
                    {
                        card.status = (int)DataCard.STATUS.NOTUSE;
                    }
                }
            }
            if (enemy_card_serial.Value != 0)
            {
                DataCardParam select_enemy_card = battleMain.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);
                select_enemy_card.status = (int)DataCard.STATUS.REMOVE;
            }

            if (is_win.Value)
            {
                Fsm.Event("win");
            }
            else
            {
                Finish();
            }
        }
Esempio n. 24
0
    public void HpRefresh()
    {
        if (GameMain.Instance.SelectCharaId != 0)
        {
            DataUnitParam select_chara = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                                     p.chara_id == GameMain.Instance.SelectCharaId &&
                                                                                     p.unit == "chara");
            if (select_chara != null && hp_bar_chara != null)
            {
                hp_bar_chara.SetValueMax(select_chara.hp_max);
                hp_bar_chara.SetValueCurrent(select_chara.hp);
            }
        }

        DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                          p.unit == "enemy");

        if (enemy != null && hp_bar_enemy != null)
        {
            hp_bar_enemy.SetValueMax(enemy.hp_max);
            hp_bar_enemy.SetValueCurrent(enemy.hp);
        }
    }
Esempio n. 25
0
        private IEnumerator HealEffectAppear(BattleIcon arg0)
        {
            // この微妙なずらし作業がしたかっただけ
            yield return(new WaitForSeconds(0.5f));

            int iHeal  = 12;
            int iSwing = UtilRand.GetRand(5) - 2;

            if (is_player.Value)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");
                iHeal = unit_chara.heal + iSwing;
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                iHeal = unit_enemy.heal + iSwing;
            }
            //Debug.Log(iDamage);

            battleMain.Heal(is_player.Value, iHeal, OnHealFinished);

            // プレイヤー側の攻撃
            if (arg0.is_left)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");
                unit_chara.HpHeal(iHeal);
                GameMain.Instance.CharaRefresh();
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                unit_enemy.HpHeal(iHeal);
            }
            battleMain.HpRefresh();
        }
Esempio n. 26
0
    public DataUnitParam BuildLevel(DataUnitParam _unit, int _iLevel, int _iTension)
    {
        _unit.level   = _iLevel;
        _unit.tension = _iTension;

        // レベル1の時だけは係数をかける
        if (_iLevel == 1)
        {
            _iLevel = 0;
        }


        /*
         * Debug.Log(string.Format("request level:{0}", _iLevel));
         * for( int i = 1; i < 30; i++)
         * {
         *      Debug.Log(string.Format("level:{0} hp_max_add={1} str={2} magic={3}", i,
         *              (int)(hp_max * LEVELUP_PARAM_RATE * (i - 1)),
         *              (int)(str * LEVELUP_PARAM_RATE * (i - 1)),
         *              (int)(magic * LEVELUP_PARAM_RATE * (i - 1))
         *              ));
         * }
         */
        _unit.hp_max = hp_max + (int)(hp_max * LEVELUP_PARAM_RATE * (_iLevel));
        //Debug.Log(ret.hp_max);
        _unit.hp = _unit.hp_max;

        _unit.str   = str + (int)(str * LEVELUP_PARAM_RATE * (_iLevel));
        _unit.magic = magic + (int)(magic * LEVELUP_PARAM_RATE * (_iLevel));
        _unit.heal  = heal + (int)(heal * LEVELUP_PARAM_RATE * (_iLevel));
        _unit.luck  = luck + (int)(luck * LEVELUP_PARAM_RATE * (_iLevel));

        _unit.food = food + (int)(food * LEVELUP_PARAM_RATE * (_iLevel));

        return(_unit);
    }
Esempio n. 27
0
 public void SetTargetLevel(int _iLevelupNum, DataUnitParam _now, MasterCharaParam _master)
 {
     m_iUpLevel = _iLevelupNum;
     levelup.Initialize(_master.BuildLevel(_now.level + m_iUpLevel, _now.tension), _master);
 }
Esempio n. 28
0
 public void Initialize(DataUnitParam _now, MasterCharaParam _master)
 {
     gameObject.SetActive(true);
     now.Initialize(_now, _master);
 }
Esempio n. 29
0
        private IEnumerator DamageEffectAppear(BattleIcon arg0)
        {
            // この微妙なずらし作業がしたかっただけ
            yield return(new WaitForSeconds(0.5f));

            int iDamage = 12;
            int iSwing  = UtilRand.GetRand(5) - 2;

            if (is_player.Value)
            {
                DataUnitParam unit_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == select_chara_id.Value && p.unit == "chara");

                switch (arg0.master_symbol.card_symbol_id)
                {
                case Defines.CARD_SYMBOL_ATTACK:
                    iDamage = unit_chara.str + iSwing;
                    break;

                case Defines.CARD_SYMBOL_MAGIC:
                    iDamage = unit_chara.magic + iSwing;
                    break;

                default:
                    break;
                }
            }
            else
            {
                DataUnitParam unit_enemy = DataManagerGame.Instance.dataUnit.list.Find(p => p.unit == "enemy");
                switch (arg0.master_symbol.card_symbol_id)
                {
                case Defines.CARD_SYMBOL_ATTACK:
                    iDamage = unit_enemy.str + iSwing;
                    break;

                case Defines.CARD_SYMBOL_MAGIC:
                    iDamage = unit_enemy.magic + iSwing;
                    break;

                default:
                    break;
                }
            }
            //Debug.Log(iDamage);

            battleMain.Damage(is_player.Value, iDamage, OnDamageFinished);

            // プレイヤー側の攻撃
            if (arg0.is_left)
            {
                DataUnitParam enemy = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                                  p.unit == "enemy");
                //Debug.Log(enemy.hp);
                enemy.hp -= iDamage;
            }
            else
            {
                DataUnitParam select_chara = DataManagerGame.Instance.dataUnit.list.Find(p =>
                                                                                         p.chara_id == GameMain.Instance.SelectCharaId &&
                                                                                         p.unit == "chara");

                select_chara.hp -= iDamage;
                GameMain.Instance.CharaRefresh();
            }
            battleMain.HpRefresh();
        }
Esempio n. 30
0
        public override void OnEnter()
        {
            base.OnEnter();

            battleMain.Opening();

            battleMain.m_animChara.Play("idle");
            battleMain.m_animEnemy.Play("idle");


            if (battleMain.player_card != null)
            {
                GameObject.Destroy(battleMain.player_card.gameObject);
                battleMain.player_card = null;
            }
            if (battleMain.enemy_card != null)
            {
                GameObject.Destroy(battleMain.enemy_card.gameObject);
                battleMain.enemy_card = null;
            }
            battleMain.dataCardEnemy.list.Clear();

            BattleIcon[] arr = battleMain.m_goBattleChara.GetComponentsInChildren <BattleIcon>();
            foreach (BattleIcon c in arr)
            {
                GameObject.Destroy(c.gameObject);
            }
            arr = battleMain.m_goBattleEnemy.GetComponentsInChildren <BattleIcon>();
            foreach (BattleIcon c in arr)
            {
                GameObject.Destroy(c.gameObject);
            }

            // 敵のデッキデータ
            //Debug.LogWarning(DataManagerGame.Instance.masterCharaCard.list.FindAll(p => p.chara_id == enemy_chara_id.Value).Count);


            MasterCharaParam master_enemy = DataManagerGame.Instance.masterChara.list.Find(p => p.chara_id == enemy_chara_id.Value);

            battleMain.dataCardEnemy.SetSaveFilename(Defines.FILENAME_CARD_ENEMY);


            if (0 == DataManagerGame.Instance.gameData.ReadInt(Defines.KEY_GAME_BATTLE_ENEMY_ID))
            {
                // 敵は1体消して新規に追加
                DataManagerGame.Instance.dataUnit.list.RemoveAll(p => p.unit == "enemy");

                // 敵にこっそりテンションを入れるならここ
                DataUnitParam enemy = DataUnit.MakeUnit(master_enemy, 1, "enemy", 60);
                DataManagerGame.Instance.dataUnit.list.Add(enemy);

                DataManagerGame.Instance.gameData.WriteInt(Defines.KEY_GAME_BATTLE_ENEMY_ID, enemy_chara_id.Value);

                int iSerial = 1;
                foreach (MasterCharaCardParam cc in DataManagerGame.Instance.masterCharaCard.list.FindAll(p => p.chara_id == enemy_chara_id.Value))
                {
                    DataCardParam   add         = new DataCardParam();
                    MasterCardParam master_card = DataManagerGame.Instance.masterCard.list.Find(p => p.card_id == cc.card_id);
                    add.Copy(master_card, enemy_chara_id.Value, iSerial);
                    battleMain.dataCardEnemy.list.Add(add);
                    iSerial += 1;
                }
            }
            else
            {
                Debug.Log("battle resume");
                enemy_chara_id.Value = DataManagerGame.Instance.gameData.ReadInt(Defines.KEY_GAME_BATTLE_ENEMY_ID);
                master_enemy         = DataManagerGame.Instance.masterChara.list.Find(p => p.chara_id == enemy_chara_id.Value);

                battleMain.dataCardEnemy.LoadMulti();
            }


            battleMain.m_sprEnemy.sprite = SpriteManager.Instance.Get(master_enemy.sprite_name);
            battleMain.HpRefresh();


            battleMain.OnOpeningEnd.AddListener(() =>
            {
                battleMain.OnOpeningEnd.RemoveAllListeners();
                if (is_boss.Value)
                {
                    BGMControl.Instance.Play(Defines.BGM_NAME_BOSS);
                }
                else
                {
                    BGMControl.Instance.Play(Defines.BGM_NAME_BATTLE);
                }
                Finish();
            });
        }