示例#1
0
        public IEnumerable <Spell> GetSpellbook(Player player, OGLContext context, int level = 0)
        {
            List <Spell> res = new List <Spell>();

            CombineSpellChoices(player, context, level);
            CombineSpellbookAdditional(player, context, level);
            string sourcehint = null;

            foreach (Feature f in player.GetFeatures(level))
            {
                if (f is SpellChoiceFeature && ((SpellChoiceFeature)f).SpellcastingID == SpellcastingID)
                {
                    sourcehint = f.Source;
                    foreach (SpellChoice s in Spellchoices)
                    {
                        SpellChoiceFeature scf = (SpellChoiceFeature)f;
                        if (s.UniqueID == scf.UniqueID && scf.AddTo == PreparationMode.Spellbook)
                        {
                            res.AddRange(from spell in s.Choices select new ModifiedSpell(context.GetSpell(spell, scf.Source), scf.KeywordsToAdd, false, false));
                        }
                    }
                }
                else if (f is BonusSpellPrepareFeature bspf && bspf.SpellcastingID == SpellcastingID && bspf.AddTo == PreparationMode.Spellbook)
                {
                    foreach (string s in bspf.Spells)
                    {
                        res.Add(new ModifiedSpell(context.GetSpell(s, bspf.Source), bspf.KeywordsToAdd, true, false));
                    }
                    res.AddRange(Utils.FilterSpell(player.Context, bspf.Condition, bspf.SpellcastingID).Select(s => new ModifiedSpell(s, bspf.KeywordsToAdd, false, false)));
                }
            }
            res.AddRange(from s in SpellbookAdditional select context.GetSpell(s, sourcehint));
            res.Sort();
            return(res);
        }
示例#2
0
        public IEnumerable <Spell> GetAdditionalClassSpells(Player player, OGLContext context, int level = 0)
        {
            List <Spell> res = new List <Spell>();

            CombineSpellbookAdditional(player, context, level);
            CombineSpellChoices(player, context, level);
            string sourcehint = null;

            foreach (Feature f in player.GetFeatures(level))
            {
                if (f is SpellChoiceFeature && ((SpellChoiceFeature)f).SpellcastingID == SpellcastingID)
                {
                    sourcehint = f.Source;
                    foreach (SpellChoice s in Spellchoices)
                    {
                        SpellChoiceFeature scf = (SpellChoiceFeature)f;
                        if (s.UniqueID == scf.UniqueID && scf.AddTo == PreparationMode.ClassList)
                        {
                            res.AddRange(from spell in s.Choices select new ModifiedSpell(context.GetSpell(spell, scf.Source), scf.KeywordsToAdd));
                        }
                    }
                }
            }
            res.AddRange(from s in SpellbookAdditional select context.GetSpell(s, sourcehint));
            res.Sort();
            return(res);
        }
示例#3
0
        //[XmlIgnore]
        // public string Displayname { get; set; }
        public List <ModifiedSpell> GetPrepared(Player player, OGLContext context, int level = 0)
        {
            CombinePrepared(player, context, level);
            List <ModifiedSpell> res = new List <ModifiedSpell>(from s in Prepared select new ModifiedSpell(context.GetSpell(s, null), null, false, false));

            foreach (Feature f in player.GetFeatures(level))
            {
                if (f is BonusSpellPrepareFeature bspf && bspf.SpellcastingID == SpellcastingID && bspf.AddTo == PreparationMode.LearnSpells)
                {
                    foreach (string s in bspf.Spells)
                    {
                        res.Add(new ModifiedSpell(context.GetSpell(s, bspf.Source), bspf.KeywordsToAdd, true, false));
                    }
                    res.AddRange(Utils.FilterSpell(player.Context, bspf.Condition, bspf.SpellcastingID).Select(s => new ModifiedSpell(s, bspf.KeywordsToAdd, true, false)));
                }
            }
            res.Sort();
            return(res);
        }
示例#4
0
        //[XmlIgnore]
        // public string Displayname { get; set; }
        public List <ModifiedSpell> GetPrepared(Player player, OGLContext context, int level = 0)
        {
            CombinePrepared(player, context, level);
            List <ModifiedSpell> res = new List <ModifiedSpell>(from s in Prepared select new ModifiedSpell(context.GetSpell(s, null), null, false, false));

            foreach (Feature f in player.GetFeatures(level))
            {
                if (f is BonusSpellPrepareFeature && ((BonusSpellPrepareFeature)f).SpellcastingID == SpellcastingID)
                {
                    BonusSpellPrepareFeature bspf = (BonusSpellPrepareFeature)f;
                    foreach (string s in bspf.Spells)
                    {
                        res.Add(new ModifiedSpell(context.GetSpell(s, bspf.Source), bspf.KeywordsToAdd, true, false));
                    }
                }
            }
            res.Sort();
            return(res);
        }
示例#5
0
        public IEnumerable <ModifiedSpell> GetLearned(Player player, OGLContext context, int level = 0)
        {
            List <ModifiedSpell> res = new List <ModifiedSpell>();

            CombineSpellChoices(player, context, level);
            foreach (Feature f in player.GetFeatures(level))
            {
                if (f is SpellChoiceFeature && ((SpellChoiceFeature)f).SpellcastingID == SpellcastingID)
                {
                    foreach (SpellChoice s in Spellchoices)
                    {
                        SpellChoiceFeature scf = (SpellChoiceFeature)f;
                        if (s.UniqueID == scf.UniqueID && scf.AddTo == PreparationMode.LearnSpells)
                        {
                            res.AddRange(from spell in s.Choices select new ModifiedSpell(context.GetSpell(spell, f.Source), scf.KeywordsToAdd, false, false));
                        }
                    }
                }
            }
            res.Sort();
            return(res);
        }