コード例 #1
0
        public void TestForgeMithralWeapon()
        {
            var dagger       = new PhbWeapon("Dagger");
            var mithral      = new Mithral();
            var forgedDagger = new ForgedWeapon(dagger, mithral);

            forgedDagger.NameWeapon("Carlyle's Special Greeting");
            Approvals.Verify(forgedDagger.ToString());
        }
コード例 #2
0
        /// <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());
            }
        }
コード例 #3
0
        /// <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());
            }
        }
コード例 #4
0
        public void GetArmorCheckPenalty_WasTwo_NowZero()
        {
            // Arrange
            byte baseArmorCheckPenalty = 2;

            // Act
            var mithralArmorCheckPenalty = Mithral.GetArmorCheckPenalty(baseArmorCheckPenalty);

            // Assert

            Assert.AreEqual(0, mithralArmorCheckPenalty);
        }
コード例 #5
0
        public void GetWeight()
        {
            // Arrange
            double baseWeight = 12;

            // Act
            var mithralWeight = Mithral.GetWeight(baseWeight);

            // Assert

            Assert.AreEqual(6, mithralWeight);
        }
コード例 #6
0
        public void GetHeavyArmorBaseMarketPrice()
        {
            // Arrange
            double basePrice = 0;

            // Act
            var mithralPrice = Mithral.GetHeavyArmorBaseMarketPrice(basePrice);

            // Assert
            Assert.AreEqual(9000, mithralPrice,
                            "Mithral should increase the price of heavy armor by +9000gp.");
        }
コード例 #7
0
        public void GetMediumArmorBaseMarketPrice()
        {
            // Arrange
            double basePrice = 0;

            // Act
            var mithralPrice = Mithral.GetMediumArmorBaseMarketPrice(basePrice);

            // Assert
            Assert.AreEqual(4000, mithralPrice,
                            "Mithral should increase the price of medium armor by +4000gp.");
        }
コード例 #8
0
        public void GetShieldBaseMarketValue()
        {
            // Arrange
            double basePrice = 1000;

            // Act
            var mithralValue = Mithral.GetShieldBaseMarketValue(basePrice);

            // Assert

            Assert.AreEqual(2000, mithralValue,
                            "2000 = (1000 base) + (1000 material; includes cost of masterwork)");
        }
コード例 #9
0
        public void GetArmorMaximumDexterityBonus_255()
        {
            // Arrange
            byte baseMaxDexBonus = byte.MaxValue;

            // Act
            var mithralValue = Mithral.GetArmorMaximumDexterityBonus(baseMaxDexBonus);

            // Assert

            Assert.AreEqual(255, mithralValue,
                            "255 <= (255 base) + (2 mithral)");
        }
コード例 #10
0
        public void GetArmorMaximumDexterityBonus_Zero()
        {
            // Arrange
            byte baseMaxDexBonus = 0;

            // Act
            var mithralValue = Mithral.GetArmorMaximumDexterityBonus(baseMaxDexBonus);

            // Assert

            Assert.AreEqual(2, mithralValue,
                            "2 = (0 base) + (2 mithral)");
        }
コード例 #11
0
        /// <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());
            }
        }
コード例 #12
0
        public void TestDisplayMithral()
        {
            var mithral = new Mithral();

            Approvals.Verify(mithral.ToString());
        }