Beispiel #1
0
    //run this function from the dialogue when encounter starts
    public void Encounter()
    {
        botPower    = assignedBot.botPower;
        playerPower = playerStats.power;

        int playerEdge = playerPower - playerEdgeAdjustment;

        int playerRoll = Random.Range(playerEdge, playerPower);

        if (botPower <= playerRoll)
        {
            playerWins = true;
            dialogue.DeclareTheWinner(playerWins);
            Debug.Log("Player wins.");
        }
        else
        {
            playerWins = false;
            dialogue.DeclareTheWinner(playerWins);
            DoDamage();
            Debug.Log("Player loses.");
        }

        void DoDamage()
        {
            playerStats.TakeDamage(botPower);
        }
    }