/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Shields.Paizo.CoreRulebook.HeavyShield"/> class. /// </summary> /// <param name="size">The size of character this shield is intended to be used by.</param> /// <param name="material">The dominant material the shield is crafted from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public HeavyShield(SizeCategory size, HeavyShieldMaterial material) : base(armorClassBonus: ARMOR_BONUS, materialInchesOfThickness: InchesOfThicknessScaledBySize(size, GetMediumInchesOfThicknessForMaterial(material)), materialHitPointsPerInch: GetHitPointsPerInchOfThicknessForMaterial(material), materialHardness: GetHardnessForMaterial(material)) { const double STEEL_WEIGHT = 15; const double STEEL_PRICE = 20; switch (material) { case HeavyShieldMaterial.Darkwood: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Darkwood.GetShieldArmorCheckPenalty(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => Darkwood.GetShieldBaseMarketValue(MarketValueScaledBySize(size, WOOD_PRICE), this.GetWeight()); this.Weight = () => Darkwood.GetWeight(WeightScaledBySize(size, WOOD_WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Darkwood", Darkwood.WebAddress), StandardShieldName }; break; case HeavyShieldMaterial.Mithral: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Mithral.GetArmorCheckPenalty(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => Mithral.GetShieldBaseMarketValue(MarketValueScaledBySize(size, STEEL_PRICE)); this.Weight = () => Mithral.GetWeight(WeightScaledBySize(size, STEEL_WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Mithral", Mithral.WebAddress), StandardShieldName }; break; case HeavyShieldMaterial.Steel: this.ArmorCheckPenalty = () => this.StandardArmorCheckPenaltyCalculation(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => StandardMundaneMarketPriceCalculation(MarketValueScaledBySize(size, STEEL_PRICE)); this.Weight = () => WeightScaledBySize(size, STEEL_WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment("Heavy Steel Shield", StandardShieldName.WebAddress), }; break; case HeavyShieldMaterial.Wood: this.ArmorCheckPenalty = () => this.StandardArmorCheckPenaltyCalculation(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => StandardMundaneMarketPriceCalculation(MarketValueScaledBySize(size, WOOD_PRICE)); this.Weight = () => WeightScaledBySize(size, WOOD_WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment("Heavy Wooden Shield", StandardShieldName.WebAddress), }; break; default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }
public void GetWeight() { // Arrange double baseWeight = 12; // Act var darkwoodWeight = Darkwood.GetWeight(baseWeight); // Assert Assert.AreEqual(6, darkwoodWeight); }
/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Shields.Paizo.CoreRulebook.TowerShield"/> class. /// </summary> /// <param name="size">The size of character this shield is intended to be used by.</param> /// <param name="material">The dominant material the shield is crafted from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public TowerShield(SizeCategory size, TowerShieldMaterial material) : base(armorClassBonus: ARMOR_BONUS, materialInchesOfThickness: InchesOfThicknessScaledBySize(size, INCHES_OF_THICKNESS), materialHitPointsPerInch: GetHitPointsPerInchOfThicknessForMaterial(material), materialHardness: GetHardnessForMaterial(material)) { switch (material) { case TowerShieldMaterial.Darkwood: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Darkwood.GetShieldArmorCheckPenalty(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => Darkwood.GetShieldBaseMarketValue(MarketValueScaledBySize(size, WOOD_PRICE), this.GetWeight()); this.Weight = () => Darkwood.GetWeight(WeightScaledBySize(size, WOOD_WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Darkwood", Darkwood.WebAddress), StandardShieldName }; break; case TowerShieldMaterial.Wood: this.ArmorCheckPenalty = () => this.StandardArmorCheckPenaltyCalculation(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => StandardMundaneMarketPriceCalculation(MarketValueScaledBySize(size, WOOD_PRICE)); this.Weight = () => WeightScaledBySize(size, WOOD_WEIGHT); this.MundaneName = () => new INameFragment[] { StandardShieldName }; break; default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } // Tower shields apply a maximum dexterity bonus to AC this.OnApplied += (sender, e) => { e.Character?.ArmorClass?.MaxKeyAbilityScore?.Add(this.GetMaximumDexterityBonus); }; // Tower shields inflict a -2 penalty to melee attack rolls this.OnApplied += (sender, e) => { e.Character?.AttackBonuses?.GenericMeleeAttackBonus?.Penalties?.Add(() => 2); }; }