コード例 #1
0
 public override bool Check(
     FeatureSelectionState selectionState,
     UnitDescriptor unit,
     LevelUpState state)
 {
     return(unit.GetSpellbook(character_class) != null);
 }
コード例 #2
0
        static private IEnumerable <FeatureUIData> ExtractKnownSpells(BlueprintParametrizedFeature feature, UnitDescriptor unit, bool only_spontaneous)
        {
            foreach (Spellbook spellbook in unit.Spellbooks)
            {
                if (feature.SpellcasterClass != null &&
                    spellbook != unit.GetSpellbook(feature.SpellcasterClass))
                {
                    continue;
                }
                if (only_spontaneous && !spellbook.Blueprint.Spontaneous)
                {
                    continue;
                }

                if (!only_spontaneous && spellbook.Blueprint.GetComponent <SpellbookMechanics.GetKnownSpellsFromMemorizationSpellbook>() != null)
                {
                    continue;
                }
                foreach (var spell in spellbook.GetAllKnownSpells())
                {
                    if (spell.MetamagicData != null && spell.MetamagicData.MetamagicMask != 0)
                    {
                        continue;
                    }

                    yield return(new FeatureUIData(feature, spell.Blueprint, spell.Blueprint.Name, spell.Blueprint.Description, spell.Blueprint.Icon, spell.Blueprint.name));
                }
            }
            yield break;
        }
コード例 #3
0
        //used to extract arcanist memorization spellbook from his spontaneous spellbook, for any other kind of spellbooks return spellbook argument
        public static Spellbook getClassSpellbook(Spellbook spellbook, UnitDescriptor unit)
        {
            var companion_spellbook = spellbook?.Blueprint.GetComponent <GetKnownSpellsFromMemorizationSpellbook>()?.spellbook;

            if (companion_spellbook != null)
            {
                return(unit.GetSpellbook(companion_spellbook));
            }
            return(spellbook);
        }
コード例 #4
0
 protected override IEnumerable <BlueprintScriptableObject> GetItems(UnitDescriptor beforeLevelUpUnit, UnitDescriptor previewUnit)
 {
     if (SpellcasterClass != null)
     {
         var spellbook = previewUnit.GetSpellbook(SpellcasterClass);
         return(spellbook != null?GetKnownSpells(spellbook) : Array.Empty <BlueprintAbility>());
     }
     else
     {
         return(previewUnit.Spellbooks.SelectMany(GetKnownSpells));
     }
 }
コード例 #5
0
        //used to extract arcanist spontaneous spellbook from his memorization spellbook, for any other kind of spellbooks return spellbook argument
        public static Spellbook getCastingSpellbook(Spellbook spellbook, UnitDescriptor unit)
        {
            var sb1 = spellbook?.Blueprint.GetComponent <CompanionSpellbook>()?.spellbook?.GetComponent <GetKnownSpellsFromMemorizationSpellbook>()?.spellbook;

            if (sb1 == null)
            {
                return(spellbook);
            }
            else
            {
                return(unit.GetSpellbook(sb1));
            }
        }
コード例 #6
0
        private void PrepareSpellbook(UnitDescriptor unit)
        {
            Spellbook spellbook = unit.GetSpellbook(instance.CharacterClass);

            if (spellbook == null)
            {
                return;
            }
            spellbook.UpdateAllSlotsSize(true);
            foreach (BlueprintAbility blueprint in instance.MemorizeSpells)
            {
                AbilityData data = new AbilityData(blueprint, spellbook);
                spellbook.Memorize(data, null);
            }
        }
コード例 #7
0
        static private IEnumerable <FeatureUIData> ExtractAvailableSpells(BlueprintParametrizedFeature feature, UnitDescriptor unit)
        {
            foreach (Spellbook spellbook in unit.Spellbooks)
            {
                if (feature.SpellcasterClass != null &&
                    spellbook != unit.GetSpellbook(feature.SpellcasterClass))
                {
                    continue;
                }



                foreach (var spell in spellbook.Blueprint.SpellList.GetSpells(feature.SpellLevel))
                {
                    yield return(new FeatureUIData(feature, spell, spell.Name, spell.Description, spell.Icon, spell.name));
                }
            }
            yield break;
        }
コード例 #8
0
        protected override IEnumerable <BlueprintScriptableObject> GetItems(UnitDescriptor beforeLevelUpUnit, UnitDescriptor previewUnit)
        {
            var spells = new List <BlueprintAbility>();

            var classData      = previewUnit.Progression.GetClassData(SpellcasterClass);
            var classSpellbook = classData?.Spellbook;

            if (classSpellbook == null)
            {
                return(spells);
            }

            var spellbook = previewUnit.GetSpellbook(classSpellbook);

            if (spellbook == null)
            {
                return(spells);
            }

            // Bloodline/Mystery spells cannot legally be replaced.
            var grantedSpells = new HashSet <BlueprintAbility>(previewUnit.Progression.Features.Enumerable
                                                               .SelectMany(f => f.Blueprint.GetComponents <AddKnownSpell>()).Select(a => a.Spell));

            for (int level = 1; level <= SpellLevel; level++)
            {
                foreach (var knownSpell in spellbook.GetKnownSpells(level))
                {
                    var spell = knownSpell.Blueprint;
                    if (grantedSpells.Contains(spell))
                    {
                        continue;
                    }
                    spells.Add(spell);
                }
            }
            return(spells);
        }
コード例 #9
0
ファイル: Traits.cs プロジェクト: slipenbois/eldritcharcana
 protected override bool CanSelect(UnitDescriptor unit, FeatureParam param)
 {
     // TODO: this doesn't seem to work.
     return(!CheckNotKnown || !unit.GetSpellbook(SpellcasterClass).IsKnown(param.Blueprint as BlueprintAbility));
 }
コード例 #10
0
 public override bool Check(FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state)
 {
     return(unit.GetSpellbook(CharacterClass)?.MaxSpellLevel >= RequiredSpellLevel);
 }