Esempio n. 1
0
        private CharacterClassModel GetPrimaryClass()
        {
            CharacterClassModel charClass = null;
            int level = 0;

            foreach (var c in this.charClass.Values)
            {
                if (c.Level > level)
                {
                    charClass = c;
                    level     = c.Level;
                }
            }

            return(charClass);
        }
Esempio n. 2
0
        public Character(int level, string characterClass, string characterRace)
        {
            this.actionAttack   = new List <ActionModel> {
            };
            this.actionBonus    = new List <ActionModel> {
            };
            this.actionOption   = new List <ActionModel> {
            };
            this.actionReaction = new List <ActionModel> {
            };

            // Get required character data
            this.charBackgroundCard  = Decks.BackgroundDeck.Cards.PullRandomCardFromDeck();
            this.charClassCard       = Decks.ClassDeck.Cards.Find(x => x.Name == characterClass);
            this.charFactionCard     = Decks.FactionDeck.Cards.PullRandomCardFromDeck();
            this.charRaceCard        = Decks.RaceDeck.Cards.Find(x => x.Name == characterRace);
            this.charRaceVariantCard = this.charRaceCard.Variants.PullRandomCardFromDeck(true);

            // Define classes and totalLevel
            this.charClass = new Dictionary <string, CharacterClassModel> {
                {
                    this.charClassCard.Name,
                    new CharacterClassModel()
                    {
                        Level = level,
                        Name  = this.charClassCard.Name,
                    }
                }
            };

            //Test Multiclass
            //if (!this.charClass.ContainsKey(ClassEnum.Wizard.ToString()))
            //{
            //    this.charClass.Add(
            //        ClassEnum.Wizard.ToString(),
            //        new CharacterClassModel()
            //        {
            //            Level = 1,
            //            Name = ClassEnum.Wizard.ToString()
            //        }
            //    );
            //}

            this.totalLevel = GetTotalLevel();

            // Calculate modifiers
            this.abilityScores    = GetAbilityScores(this.charClassCard.AbilityScores, this.charRaceCard.AbilityScores, this.charRaceVariantCard.AbilityScores);
            this.age              = rng.Next(this.charRaceCard.AgeRange.Min, this.charRaceCard.AgeRange.Max);
            this.charBackground   = GetBackground();
            this.charClassPrimary = GetPrimaryClass();
            this.id               = CreateGuid();
            this.immunity         = GetImmunities();
            this.proficiencyBonus = GetProficiencyBonus();
            this.raceTraits       = GetRaceTraits();
            this.resistance       = GetResistances();
            this.speed            = this.charRaceVariantCard.Speed != 30 ? this.charRaceVariantCard.Speed : this.charRaceCard.Speed;

            GetEquipment();
            GetClassFeatures();
            CalculateHitPoints();
            GetProficiencies();
            GetActions();
        }