/// <summary> /// Creates an instance of <see cref="SpellbookModel"/> /// </summary> public SpellbookModel(SpellbookModel spellbookModel) { _id = spellbookModel.ID; _name = spellbookModel.Name; _basedOnClass = spellbookModel.BasedOnClass; _basedOnRace = spellbookModel.BasedOnRace; if (spellbookModel.Class != null) { _class = new ClassModel(spellbookModel.Class); } if (spellbookModel.Race != null) { _race = new RaceModel(spellbookModel.Race); } _ability = spellbookModel.Ability; _additionalDCBonus = spellbookModel.AdditionalDCBonus; _additionalToHitBonus = spellbookModel.AdditionalToHitBonus; _resetOnShortRest = spellbookModel.ResetOnShortRest; _resetOnLongRest = spellbookModel.ResetOnLongRest; _spells = new List <SpellbookEntryModel>(); foreach (SpellbookEntryModel spellbookEntryModel in spellbookModel.Spells) { _spells.Add(new SpellbookEntryModel(spellbookEntryModel)); } _currentFirstLevelSpellSlots = spellbookModel.CurrentFirstLevelSpellSlots; _currentSecondLevelSpellSlots = spellbookModel.CurrentSecondLevelSpellSlots; _currentThirdLevelSpellSlots = spellbookModel.CurrentThirdLevelSpellSlots; _currentFourthLevelSpellSlots = spellbookModel.CurrentFourthLevelSpellSlots; _currentFifthLevelSpellSlots = spellbookModel.CurrentFifthLevelSpellSlots; _currentSixthLevelSpellSlots = spellbookModel.CurrentSixthLevelSpellSlots; _currentSeventhLevelSpellSlots = spellbookModel.CurrentSeventhLevelSpellSlots; _currentEighthLevelSpellSlots = spellbookModel.CurrentEighthLevelSpellSlots; _currentNinthLevelSpellSlots = spellbookModel.CurrentNinthLevelSpellSlots; }
/// <summary> /// Creates a copy of <see cref="RaceModel"/> /// </summary> public RaceModel(RaceModel raceModel) : base(raceModel) { _size = raceModel.Size; _walkSpeed = raceModel.WalkSpeed; _flySpeed = raceModel.FlySpeed; _abilities = new Dictionary <Ability, int>(raceModel.Abilities); _skillProficiencies = new List <Skill>(raceModel.SkillProficiencies); _languages = new List <string>(raceModel.Languages); _weaponProficiencies = new List <string>(raceModel.WeaponProficiencies); _armorProficiencies = new List <string>(raceModel.ArmorProficiencies); _toolProficiencies = new List <string>(raceModel.ToolProficiencies); _languageTrait = raceModel.LanguageTrait; _traits = new List <TraitModel>(); foreach (TraitModel traitModel in raceModel.Traits) { _traits.Add(new TraitModel(traitModel)); } _xml = raceModel.XML; }
/// <summary> /// Creates a copy of <see cref="CharacterModel"/> /// </summary> public CharacterModel(CharacterModel characterModel) : base(characterModel) { _currentHP = characterModel.CurrentHP; _tempHP = characterModel.TempHP; _deathSaveSuccesses = characterModel.DeathSaveSuccesses; _deathSaveFailures = characterModel.DeathSaveFailures; _race = characterModel.Race != null ? new RaceModel(characterModel.Race) : null; _background = characterModel.Background != null ? new BackgroundModel(characterModel.Background) : null; _alignment = characterModel.Alignment; _movementModel = new MovementModel(characterModel.MovementModel); _inspiration = characterModel.Inspiration; _deity = characterModel.Deity; _gender = characterModel.Gender; _age = characterModel.Age; _heightFeet = characterModel.HeightFeet; _heightInches = characterModel.HeightInches; _weight = characterModel.Weight; _hair = characterModel.Hair; _eyes = characterModel.Eyes; _skin = characterModel.Skin; _experience = characterModel.Experience; _baseStrength = characterModel.BaseStrength; _baseDexterity = characterModel.BaseDexterity; _baseConstitution = characterModel.BaseConstitution; _baseIntelligence = characterModel.BaseIntelligence; _baseWisdom = characterModel.BaseWisdom; _baseCharisma = characterModel.BaseCharisma; _bonusStrength = characterModel.BonusStrength; _bonusDexterity = characterModel.BonusDexterity; _bonusConstitution = characterModel.BonusConstitution; _bonusIntelligence = characterModel.BonusIntelligence; _bonusWisdom = characterModel.BonusWisdom; _bonusCharisma = characterModel.BonusCharisma; _personalityTraits = characterModel.PersonalityTraits; _ideals = characterModel.Ideals; _bonds = characterModel.Bonds; _flaws = characterModel.Flaws; _backstory = characterModel.Backstory; _levels = new List <LevelModel>(); foreach (LevelModel levelModel in characterModel.Levels) { _levels.Add(new LevelModel(levelModel)); } _abilityRollMethod = characterModel.AbilityRollMethod; _timesAbilityScoresRolled = characterModel.TimesAbilityScoresRolled; _abilitySaveProficiencies = new List <AbilityModel>(); foreach (AbilityModel abilityModel in characterModel.AbilitySaveProficiencies) { _abilitySaveProficiencies.Add(new AbilityModel(abilityModel)); } _skillProficiencies = new List <SkillModel>(); foreach (SkillModel skillModel in characterModel.SkillProficiencies) { _skillProficiencies.Add(new SkillModel(skillModel)); } _languages = new List <LanguageModel>(); foreach (LanguageModel languageModel in characterModel.Languages) { _languages.Add(new LanguageModel(languageModel)); } _armorProficiencyModel = new ArmorProficiencyModel(characterModel.ArmorProficiency); _weaponProficiencyModel = new WeaponProficiencyModel(characterModel.WeaponProficiency); _toolProficiencyModel = new ToolProficiencyModel(characterModel.ToolProficiency); _conditions = new List <AppliedConditionModel>(); foreach (AppliedConditionModel appliedCondition in characterModel.Conditions) { _conditions.Add(new AppliedConditionModel(appliedCondition)); } _savingThrowNotes = characterModel.SavingThrowNotes; _attacks = new List <AttackModel>(); foreach (AttackModel attackModel in characterModel.Attacks) { _attacks.Add(new AttackModel(attackModel)); } _counters = new List <CounterModel>(); foreach (CounterModel counter in characterModel.Counters) { _counters.Add(new CounterModel(counter)); } _companions = new List <CompanionModel>(); foreach (CompanionModel companion in characterModel.Companions) { _companions.Add(new CompanionModel(companion)); } _bags = new List <BagModel>(); foreach (BagModel bag in characterModel.Bags) { _bags.Add(new BagModel(bag)); } _spellbooks = new List <SpellbookModel>(); foreach (SpellbookModel spellbook in characterModel.Spellbooks) { _spellbooks.Add(new SpellbookModel(spellbook)); } _statModifications = new List <StatModificationModel>(); foreach (StatModificationModel statModification in characterModel.StatModifications) { _statModifications.Add(new StatModificationModel(statModification)); } _armorClassModel = new ArmorClassModel(characterModel.ArmorClassModel); }