예제 #1
0
        /// <inheritdoc />
        public void UseSpellPoints(IManifest manifest, int count)
        {
            if (manifest == null)
            {
                throw new ArgumentNullException(nameof(manifest));
            }

            Mod.Instance.Monitor.Log($"{manifest.Name} {(count < 0 ? "restored" : "used")} {count} spell points on behalf of the current player.");

            SpellBook book = Game1.player.GetSpellBook();

            book.UseSpellPoints(-count);
        }
예제 #2
0
        /*********
        ** Public methods
        *********/
        /// <inheritdoc />
        public void ResetProgress(IManifest manifest)
        {
            if (manifest == null)
            {
                throw new ArgumentNullException(nameof(manifest));
            }

            Mod.Instance.Monitor.Log($"{manifest.Name} reset the current player's magic progress.", LogLevel.Info);

            SpellBook book = Game1.player.GetSpellBook();

            foreach (var spell in book.KnownSpells.Values.ToArray())
            {
                if (spell.Level > 0)
                {
                    book.ForgetSpell(spell.SpellId, 1);
                }
            }
            book.UseSpellPoints(book.FreePoints);
        }