コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverNeedle.Characters.Initiative"/> class.
 /// </summary>
 /// <param name="abilities">Abilities scores for the character.</param>
 public Initiative(AbilityScores abilities)
     : base()
 {
     this.abilities           = abilities;
     this.abilities.Modified += this.AbilityModified;
     this.UpdateInitiative();
 }
コード例 #2
0
 /// <summary>
 /// Copies these ability scores from another container for duplication
 /// </summary>
 /// <param name="scores">AbilityScores container to copy values to</param>
 public void Copy(AbilityScores scores)
 {
     foreach (var e in scores.Abilities)
     {
         this.SetScore(e.Ability, e.BaseValue);
     }
 }
コード例 #3
0
        /// <summary>
        /// Calculates what attacks are available to this instance
        /// </summary>
        /// <returns>List of attacks that are available</returns>
        public IList <AttackStatistic> Attacks()
        {
            var attacks = new List <AttackStatistic>();

            // Get A list of weapons and return them
            foreach (var weapon in this.inventory.Weapons)
            {
                var atk = new AttackStatistic();
                atk.Name   = weapon.Name;
                atk.Weapon = weapon;
                atk.Damage = DiceStrings.ParseDice(DamageTables.ConvertDamageBySize(weapon.Damage, this.Size.Size));
                if (weapon.IsMelee)
                {
                    atk.Damage.Modifier = AbilityScores.GetModifier(AbilityScoreTypes.Strength);
                    atk.AttackBonus     = this.MeleeAttackBonus();
                }
                else if (weapon.IsRanged)
                {
                    atk.AttackBonus = this.RangeAttackBonus();
                }

                // If not proficient, add a penalty to the attack bonus
                if (!this.IsProficient(weapon))
                {
                    atk.AttackBonus += UnproficientWeaponModifier;
                }

                attacks.Add(atk);
            }

            return(attacks);
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverNeedle.Characters.OffenseStats"/> class.
 /// </summary>
 /// <param name="scores">Ability scores of the character.</param>
 /// <param name="size">Size of the character.</param>
 /// <param name="inventory">Inventory and gear of the character.</param>
 public OffenseStats(AbilityScores scores, SizeStats size, Inventory inventory)
 {
     this.BaseAttackBonus       = new BasicStat();
     this.combatManeuverDefense = new BasicStat(10);
     this.combatManeuverOffense = new BasicStat();
     this.AbilityScores         = scores;
     this.Size                = size;
     this.inventory           = inventory;
     this.WeaponProficiencies = new List <WeaponProficiency>();
     this.offensiveAbilities  = new List <SpecialAbility>();
 }
コード例 #5
0
 /// <summary>
 /// Fills the skills.
 /// </summary>
 /// <param name="skills">Skills available.</param>
 /// <param name="scores">Scores to base skill ranks on.</param>
 private void FillSkills(IEnumerable <Skill> skills, AbilityScores scores)
 {
     foreach (var s in skills)
     {
         this.skills.Add(
             s.Name,
             new CharacterSkill(
                 s,
                 scores.GetAbility(s.Ability),
                 false));
     }
 }
コード例 #6
0
        public void Initialize(ComponentContainer components)
        {
            abilityScores = components.Get <AbilityScores>();
            ArmorCheckPenalty.AddModifier(new EquippedArmorCheckPenaltyModifier(components));
            var armorCheckSkills = GetSkills().Where(x => x.Skill.UseArmorCheckPenalty);

            foreach (var skl in armorCheckSkills)
            {
                var modifier = new DelegateStatModifier(skl.Name, "Armor", () => { return(ArmorCheckPenalty.TotalValue); });
                skl.AddModifier(modifier);
            }
        }
コード例 #7
0
        public CharacterSheet(CharacterStrategy strategy)
        {
            this.Components = new ComponentContainer();
            var abilityScores = new AbilityScores();

            this.Components.AddNoInitialize(new object[] {
                strategy,
                abilityScores,
                new SizeStats(),
                new Inventory(),
                new History(),
                new OffenseStats(),
                new MeleeAttackBonus(),
                new RangeAttackBonus(),
                new DefenseStats(),
                new MovementStats(),
                new CharacterAppearance(),
                new SkillRanks(),
                new Likes()
            });
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SilverNeedle.Characters.DefenseStats"/> class.
        /// </summary>
        /// <param name="abilityScores">Ability scores of the character.</param>
        /// <param name="size">Size of the character.</param>
        /// <param name="inv">Inventory of the character.</param>
        public DefenseStats(AbilityScores abilityScores, SizeStats size, Inventory inv)
        {
            this.abilities = abilityScores;
            this.size      = size;
            this.inventory = inv;

            this.fortitudeSave = new BasicStat();
            this.fortitudeSave.AddModifier(
                new AbilityStatModifier(abilityScores.GetAbility(AbilityScoreTypes.Constitution)));

            this.reflexSave = new BasicStat();
            this.reflexSave.AddModifier(
                new AbilityStatModifier(abilityScores.GetAbility(AbilityScoreTypes.Dexterity)));

            this.willSave = new BasicStat();
            this.willSave.AddModifier(
                new AbilityStatModifier(abilityScores.GetAbility(AbilityScoreTypes.Wisdom)));

            this.armor = new BasicStat(BaseArmorClass);

            this.specialAbilities = new List <SpecialAbility>();
        }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SilverNeedle.Characters.SkillRanks"/> class.
        /// </summary>
        /// <param name="skillList">Skills available</param>
        /// <param name="scores">Ability scores for a baseline.</param>
        public SkillRanks(IEnumerable <Skill> skillList, AbilityScores scores)
        {
            this.skills = new Dictionary <string, CharacterSkill>();

            this.FillSkills(skillList, scores);
        }
コード例 #10
0
 /// <summary>
 /// Gets the skill points per level.
 /// </summary>
 /// <returns>The skill points per level.</returns>
 public int GetSkillPointsPerLevel()
 {
     return(Class.SkillPoints + AbilityScores.GetModifier(AbilityScoreTypes.Intelligence));
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverNeedle.Characters.SkillRanks"/> class.
 /// </summary>
 /// <param name="skillList">Skills available</param>
 /// <param name="scores">Ability scores for a baseline.</param>
 public SkillRanks(IEnumerable <Skill> skillList, AbilityScores scores) : this()
 {
     this.abilityScores = scores;
     this.FillSkills(skillList);
 }