/// <summary> /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.BandedMail"/> class. /// </summary> /// <param name="size">The size of the character intended to wear the armor.</param> /// <param name="material">The material the banded mail is made from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public BandedMail(SizeCategory size, BandedMailMaterial material) : base(BASE_ARMOR_BONUS, GetHardnessForMaterial(material)) { switch (material) { case BandedMailMaterial.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 BandedMailMaterial.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 BandedMailMaterial.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(BandedMailMaterial material) { switch (material) { case BandedMailMaterial.Adamantine: return(Adamantine.Hardness); case BandedMailMaterial.Mithral: return(Mithral.Hardness); case BandedMailMaterial.Steel: return(Steel.Hardness); default: throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType()); } }