/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.Chainmail"/> class. /// </summary> /// <param name="size">The size of the character intended to wear the armor.</param> /// <param name="material">The material the chainmail is made from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public Chainmail(SizeCategory size, ChainmailMaterial material) : base(6, GetHardnessForMaterial(material)) { const byte ARMOR_CHECK_PENALTY = 5; const byte MAX_DEX_BONUS = 2; const double WEIGHT = 40; const double PRICE = 150; const float SPEED_PENALTY = 0.25f; NameFragment standardName = new NameFragment("Chainmail", "http://www.d20pfsrd.com/equipment/armor/chainmail/"); switch (material) { case ChainmailMaterial.Adamantine: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneMarketPrice = () => Adamantine.GetMediumArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => WeightScaledBySize(size, WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment("Adamantine", Adamantine.WebAddress), standardName }; this.SpeedPenalty = SPEED_PENALTY; var(drMag, drBypass) = Adamantine.GetMediumArmorDamageReduction(); this.OnApplied += (sender, e) => { e.Character?.DamageReduction?.Add(drMag, drBypass); }; break; case ChainmailMaterial.Mithral: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Mithral.GetArmorCheckPenalty(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => Mithral.GetArmorMaximumDexterityBonus(MAX_DEX_BONUS); this.MundaneMarketPrice = () => Mithral.GetMediumArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => Mithral.GetWeight(WeightScaledBySize(size, WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Mithral", Mithral.WebAddress), standardName }; this.SpeedPenalty = 0; break; case ChainmailMaterial.Steel: this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneMarketPrice = () => StandardMundaneMarketPriceCalculation(MarketValueScaledBySize(size, PRICE)); this.Weight = () => WeightScaledBySize(size, WEIGHT); this.MundaneName = () => new INameFragment[] { standardName }; this.SpeedPenalty = SPEED_PENALTY; break; default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }
public void GetHeavyArmorDamageReduction() { // Act var dr = Adamantine.GetHeavyArmorDamageReduction(); // Assert Assert.AreEqual(3, dr.Magnitude()); Assert.AreEqual("—", dr.BypassedBy); }
public void GetHeavyArmorBaseMarketPrice() { // Assert double baseMarketPrice = 0; // Act var adamantinePrice = Adamantine.GetHeavyArmorBaseMarketPrice(baseMarketPrice); // Assert Assert.AreEqual(15_000, adamantinePrice, "Adamantine should increase the price of light armor by +15000gp."); }
/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.Breastplate"/> class. /// </summary> /// <param name="size">The size of the character intended to wear the armor.</param> /// <param name="material">The material the breastplate is made from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public Breastplate(SizeCategory size, BreastplateMaterial material) : base(BASE_ARMOR_BONUS, GetHardnessForMaterial(material)) { switch (material) { case BreastplateMaterial.Adamantine: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneMarketPrice = () => Adamantine.GetMediumArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => WeightScaledBySize(size, WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment("Adamantine", Adamantine.WebAddress), StandardName }; this.SpeedPenalty = SPEED_PENALTY; var(drMag, drBypass) = Adamantine.GetMediumArmorDamageReduction(); this.OnApplied += (sender, e) => { e.Character?.DamageReduction?.Add(drMag, drBypass); }; break; case BreastplateMaterial.Mithral: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Mithral.GetArmorCheckPenalty(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => Mithral.GetArmorMaximumDexterityBonus(MAX_DEX_BONUS); this.MundaneMarketPrice = () => Mithral.GetMediumArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => Mithral.GetWeight(WeightScaledBySize(size, WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Mithral", Mithral.WebAddress), StandardName }; this.SpeedPenalty = 0; break; case BreastplateMaterial.Steel: this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneMarketPrice = () => StandardMundaneMarketPriceCalculation(MarketValueScaledBySize(size, PRICE)); this.Weight = () => WeightScaledBySize(size, WEIGHT); this.MundaneName = () => new INameFragment[] { StandardName }; this.SpeedPenalty = SPEED_PENALTY; break; default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }