示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.ChainShirt"/> class.
        /// </summary>
        /// <param name="size">The size of the character intended to wear the armor.</param>
        /// <param name="material">The material the chain shirt is made from.</param>
        /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception>
        public ChainShirt(SizeCategory size, ChainShirtMaterial material)
            : base(4, GetHardnessForMaterial(material))
        {
            const byte   ARMOR_CHECK_PENALTY = 2;
            const byte   MAX_DEX_BONUS       = 4;
            const double WEIGHT       = 25;
            const double PRICE        = 100;
            NameFragment standardName = new NameFragment("Chain Shirt", "http://www.d20pfsrd.com/equipment/armor/chain-shirt/");

            switch (material)
            {
            case ChainShirtMaterial.Adamantine:
                this.IsMasterwork           = true;
                this.MasterworkIsToggleable = false;
                this.ArmorCheckPenalty      = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY);
                this.MaximumDexterityBonus  = () => MAX_DEX_BONUS;
                this.MundaneMarketPrice     = () => Adamantine.GetLightArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE));
                this.Weight      = () => WeightScaledBySize(size, WEIGHT);
                this.MundaneName = () => new INameFragment[] {
                    new NameFragment("Adamantine", Adamantine.WebAddress),
                    standardName
                };
                var(drMag, drBypass) = Adamantine.GetLightArmorDamageReduction();
                this.OnApplied      += (sender, e) => {
                    e.Character?.DamageReduction?.Add(drMag, drBypass);
                };
                break;

            case ChainShirtMaterial.Mithral:
                this.IsMasterwork           = true;
                this.MasterworkIsToggleable = false;
                this.ArmorCheckPenalty      = () => Mithral.GetArmorCheckPenalty(ARMOR_CHECK_PENALTY);
                this.MaximumDexterityBonus  = () => Mithral.GetArmorMaximumDexterityBonus(MAX_DEX_BONUS);
                this.MundaneMarketPrice     = () => Mithral.GetLightArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE));
                this.Weight      = () => Mithral.GetWeight(WeightScaledBySize(size, WEIGHT));
                this.MundaneName = () => new INameFragment[] {
                    new NameFragment("Mithral", Mithral.WebAddress),
                    standardName
                };
                break;

            case ChainShirtMaterial.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());
            }
        }
示例#2
0
        private static byte GetHardnessForMaterial(ChainShirtMaterial material)
        {
            switch (material)
            {
            case ChainShirtMaterial.Adamantine: return(Adamantine.Hardness);

            case ChainShirtMaterial.Mithral:       return(Mithral.Hardness);

            case ChainShirtMaterial.Steel:           return(Steel.Hardness);

            default:
                throw new InvalidEnumArgumentException(nameof(material), (int)material, material.GetType());
            }
        }