Esempio n. 1
0
        public void Reroll(DFCareer dfClass)
        {
            // Assign base stats from class template
            DaggerfallStats rolledStats = CharacterDocument.GetClassBaseStats(dfClass);

            // Roll bonus value for each base stat
            // Using maxBonusRoll + 1 as Unity's Random.Range(int,int) is exclusive
            // of maximum value and we want to be inclusive of maximum value
            rolledStats.Strength     += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Intelligence += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Willpower    += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Agility      += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Endurance    += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Personality  += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Speed        += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);
            rolledStats.Luck         += UnityEngine.Random.Range(minBonusRoll, maxBonusRoll + 1);

            // Roll bonus pool for player to distribute
            // Using maxBonusPool + 1 for inclusive range as above
            int bonusPool = UnityEngine.Random.Range(minBonusPool, maxBonusPool + 1);

            // Apply stats to control
            SetStats(rolledStats, rolledStats, bonusPool);
            UpdateStatLabels();

            // Play "rolling dice" sound
            DaggerfallUI.Instance.PlayOneShot(SoundClips.DiceRoll);
        }