Exemplo n.º 1
0
 private void HandleOnUseCustomRace()
 {
     ClearSelectedRace();
     SetRaceBonusDictionaryToZero();
     HideRacePickerButtons();
     _selectedRaceModel = new RaceModel()
     {
         Name = "Custom"
     };
     ShowCustomRaceControls();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 6
0
 private void PopulateRaceBonusDictionary(IRaceModel model)
 {
     _currentRacialBonusDictionary = GetStatlineFromRaceModel(model);
 }
Exemplo n.º 7
0
 private void ClearSelectedRace()
 {
     _selectedRaceBonusString = "";
     _selectedRaceModel       = new RaceModel();
     SetRaceBonusDictionaryToZero();
 }