Example #1
0
    public void getBattleReward()
    {
        if (battle_result == "Victory")
        {
            var enemy    = GameObject.Find("Game manager").GetComponent <Enemy_manager_script>();
            var _rewards = battles[battle_id].rewards;

            if (_rewards[0] != 0 && !battles[battle_id].isRandomReward)
            {
                _characterStats.itemPickup(_rewards[0], true);
            }
            else if (battles[battle_id].isRandomReward)
            {
                _characterStats.itemPickup(item_id, true);
            }
            if (_rewards[1] != 0)
            {
                _characterStats.itemPickup(_rewards[1], true, true);
            }
            if (_rewards[2] != 0)
            {
                _characterStats.getXP(_rewards[2]);
            }
            if (_rewards[3] != 0)
            {
                _characterStats.getMoney(_rewards[3]);
            }
            if (_rewards[4] != 0)
            {
                _characterStats.getSpellPoint(_rewards[4]);
            }

            foreach (var opponent in opponents)
            {
                opponent.GetComponent <Enemy_script>().GetReward();
            }
        }
        else if (battle_result == "Defeat")
        {
            _characterStats.looseMoney(_characterStats.getPercentOfMoney((20 - ((_characterStats.Player_penalty_rate) * 1))));
        }
    }