예제 #1
0
        private AbilityScoresModel GetAbilityScores(AbilityScoresModel classAS, AbilityScoresModel raceAS, AbilityScoresModel raceVariantAS)
        {
            int Str = classAS.Str + raceAS.Str + raceVariantAS.Str;
            int Dex = classAS.Dex + raceAS.Dex + raceVariantAS.Dex;
            int Con = classAS.Con + raceAS.Con + raceVariantAS.Con;
            int Int = classAS.Int + raceAS.Int + raceVariantAS.Int;
            int Wis = classAS.Wis + raceAS.Wis + raceVariantAS.Wis;
            int Cha = classAS.Cha + raceAS.Cha + raceVariantAS.Cha;

            AbilityScoresModel newAbilityScores = new AbilityScoresModel()
            {
                Str    = Str,
                StrMod = GetAbilityScoreModifier(Str),
                Dex    = Dex,
                DexMod = GetAbilityScoreModifier(Dex),
                Con    = Con,
                ConMod = GetAbilityScoreModifier(Con),
                Int    = Int,
                IntMod = GetAbilityScoreModifier(Int),
                Wis    = Wis,
                WisMod = GetAbilityScoreModifier(Wis),
                Cha    = Cha,
                ChaMod = GetAbilityScoreModifier(Cha),
            };

            return(newAbilityScores);
        }
예제 #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();
        }