Esempio n. 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))));
        }
    }
    public void GetReward()
    {
        int[] _rewards = enemies[id].rewards;

        if (_rewards[0] != 0)
        {
            _characterStats.itemPickup(_rewards[0], 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]);
        }
    }
    public void Complete()
    {
        Character_stats _characterStats = GameObject.Find("Game manager").GetComponent <Character_stats>();

        if (xp != 0)
        {
            _characterStats.getXP(xp);
        }
        if (item != 0)
        {
            _characterStats.itemPickup(item, true);
        }
        if (money != 0)
        {
            _characterStats.getMoney(money);
        }
    }
Esempio n. 4
0
    public void selectOption(int option_id)
    {
        var    conversation = GameObject.Find("Conversation").GetComponent <Conversation_script>();
        string option       = "";

        switch (option_id)
        {
        case 0:
            option = conversations[conversation.conversation_id].option_1_type[conversation.dialogue_length];
            break;

        case 1:
            option = conversations[conversation.conversation_id].option_2_type[conversation.dialogue_length];
            break;

        default:
            break;
        }

        if (option.Contains("next"))
        {
            conversation.continueConversation();
        }

        if (option.Contains("exit"))
        {
            conversation.closeConversation();
        }

        if (option.Contains("finalexit"))
        {
            conversation.closeConversation();
            _characterStats.completed_conversations.Add(conversation.conversation_id);
        }

        if (option.Contains("item_add"))
        {
            if (!_characterStats.isInventoryFull())
            {
                string[] split = option.Split(':');
                _characterStats.itemPickup(int.Parse(split[1]), true);
                conversation.continueConversation();
            }
            else
            {
                conversation.closeConversation();
            }
        }

        if (option.Contains("change_dialog"))
        {
            string[] split = option.Split(':');
            conversation.showConversation(int.Parse(split[1]));
        }

        if (option.Contains("skip"))
        {
            string[] split = option.Split(':');
            conversation.dialogue_length = int.Parse(split[1]) - 1;
            conversation.continueConversation();
        }
        if (option.Contains("money_add"))
        {
            string[] split = option.Split(':');
            _characterStats.getMoney(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("money_remove"))
        {
            string[] split = option.Split(':');
            _characterStats.looseMoney(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("xp_add"))
        {
            string[] split = option.Split(':');
            _characterStats.getXP(int.Parse(split[1]));
            conversation.continueConversation();
        }
        if (option.Contains("quest_add"))
        {
            string[] split = option.Split(':');
            GameObject.Find("Game manager").GetComponent <Quest_manager_script>().acceptQuest(int.Parse(split[1]));
            conversation.continueConversation();
        }

        if (option.Contains("start_battle"))
        {
            _characterStats.completed_conversations.Add(conversation.conversation_id);
            string[] split = option.Split(':');
            GameObject.Find("Game manager").GetComponent <Game_manager>().Change_screen(battle_screen, false);
            GameObject.Find("Game manager").GetComponent <Combat_manager_script>().initializeBattle(int.Parse(split[1]));
            conversation.continueConversation();
        }
    }