/// <summary>
        /// Applies the effects of this armor to a character.
        /// </summary>
        /// <param name="character">The character who is wearing this armor.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception>
        public void ApplyTo(ICharacter character)
        {
            if (null == character)
            {
                throw new ArgumentNullException(nameof(character), "Argument may not be null.");
            }
            character.ArmorClass?.ArmorBonuses?.Add(this.GetArmorBonus);
            character.ArmorClass?.MaxKeyAbilityScore?.Add(this.GetMaximumDexterityBonus);
            foreach (var skill in character.Skills?.GetAllSkills() ?? Enumerable.Empty <ISkill>())
            {
                skill.Penalties?.Add(() => skill.ArmorCheckPenaltyApplies ? this.GetArmorCheckPenalty() : (byte)0);
            }
            // Users can cast Fly once per day
            var flySpell        = Core.Domain.Spells.Paizo.CoreRulebook.Fly.WizardVersion;
            var slaAbilityScore = new AbilityScore()
            {
                BaseScore = Convert.ToByte(10 + flySpell.Level)
            };
            var sla = new SpellLikeAbility(usesPerDay:      1,
                                           spell:           flySpell,
                                           keyAbilityScore: slaAbilityScore,
                                           baseCasterLevel: () => this.GetCasterLevel().Value);

            character.SpellLikeAbilities?.Known?.Add(sla);
        }
示例#2
0
        public void HasACertainNumberOfUsesPerDay()
        {
            var yaml      = @"---
spell: ghost sound
per-day: 1";
            var spellLike = new SpellLikeAbility(yaml.ParseYaml());

            Assert.Equal(1, spellLike.UsesPerDay);
            Assert.Equal("ghost sound", spellLike.Spell);
            Assert.Equal("1/day - ghost sound", spellLike.DisplayString());
        }
示例#3
0
        public void Default()
        {
            // Arrange
            byte        usesPerDay   = 55;
            var         spell        = Mock.Of <ISpell>();
            var         abilityScore = Mock.Of <IAbilityScore>();
            Func <byte> casterLevel  = () => 1;

            SpellLikeAbility sla = new SpellLikeAbility(usesPerDay, spell, abilityScore, casterLevel);

            // Assert
            Assert.AreEqual(usesPerDay, sla.UsesPerDay);
        }
        /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception>
        public void ApplyTo(ICharacter character)
        {
            if (null == character)
            {
                throw new ArgumentNullException(nameof(character), "Argument may not be null.");
            }
            var spell       = EtherealJaunt.SorcererVersion;
            var castingStat = new AbilityScore()
            {
                BaseScore = Convert.ToByte(10 + spell.Level)
            };
            var sla = new SpellLikeAbility(usesPerDay: 1,
                                           spell: spell,
                                           keyAbilityScore: castingStat,
                                           baseCasterLevel: () => this.CasterLevel);

            character.SpellLikeAbilities?.Known?.Add(sla);
        }
        /// <summary>
        /// Applies the effects of Hand of the Mage to an ICharacter.
        /// </summary>
        /// <param name="character">The character to apply effects to.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception>
        public void ApplyTo(ICharacter character)
        {
            if (null == character)
            {
                throw new ArgumentNullException(nameof(character), "Argument cannot be null.");
            }
            // Do not register the spell-like ability--we don't want feats applying to it.
            var           spell = MageHand.SorcererVersion;
            IAbilityScore handOfTheMageCastingStat = new AbilityScore {
                BaseScore = Convert.ToByte(10 + spell.Level)
            };
            ISpellLikeAbility mageHandSpellLikeAbility = new SpellLikeAbility(usesPerDay:      0,
                                                                              spell:           spell,
                                                                              keyAbilityScore: handOfTheMageCastingStat,
                                                                              baseCasterLevel: () => this.GetCasterLevel().Value);

            character.SpellLikeAbilities?.Known?.Add(mageHandSpellLikeAbility);
        }
示例#6
0
        public void ApplyTo(ICharacter character)
        {
            if (null == character)
            {
                throw new ArgumentNullException(nameof(character), "Argument cannot be null.");
            }

            // Once per day, the shield can cast Spell Turning.
            // Since it is not specified which version of the spell to use, here we assume it is the sorcerer version.
            // We don't want the SLA registered, since we don't want feats applying to it.
            ISpell        spell = SpellTurning.SorcererVersion;
            IAbilityScore enchantmentCastingStat = new AbilityScore {
                BaseScore = Convert.ToByte(10 + spell.Level)
            };
            ISpellLikeAbility sla = new SpellLikeAbility(usesPerDay:      1,
                                                         spell:           spell,
                                                         keyAbilityScore: enchantmentCastingStat,
                                                         baseCasterLevel: () => this.CasterLevel);

            character.SpellLikeAbilities?.Known?.Add(sla);
        }
示例#7
0
        /// <summary>
        /// Applies Winged Shield's effects to an ICharacter.
        /// </summary>
        /// <param name="character">The character to apply effects to.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when an argument is null.</exception>
        public void ApplyTo(ICharacter character)
        {
            if (null == character)
            {
                throw new ArgumentNullException(nameof(character), "Argument may not be null.");
            }
            character.ArmorClass?.ShieldBonuses?.Add(() => this.GetShieldBonus());
            foreach (var skill in character.Skills?.GetAllSkills() ?? Enumerable.Empty <ISkill>())
            {
                skill.Penalties?.Add(() => skill.ArmorCheckPenaltyApplies ? this.GetArmorCheckPenalty() : (byte)0);
            }
            // Do not register the spell-like ability--we don't want feats applying to it.
            var           flySpell          = Spells.Paizo.CoreRulebook.Fly.WizardVersion;
            IAbilityScore shieldCastingStat = new AbilityScore {
                BaseScore = Convert.ToByte(10 + flySpell.Level)
            };
            ISpellLikeAbility flySpellLikeAbility = new SpellLikeAbility(usesPerDay:      1,
                                                                         spell:           flySpell,
                                                                         keyAbilityScore: shieldCastingStat,
                                                                         baseCasterLevel: () => this.GetCasterLevel().Value);

            character?.SpellLikeAbilities?.Known?.Add(flySpellLikeAbility);
        }