Beispiel #1
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);
        }
Beispiel #2
0
 public void DamageStatisticsCanBeConvertedBasedOnSize()
 {
     Assert.Equal("1d4", DamageTables.ConvertDamageBySize("1d6", CharacterSize.Small));
     Assert.Equal("2d6", DamageTables.ConvertDamageBySize("1d8", CharacterSize.Large));
     Assert.Equal("2d6", DamageTables.ConvertDamageBySize("2d10", CharacterSize.Tiny));
     Assert.Equal("1d6", DamageTables.ConvertDamageBySize("1d8", CharacterSize.Small));
     Assert.Equal("1d8", DamageTables.ConvertDamageBySize("1d8", CharacterSize.Medium));
 }
Beispiel #3
0
 public void ThrowsDamageTableAmountNotFoundExceptionIfIncorrectTypesAreUsed()
 {
     Assert.Throws(typeof(DamageTableValueNotFoundException), () => DamageTables.ConvertDamageBySize("10d6", CharacterSize.Small));
 }
Beispiel #4
0
 public void NotImplementedExceptionTriggeredForNotSupportedSizes()
 {
     Assert.Throws(typeof(NotImplementedException), () => DamageTables.ConvertDamageBySize("1d6", CharacterSize.Colossal));
 }
Beispiel #5
0
 public void DropsModifiersDuringConversion()
 {
     Assert.Equal("1d4+2", DamageTables.ConvertDamageBySize("1d6+2", CharacterSize.Small));
 }
Beispiel #6
0
 public void NotImplementedExceptionTriggeredForNotSupportedSizes()
 {
     DamageTables.ConvertDamageBySize("1d6", CharacterSize.Colossal);
 }