/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.SplintMail"/> class. /// </summary> /// <param name="size">The size of the character intended to wear the armor.</param> /// <param name="material">The material the splint mail is made from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public SplintMail(SizeCategory size, SplintMailMaterial material) : base(BASE_ARMOR_BONUS, GetHardnessForMaterial(material)) { switch (material) { case SplintMailMaterial.Adamantine: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneMarketPrice = () => Adamantine.GetHeavyArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => WeightScaledBySize(size, WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment("Adamantine", Adamantine.WebAddress), StandardName }; var(drMag, drBypass) = Adamantine.GetHeavyArmorDamageReduction(); this.OnApplied += (sender, e) => { e.Character?.DamageReduction?.Add(drMag, drBypass); }; break; case SplintMailMaterial.Mithral: this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => Mithral.GetArmorCheckPenalty(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => Mithral.GetArmorMaximumDexterityBonus(MAX_DEX_BONUS); this.MundaneMarketPrice = () => Mithral.GetHeavyArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE)); this.Weight = () => Mithral.GetWeight(WeightScaledBySize(size, WEIGHT)); this.MundaneName = () => new INameFragment[] { new NameFragment("Mithral", Mithral.WebAddress), StandardName }; break; case SplintMailMaterial.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 }; break; default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }
private static byte GetHardnessForMaterial(SplintMailMaterial material) { switch (material) { case SplintMailMaterial.Adamantine: return(Adamantine.Hardness); case SplintMailMaterial.Mithral: return(Mithral.Hardness); case SplintMailMaterial.Steel: return(Steel.Hardness); default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }