/// <summary> /// Use this constructor for full plate made of dragonhide. /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Armor.Paizo.CoreRulebook.FullPlate"/> class. /// </summary> /// <param name="size">The size of character this armor is designed for.</param> /// <param name="color">The color of the dragonhide.</param> public FullPlate(SizeCategory size, DragonhideColor color) : base(baseArmorBonus: BASE_ARMOR_BONUS, materialHardness: Dragonhide.Hardness) { this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => StandardArmorCheckPenaltyCalculation(ARMOR_CHECK_PENALTY); this.MaximumDexterityBonus = () => MAX_DEX_BONUS; this.MundaneName = () => new INameFragment[] { new NameFragment($"{ color } Dragonhide", Dragonhide.WebAddress), StandardName }; this.MundaneMarketPrice = () => Dragonhide.GetArmorBaseMarketPrice(MarketValueScaledBySize(size, PRICE), this.Enchantments, color); this.Weight = () => WeightScaledBySize(size, WEIGHT); }
/// <summary> /// Use this constructor when the shield is to be made from Dragonhide. /// 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="color">The color of dragonhide this shield is crafted from.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public HeavyShield(SizeCategory size, DragonhideColor color) : base(armorClassBonus: ARMOR_BONUS, materialInchesOfThickness: InchesOfThicknessScaledBySize(size, 3f / 2f), materialHitPointsPerInch: Dragonhide.HitPointsPerInch, materialHardness: Dragonhide.Hardness) { this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => this.StandardArmorCheckPenaltyCalculation(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => Dragonhide.GetShieldBaseMarketPrice(MarketValueScaledBySize(size, WOOD_PRICE), this.Enchantments, color); this.Weight = () => WeightScaledBySize(size, WOOD_WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment($"{ color } Dragonhide", Dragonhide.WebAddress), StandardShieldName }; }
/// <summary> /// Use this constructor when the shield is to be made from Dragonhide. /// Initializes a new instance of the <see cref="T:Core.Domain.Items.Shields.Paizo.CoreRulebook.TowerShield"/> class. /// </summary> /// <param name="size">The size of character this shield is intended to be used by.</param> /// <param name="color">The dominant material the shield is crafted from.</param> public TowerShield(SizeCategory size, DragonhideColor color) : base(armorClassBonus: ARMOR_BONUS, materialInchesOfThickness: InchesOfThicknessScaledBySize(size, INCHES_OF_THICKNESS), materialHitPointsPerInch: Dragonhide.HitPointsPerInch, materialHardness: Dragonhide.Hardness) { this.IsMasterwork = true; this.MasterworkIsToggleable = false; this.ArmorCheckPenalty = () => this.StandardArmorCheckPenaltyCalculation(BASE_ARMOR_CHECK_PENALTY); this.MundaneMarketPrice = () => Dragonhide.GetShieldBaseMarketPrice(MarketValueScaledBySize(size, WOOD_PRICE), this.Enchantments, color); this.Weight = () => WeightScaledBySize(size, WOOD_WEIGHT); this.MundaneName = () => new INameFragment[] { new NameFragment($"{ color } Dragonhide", Dragonhide.WebAddress), StandardShieldName }; // Tower shields apply a maximum dexterity bonus to AC this.OnApplied += (sender, e) => { e.Character?.ArmorClass?.MaxKeyAbilityScore?.Add(this.GetMaximumDexterityBonus); }; // Tower shields inflict a -2 penalty to melee attack rolls this.OnApplied += (sender, e) => { e.Character?.AttackBonuses?.GenericMeleeAttackBonus?.Penalties?.Add(() => 2); }; }
/// <summary> /// Calculates the market price of an armor or shield made of dragonhide. /// </summary> /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> private static double GetBaseMarketPrice <E, I>(double basePrice, IEnchantmentAggregator <E, I> enchantmentAggregator, DragonhideColor color) where E : IEnchantment where I : IItem { if (null == enchantmentAggregator) { throw new ArgumentNullException(nameof(enchantmentAggregator), "Argument may not be null."); } double physicalCost = 2 * (basePrice + 150); // twice the masterwork cost // Dragonhide reduces the cost of energy resistance enchantments by 25% double energyResistanceEnchantmentDiscount = 0; // keep track of total discounts foreach (var enchantment in enchantmentAggregator.GetEnchantments().Where((ench) => ench is EnergyResistanceEnchantment)) { switch (color) { case DragonhideColor.Black: case DragonhideColor.Copper: case DragonhideColor.Green: if (enchantment is AcidResistance) { energyResistanceEnchantmentDiscount += 0.25 * enchantment.Cost; } break; case DragonhideColor.Silver: case DragonhideColor.White: if (enchantment is ColdResistance) { energyResistanceEnchantmentDiscount += 0.25 * enchantment.Cost; } break; case DragonhideColor.Blue: case DragonhideColor.Bronze: if (enchantment is ElectricityResistance) { energyResistanceEnchantmentDiscount += 0.25 * enchantment.Cost; } break; case DragonhideColor.Brass: case DragonhideColor.Gold: case DragonhideColor.Red: if (enchantment is FireResistance) { energyResistanceEnchantmentDiscount += 0.25 * enchantment.Cost; } break; default: throw new InvalidEnumArgumentException(nameof(color), (int)color, color.GetType()); } } return(physicalCost - energyResistanceEnchantmentDiscount); }
/// <summary> /// Determines the market value for a Dragonhide shield. /// The cost is: base cost, plus masterwork cost, multiplied by two. /// </summary> /// <returns>The market value.</returns> /// <param name="basePrice">The base cost of the shield (including adjustments for size).</param> /// <param name="enchantments">The enchantments placed on the shield.</param> /// <param name="color">The color of the dragon's hide.</param> /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public static double GetShieldBaseMarketPrice(double basePrice, IEnchantmentAggregator <IShieldEnchantment, Shield> enchantments, DragonhideColor color) { return(GetBaseMarketPrice(basePrice, enchantments, color)); }
/// <summary> /// Determines the market value for Dragonhide armor. /// The cost is: base cost, plus masterwork cost, multiplied by two. /// </summary> /// <returns>The market value.</returns> /// <param name="basePrice">The base cost of the armor (including adjustments for size).</param> /// <param name="enchantments">The enchantments placed on the armor.</param> /// <param name="color">The color of the dragon's hide.</param> /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception> public static double GetArmorBaseMarketPrice(double basePrice, IEnchantmentAggregator <IArmorEnchantment, Armor.Armor> enchantments, DragonhideColor color) { return(GetBaseMarketPrice(basePrice, enchantments, color)); }