예제 #1
0
 private void HandleOnUseCustomRace()
 {
     ClearSelectedRace();
     SetRaceBonusDictionaryToZero();
     HideRacePickerButtons();
     _selectedRaceModel = new RaceModel()
     {
         Name = "Custom"
     };
     ShowCustomRaceControls();
 }
예제 #2
0
        /// <summary>
        /// Determine if a given race model has bonus stats. If all stats are +0 bonus we can determine that it gets a custom bonus.
        /// </summary>
        /// <param name="model"></param>
        /// <returns>Boolean: Whether or not a model is a race with a custom bonus</returns>
        private bool RaceHasCustomBonus(IRaceModel model)
        {
            var stats = GetStatlineFromRaceModel(model);

            foreach (var stat in stats)
            {
                if (stat.Value != 0)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #3
0
        private static Dictionary <string, int> GetStatlineFromRaceModel(IRaceModel model)
        {
            var stats = new Dictionary <string, int>
            {
                { StatNames.Strength, model.Strength },
                { StatNames.Dexterity, model.Dexterity },
                { StatNames.Constitution, model.Constitution },
                { StatNames.Intelligence, model.Intelligence },
                { StatNames.Wisdom, model.Wisdom },
                { StatNames.Charisma, model.Charisma }
            };

            return(stats);
        }
예제 #4
0
        private void HandleOnSelectedRace(string selected)
        {
            HideCustomControls();
            ShowRacePickerButtons();
            _selectedRaceModel = _raceModelsList.FirstOrDefault(x => x.Name == selected);
            if (RaceHasCustomBonus(_selectedRaceModel))
            {
                _selectedRaceBonusString = "";
                ShowBonusPicker();
            }
            else
            {
                HideCustomControls();
                _selectedRaceBonusString = $"{GetRaceBonusString(_selectedRaceModel)}";
            }

            PopulateRaceBonusDictionary(_selectedRaceModel);
        }
예제 #5
0
        private string GetRaceBonusString(IRaceModel model)
        {
            var bonusList   = new List <string>();
            var penaltyList = new List <string>();
            var statLine    = GetStatlineFromRaceModel(model);

            //Populate bonuses and penalties
            foreach (var stat in statLine)
            {
                if (stat.Value > 0)
                {
                    bonusList.Add($"+{stat.Value} {GetStatAbbr(stat)}");
                }

                if (stat.Value < 0)
                {
                    penaltyList.Add($"{stat.Value} {GetStatAbbr(stat)}");
                }
            }

            //Build Rreturn string
            return(PfStringUtils.BuildRaceBonusString(bonusList, penaltyList));
        }
예제 #6
0
 private void PopulateRaceBonusDictionary(IRaceModel model)
 {
     _currentRacialBonusDictionary = GetStatlineFromRaceModel(model);
 }
예제 #7
0
 private void ClearSelectedRace()
 {
     _selectedRaceBonusString = "";
     _selectedRaceModel       = new RaceModel();
     SetRaceBonusDictionaryToZero();
 }