/// <summary> /// Initializes a new instance of the /// <see cref="T:Core.Domain.Items.Shields.Enchantments.Paizo.CoreRulebook.SpellResistance"/> class. /// </summary> /// <param name="spellResistance">The amount of spell resistance to add.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when SpellResistanceMagnitude is an unexpected value.</exception> internal SpellResistance(SpellResistanceMagnitude spellResistance) { switch (spellResistance) { case SpellResistanceMagnitude.SR13: this.SpecialAbilityBonus = 2; break; case SpellResistanceMagnitude.SR15: this.SpecialAbilityBonus = 3; break; case SpellResistanceMagnitude.SR17: this.SpecialAbilityBonus = 4; break; case SpellResistanceMagnitude.SR19: this.SpecialAbilityBonus = 5; break; default: throw new InvalidEnumArgumentException(nameof(spellResistance), (int)spellResistance, typeof(SpellResistanceMagnitude)); } this.Name = new NameFragment($"Spell Resistance ({ (int)spellResistance })", "http://www.d20pfsrd.com/magic-items/magic-armor/magic-armor-and-shield-special-abilities/spell-resistance/"); this.GetSpellResistance = () => Convert.ToByte(spellResistance); }
public void SpellResistance_NonstandardEnum_Throws() { // Arrange SpellResistanceMagnitude badValue = (SpellResistanceMagnitude)(-1); // Act TestDelegate constructor = () => new SpellResistance(badValue); // Assert Assert.Throws <InvalidEnumArgumentException>(constructor); }
/// <summary> /// Enchants this armor with Spell Resistance. /// </summary> /// <param name="protectionLevel">The level of protection bestowed by this armor's enchantment.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the protectionLevel argument is a nonstandard enum.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this armor does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public FullPlate EnchantWithSpellResistance(SpellResistanceMagnitude protectionLevel) { base.EnchantWithSpellResistance(protectionLevel); return(this); }
/// <summary> /// Enchants this armor with Spell Resistance. /// </summary> /// <param name="protectionLevel">The level of protection bestowed by this armor's enchantment.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the protectionLevel argument is a nonstandard enum.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this armor does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public ChainShirt EnchantWithSpellResistance(SpellResistanceMagnitude protectionLevel) { base.EnchantWithSpellResistance(protectionLevel); return(this); }
/// <summary> /// Enchants this armor with Spell Resistance. /// </summary> /// <param name="protectionLevel">The level of protection bestowed by this armor's enchantment.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the protectionLevel argument is a nonstandard enum.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this armor does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public BandedMail EnchantWithSpellResistance(SpellResistanceMagnitude protectionLevel) { base.EnchantWithSpellResistance(protectionLevel); return(this); }
/// <summary> /// Enchants this armor with Spell Resistance. /// </summary> /// <param name="protectionLevel">The level of protection bestowed by this armor's enchantment.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the protectionLevel argument is a nonstandard enum.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this armor does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public PaddedArmor EnchantWithSpellResistance(SpellResistanceMagnitude protectionLevel) { base.EnchantWithSpellResistance(protectionLevel); return this; }
/// <summary> /// Enchants this shield with Spell Resistance. /// </summary> /// <returns>This shield.</returns> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the spellResistance argument is a nonstandard value of SpellResistanceMagnitude.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this shield does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public TowerShield EnchantWithSpellResistance(SpellResistanceMagnitude spellResistance) { base.EnchantWithSpellResistance(spellResistance); return(this); }
/// <summary> /// Enchants this armor with Spell Resistance. /// </summary> /// <param name="protectionLevel">The level of protection bestowed by this armor's enchantment.</param> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when the protectionLevel argument is a nonstandard enum.</exception> /// <exception cref="System.InvalidOperationException">Thrown when this armor does not already have a magical enhancement bonus, or when this enchantment has already been applied.</exception> new public HideArmor EnchantWithSpellResistance(SpellResistanceMagnitude protectionLevel) { base.EnchantWithSpellResistance(protectionLevel); return(this); }